Agnai (Agnaistic) setup: the Third-Party API fields
Point an Agnai preset at RelaySwitch: five fields, the model id to type, and what each message costs.
Agnai reaches a hosted API through a preset whose AI Service is Third-Party. Set the format to OpenAI Compat (Chat), paste https://api.relayswitch.io/v1 as the Third Party URL, the key in Third Party Key/Password, and a model id in OpenAI Model Override. One key reaches every model in the catalog, from the uncensored roleplay builds to Claude, billed per token from a prepaid balance. The same preset works on agnai.chat and on a self-hosted copy.
01What you need
- An Agnai account on agnai.chat, or your own instance from the repository.
- A RelaySwitch key from the console (email code sign-in). Keys start with
sk-relay-. - A balance. Top-ups start at $10, by card or crypto, with no subscription. Before the first top-up the console chat runs 12 free turns a day, so you can try a model there before you connect it.
02The preset fields
Open Presets, create one (or edit the one your chat uses), and set these, in this order:
AI Service: Third-PartyThird Party Format: OpenAI Compat (Chat)Third Party URL: https://api.relayswitch.io/v1Third Party Key/Password: sk-relay-...OpenAI Model Override: glm-5.3-uncensored- AI Service: Third-Party. Agnai's own services send to its models; Third-Party is the one that takes a URL.
- Third Party Format: OpenAI Compat (Chat). The list also offers OpenAI Compat (Chat - Legacy), OpenAI (Completion), Kobold, Llama.cpp and others; each sends a different request shape, and only the chat format matches this API.
- Third Party URL:
https://api.relayswitch.io/v1, with the/v1and nothing after it. Agnai appends the chat completions path. - Third Party Key/Password: your
sk-relay-key, nothing in front of it. - OpenAI Model Override: the exact id from the Models page. Agnai sends that value as the model name; a display name answers 404
model_not_found.
Save the preset and attach it to the chat. Agnai has no test button: the first message is the test, and an error shows in place of the reply with its status code.
03Which model to type
Uncensored and roleplay builds first: they answer without the stock refusals, and the roleplay ones are tuned on fiction and dialogue. Prices are per million tokens. The turn columns price one 2K-in / 300-out turn: 2,000 tokens of card, persona and recent history in, 300 tokens of reply out.
| Model | OpenAI Model Override | Context | Input / M | Output / M | one 2K-in / 300-out turn | 100 turns |
|---|---|---|---|---|---|---|
| GLM-5.3 Flash Uncensored | glm-5.3-flash-uncensored | not stated | $0.1053 | $0.3685 | $0.00032 | $0.0321 |
| GLM-5.3 Uncensored | glm-5.3-uncensored | not stated | $0.282 | $0.846 | $0.00082 | $0.0818 |
| Gemma 4 31B Fabled | gemma-4-31b-fabled | 262K tokens | $0.35 | $1.575 | $0.0012 | $0.1173 |
| Qwen3.8 27B Novelist | qwen3.8-27b-novelist | 262K tokens | $0.35 | $2.10 | $0.0013 | $0.133 |
| Cydonia 24B v4.3 | cydonia-24b-v4.3 | 131K tokens | $0.484 | $0.60 | $0.0011 | $0.1148 |
| Uncensored AI Roleplay | uncensored-ai-roleplay | 128K tokens | $0.60 | $2.34 | $0.0019 | $0.1902 |
| DeepSeek V4.1 Flash Abliterated | deepseek-v4.1-flash-abliterated | not stated | $0.8488 | $1.6975 | $0.0022 | $0.2207 |
| DeepSeek V4 Pro Uncensored | deepseek-v4-pro-uncensored | not stated | $0.97 | $1.94 | $0.0025 | $0.2522 |
USD, read from the RelaySwitch catalog when this page was built.
The flagships, for longer memory and stronger writing:
| Model | OpenAI Model Override | Context | Input / M | Output / M | one 2K-in / 300-out turn | 100 turns |
|---|---|---|---|---|---|---|
| Claude Sonnet 4.6 | claude-sonnet-4-6 | 1M tokens | $1.80 | $9.00 | $0.0063 | $0.63 |
| Gemini 3.1 Pro Preview | gemini-3.1-pro-preview | 1M tokens | $1.20 | $7.20 | $0.0046 | $0.456 |
| DeepSeek V3.2 | deepseek-v3.2 | not stated | $1.08 | $1.6801 | $0.0027 | $0.2664 |
| Grok 4.6 | grok-4.6 | 500K tokens | $0.60 | $1.80 | $0.0017 | $0.174 |
| GLM 5.3 | glm-5.3 | 1M tokens | $0.3178 | $0.9987 | $0.00094 | $0.0935 |
USD, read from the RelaySwitch catalog when this page was built.
The uncensored models page lists every build the catalog tags, and the ranked list orders them by use.
04What a long chat costs
Every message resends the card, the memory book entries and as much history as the preset's context limit allows, so input grows as the chat does. Per message at three context sizes, with a 300-token reply:
| Context sent | Gemma 4 31B Fabled | GLM-5.3 Uncensored | Claude Sonnet 4.6 |
|---|---|---|---|
| 4,000 tokens | $0.0019 | $0.0014 | $0.0099 |
| 8,000 tokens | $0.0033 | $0.0025 | $0.0171 |
| 16,000 tokens | $0.0061 | $0.0048 | $0.0315 |
USD per message, read from the RelaySwitch catalog when this page was built.
Keep the preset's context limit at or under the model's window in the Context column. The console's Usage page lists every request with its tokens and charge, and each one has a signed receipt.
05Errors
401"No API key was sent" orinvalid_api_key: Third Party Key/Password is empty or wrong. Paste the key again.402: the balance is empty, or the key reached its own budget. Top up or raise the budget in the console.404model_not_found: the id in OpenAI Model Override is not in the catalog. Copy it from the Models page.route_not_found: the URL is wrong or the format is not OpenAI Compat (Chat).429: the key hit its requests or tokens per minute limit. Wait a few seconds and resend.503: no host could serve that model right now. Resend, or pick another model.
06Sources
The service, format and field names are from Agnai's source, common/adapters.ts on the dev branch, read 2026-11-03. The in-app click path is not asserted beyond the Presets panel; match each field by its label.
Questions
- Does Agnai support a custom OpenAI-compatible API?
- Yes, through the Third-Party AI Service: Third Party Format OpenAI Compat (Chat), the URL https://api.relayswitch.io/v1, the key in Third Party Key/Password and the model id in OpenAI Model Override.
- Where is the model field in Agnai?
- It is called OpenAI Model Override, in the same preset as the URL and key. Type the id exactly as the Models page prints it; Agnai does not fetch a model list.
- Is Agnai free?
- agnai.chat is free to use with its own models, and the code is open on GitHub. A Third-Party connection is billed by the API behind it: here per token, prepaid from $10, no subscription.
- How much does an Agnai message cost?
- One 2K-in / 300-out turn on GLM-5.3 Flash Uncensored costs $0.00032 today, or $0.0321 for 100. A larger context limit raises the input side once the chat fills it.
- Which Third Party Format do I pick?
- OpenAI Compat (Chat). The Legacy, Completion and Kobold options send a different request shape and answer 404 route_not_found here.