API and Keys
The REST API, personal API keys, and the MCP endpoint for agents.
Every page in the app talks to one REST API. The same API is available to you with a personal key, so a script or an agent can read and write the account instead of clicking the site.
Base URL and conventions
https://<your-host>/api- JSON in, JSON out.
- Most list endpoints accept
limitand a keysetcursor, and return apageobject with the next cursor. - An error is
{ "error": "..." }with the matching HTTP status. - A write that needs a paid action returns the price first when the endpoint asks for a quote.
Authentication
Two paths:
- Session cookie. The web app signs in with Better Auth. A script can use the same session.
- API key. Create a key in your account settings and send it as a bearer token:
curl -H "Authorization: Bearer $TAVERN_API_KEY" \
https://taverncozy.com/api/auth/meAn API key acts as you. It reads chats, and it can spend credits on a metered endpoint. An API key is not presence: a machine reading a chat does not make the app think you are online.
What the API covers
| Area | Prefix |
|---|---|
| Auth and session | /api/auth/* |
| Characters | /api/characters |
| Profiles | /api/profiles |
| Chats and messages | /api/chats, /api/messages |
| Lorebooks | /api/lorebooks |
| Personas | /api/personas |
| Presets | /api/presets |
| Media generation | /api/media, /api/image-models, /api/llm-models |
| Speech and voice | /api/speech, /api/speech-models |
| MomoTalk | /api/momo-talk |
| Heartline | /api/heartline |
| Fabula | /api/fabula |
| Fanfiction | /api/fanfiction |
| Boards and threads | /api/boards, /api/board-threads |
| Posts and artworks | /api/posts, /api/artworks |
| Store and packs | /api/packs, /api/creator-payouts |
| LoRAs | /api/lora |
| Groups | /api/groups |
| Admin | /api/admin |
Each prefix groups the endpoints for one part of the app. A list endpoint accepts
limit and a keyset cursor and returns the next cursor with the page.
MCP
The API also exposes an MCP endpoint for agents at /api/mcp. Point an MCP client
at it with the same bearer key, and the client gets tools that map to the API
calls above. Use a key with only the access you want the agent to have.
A key can spend credits. Give an agent its own key, and rotate it when the agent no longer needs it. Deleting the key stops it immediately.
BYOK
If you have your own OpenRouter key, you can connect it in the app. A BYOK model call does not spend Tavern credits, because the provider bills your own account. The app stores the key and uses it only for your calls.