Wiring runbook
Every API call goes to https://api.api365relay.com; the main site is only for managing your account.
1Line address table
One relay endpoint takes all three protocols; enter the address and auth header that match what your client speaks.
| Protocol lane | Address to enter | Auth header | Main paths |
|---|---|---|---|
| Anthropic Messages · Claude Code / Claude Desktop | https://api.api365relay.com | x-api-key | /v1/messages · /v1/messages/count_tokens |
| OpenAI · Codex / OpenAI SDK | https://api.api365relay.com/v1 | Authorization: Bearer | /chat/completions · /responses · /models |
| Gemini · Gemini CLI | https://api.api365relay.com | x-goog-api-key | /v1beta/models/{model}:generateContent · :streamGenerateContent?alt=sse |
2Status codes and what to do
| Code | What it means | What to do |
|---|---|---|
| 401 | No key, a mistyped key, or a disabled key | Copy an in-use key from the dashboard and send it in the header listed above |
| 402 | Wallet is empty, or the duty pass quota or 7-day ceiling is used up | Top up, or switch to a duty pass that still has quota |
| 403 | The account is switched off, or a pass key called another model family | Use a wallet key for models outside the pass family |
| 404 | The path is not on any desk lane (Gemini paths look like /v1beta/models/model:method) | Check the base URL and path against the table above |
| 413 | The request body is over 25 MB | Trim the context or attachments and resend |
| 429 | Over 120 calls in 60 seconds on one key, or more than 8 requests in flight for one account | Wait a moment and keep concurrency at 8 or fewer |
| 502 / 503 | The upstream lane did not answer (502) or is not configured (503); nothing is billed | Retry shortly; if it persists, leave a message via Contact |
3Client configuration table
| Client tool | What to set | Value to use |
|---|---|---|
| Claude Code / Claude Desktop | ANTHROPIC_BASE_URL · ANTHROPIC_AUTH_TOKEN | Relay endpoint, without /v1 · Your API key |
| Codex CLI | OPENAI_BASE_URL · OPENAI_API_KEY | Relay endpoint plus /v1 · Your API key |
| OpenAI SDK | base_url · api_key | Relay endpoint plus /v1 · Your API key |
| Gemini CLI | GOOGLE_GEMINI_BASE_URL · GEMINI_API_KEY | Relay endpoint, without /v1 · Your API key |
| cURL | Authorization: Bearer | Your API key |
Upstream accepts Claude models only from the official Claude Code / Claude Desktop clients, and Claude Code must be 2.1.285 or newer. GPT, Gemini and the rest work from any OpenAI-compatible client or SDK.
export ANTHROPIC_BASE_URL=https://api.api365relay.com
export ANTHROPIC_AUTH_TOKEN=r365-your-line-key
claude
Replace $R365_KEY with your line key; a reply means the line is up.
curl https://api.api365relay.com/v1/chat/completions \
-H "Authorization: Bearer $R365_KEY" -H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"ping from the night shift"}]}'
GPT wire names on the board: gpt-6.1-sol gpt-6-astra gpt-5.6-sol
Gemini uses its native protocol only: :generateContent for single replies, :streamGenerateContent?alt=sse for streams. It cannot go through /v1/chat/completions.
curl "https://api.api365relay.com/v1beta/models/gemini-3.8-flash:generateContent" \
-H "x-goog-api-key: $R365_KEY" -H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"ping from the night shift"}]}]}'
Gemini wire names on the board: gemini-3.1-pro gemini-4-argon gemini-3.8-flash gemini-2.5-flash
4Metering rules
- Each request is billed on the token counts upstream reports; cache fills and cache recalls have their own rates.
- HTTP 402: the wallet is empty or the pass quota is used up; topping up restores service.
- HTTP 429: more than 120 calls in 60 seconds on one key, or more than 8 requests in flight for one account.
- HTTP 401: the key is missing, mistyped or stood down.
- OpenAI-style calls send the key as Authorization: Bearer, Anthropic-style calls use x-api-key, Gemini uses x-goog-api-key.