# publik

> publik (publikhq.com) is a catalog of open-source desktop and web apps, and publik API: one OpenAI-compatible endpoint that gives an app's users AI with no key of their own, priced in dollars, with $0.05 of free use once a user links their publik account (an install itself starts at $0.00) and a share for the app's builder.

## Instructions

- Base URL (always this, whichever host served this file): https://publikhq.com/api/v1. Dialects: OpenAI Chat Completions (`/chat/completions`), OpenAI Responses (`/responses`), Anthropic Messages (`/messages`).
- Always use the alias model names `publik-fast`, `publik-balanced` or `publik-smart`. Never send a raw upstream model slug; the tier decides what serves it.
- Keys: an installed app gets its own `pk_live_` key from `POST /installs`, using the app's public `pat_` app token (a committed `publik-app-token.txt` for apps people install and run themselves; `PUBLIK_APP_TOKEN` env for a server the builder deploys), after the user accepts a disclosure. The key lives in the per-app credential file (macOS `~/Library/Application Support/publik/apps/<slug>.json`, Windows `%LOCALAPPDATA%\publik\apps\<slug>.json`, Linux `~/.config/publik/apps/<slug>.json`, mode 0600) or in `PUBLIK_API_KEY` / `PUBLIK_API_BASE_URL`.
- Never print, log or commit a key (`pk_`, `pbt_`). Never read `.env` files to find one.
- A `402` carries `error.message` and `error.top_up_url`: show the message and that one link.
- Web search: `POST /search` with `{"q": "...", "count": 10}` (quote a phrase to find it exactly) answers `results[]` of `url`, `title`, `snippet`, `site`, at one published price per search. Steps: https://publikhq.com/skills/search.md.
- To add publik API to an app, fetch https://publikhq.com/skills/api.md raw with curl and follow it step by step. To list an app, the same with https://publikhq.com/skills/publish.md. Both use the device flow at `/api/v1/device/code`.

## Docs

- [publik API](https://publikhq.com/developers): models, base URL, headers, request size
- [Pricing](https://publikhq.com/pricing): the plans and packs your users buy, in dollars
- [Skill index](https://publikhq.com/SKILL.md)
- [Set up an app end to end](https://publikhq.com/skills/setup.md)
- [Add publik API to an app](https://publikhq.com/skills/api.md)
- [Add publik web search to an app](https://publikhq.com/skills/search.md)
- [List an app on publik](https://publikhq.com/skills/publish.md)

## Reference modules

- [TypeScript (Node, Electron main)](https://publikhq.com/sdk/publik.ts.md)
- [Python](https://publikhq.com/sdk/publik.py.md)
- [Swift (macOS)](https://publikhq.com/sdk/publik.swift.md)
- [Rust (Tauri)](https://publikhq.com/sdk/publik.rs.md)
