Point your coding agent at endlesstokens in a minute.
export ANTHROPIC_BASE_URL=https://api.endlesstokens.ai
export ANTHROPIC_AUTH_TOKEN=<your-key>
export ANTHROPIC_MODEL=qwen3.8-27b
export ANTHROPIC_DEFAULT_OPUS_MODEL=qwen3.8-27b
export ANTHROPIC_DEFAULT_SONNET_MODEL=qwen3.8-27b
export ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen3.8-27b
export ANTHROPIC_SMALL_FAST_MODEL=qwen3.8-27b
export CLAUDE_CODE_SUBAGENT_MODEL=qwen3.8-27b{
"env": {
"ANTHROPIC_BASE_URL": "https://api.endlesstokens.ai",
"ANTHROPIC_AUTH_TOKEN": "<your-key>",
"ANTHROPIC_MODEL": "qwen3.8-27b",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.8-27b",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.8-27b",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.8-27b",
"ANTHROPIC_SMALL_FAST_MODEL": "qwen3.8-27b",
"CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.8-27b"
}
}How many sessions can run in parallel per key depends on your plan. Your key page shows the number.
Check that it works:
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer <your-key>"export ENDLESSTOKENS_API_KEY=<your-key>model = "qwen3.8-27b"
model_provider = "endlesstokens"
[model_providers.endlesstokens]
name = "endlesstokens"
base_url = "https://api.endlesstokens.ai/v1"
env_key = "ENDLESSTOKENS_API_KEY"
wire_api = "responses"Keep wire_api = "responses": Codex talks to the Responses API (POST https://api.endlesstokens.ai/v1/responses), and we serve it. The model must be the exact model name from Models and limits below; a name we do not serve is refused with 404 model_not_found.
Check that it works:
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $ENDLESSTOKENS_API_KEY"Base URL: https://api.endlesstokens.ai/v1
API Key: <your-key>
Model ID: qwen3.8-27bImage and video limits are listed under Models and limits below.
Check that it works:
export ENDLESSTOKENS_API_KEY=<paste your key>
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $ENDLESSTOKENS_API_KEY"export ENDLESSTOKENS_API_KEY=<your-key>{
"$schema": "https://opencode.ai/config.json",
"provider": {
"endlesstokens": {
"npm": "@ai-sdk/openai-compatible",
"name": "endlesstokens",
"options": {
"baseURL": "https://api.endlesstokens.ai/v1",
"apiKey": "{env:ENDLESSTOKENS_API_KEY}"
},
"models": {
"qwen3.8-27b": { "name": "qwen3.8-27b" }
}
}
},
"model": "endlesstokens/qwen3.8-27b"
}Image and video limits are listed under Models and limits below.
Check that it works:
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $ENDLESSTOKENS_API_KEY"Base URL: https://api.endlesstokens.ai/v1
API Key: <your-key>
Model: qwen3.8-27bImage and video limits are listed under Models and limits below.
Check that it works:
export ENDLESSTOKENS_API_KEY=<paste your key>
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $ENDLESSTOKENS_API_KEY"Base URL: https://api.endlesstokens.ai/v1
API Key: <your-key>
Model: qwen3.8-27bImage and video limits are listed under Models and limits below.
Check that it works:
export ENDLESSTOKENS_API_KEY=<paste your key>
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $ENDLESSTOKENS_API_KEY"export OPENAI_API_BASE=https://api.endlesstokens.ai/v1
export OPENAI_API_KEY=<your-key>
aider --model openai/qwen3.8-27bImage and video limits are listed under Models and limits below.
Check that it works:
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"Any client that lets you set a base URL and an API key can use endlesstokens.
Base URL: https://api.endlesstokens.ai/v1
API key: <your-key>
Model: qwen3.8-27bImage and video limits are listed under Models and limits below.
Check that it works:
export ENDLESSTOKENS_API_KEY=<paste your key>
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer $ENDLESSTOKENS_API_KEY"Use this page if you call the API yourself (curl, scripts, your own app). Base URL: https://api.endlesstokens.ai/v1. Use the exact model name from Models and limits below.
Authentication. Send your key in any one of these headers. All three work on every endpoint. Use Authorization: Bearer for OpenAI-style clients and x-api-key for Anthropic-style clients (the Anthropic SDK, or Claude Code with ANTHROPIC_API_KEY).
curl https://api.endlesstokens.ai/v1/models -H "Authorization: Bearer <your-key>"
curl https://api.endlesstokens.ai/v1/models -H "x-api-key: <your-key>"
curl https://api.endlesstokens.ai/v1/models -H "api-key: <your-key>"Endpoints. POST https://api.endlesstokens.ai/v1/chat/completions, /completions, /embeddings, /messages, /responses and /messages/count_tokens. GET https://api.endlesstokens.ai/v1/models and /models/<name>. Every path must start with /v1; a path without it (for example /embeddings) returns 404 `not_found`. Model names are case-sensitive: send the name exactly as `GET /v1/models` lists it, otherwise you get 404 `model_not_found`. Requests are stateless: send the whole conversation each time. Other methods return 405 and unknown paths 404.
curl https://api.endlesstokens.ai/v1/chat/completions \
-H "Authorization: Bearer <your-key>" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3.8-27b","messages":[{"role":"user","content":"Hello"}],"stream":true}'Model names. Use the exact model name. A name we do not serve returns 404 with code model_not_found (Anthropic format: not_found_error). The context window differs per model and can change: read it from the Context window column in Models and limits below, or from the context_length field of GET https://api.endlesstokens.ai/v1/models. It covers prompt plus output. A request that does not fit is refused by the model server.
Errors. Chat, completions, embeddings and responses return the OpenAI shape:
{"error":{"message":"Unknown model 'x'. See https://example.test/setup for supported model names.","type":"invalid_request_error","param":"model","code":"model_not_found"}}The /messages endpoint returns the Anthropic shape, with request_id in the body:
{"type":"error","error":{"type":"not_found_error","message":"..."},"request_id":"..."}Busy-GPU and outage errors are 503 in the OpenAI shape and 529 (overloaded_error) in the Anthropic shape. An error that is worth retrying carries a Retry-After header. Honour it.
Embeddings limits. Send `input` as a string or an array of strings (text only, no token arrays, no empty strings). One request takes at most 64 inputs (the operator can set it lower); more returns 400 `invalid_request` with param `input`. Each input must fit the context_length of the embedding model, read from GET https://api.endlesstokens.ai/v1/models. An input that is too long returns 400 `context_length_exceeded` with param `input`; the message names the input by its position. The gateway also refuses a very large input at once, without sending it to the model, so split long documents into shorter inputs. Keys have their own parallel limit for embeddings; see Parallel limit below.
| Model | Name to use | Context window |
|---|---|---|
| Qwen3.8-27B | qwen3.8-27b | 256K tokens |
/v1/messages Anthropic-style chat (Claude Code)/v1/messages/count_tokens Anthropic-style token count/v1/chat/completions OpenAI-style chat/v1/responses OpenAI-style responses (Codex)/v1/completions OpenAI-style text completion (editor autocomplete)/v1/embeddings Embeddings (only for models that support them)/v1/models List the models you can useEmbeddings response size. The default response is a JSON list of floats, which is large: a batch of 64 inputs can be over 1 MB. Send `"encoding_format":"base64"` to get each embedding as a base64 string of little-endian float32 values, about 3 times smaller. `dimensions` (an integer, up to the model's full size) returns shorter vectors. Decode base64 in Python:
import base64, numpy as np
vector = np.frombuffer(base64.b64decode(item["embedding"]), dtype="<f4")curl https://api.endlesstokens.ai/v1/embeddings \
-H "Authorization: Bearer <your-key>" \
-H "Content-Type: application/json" \
-d '{"model":"<embedding-model-name>","input":["first text","second text"],"encoding_format":"base64"}'Parallel limit. Each key can run a limited number of requests at the same time. The number depends on your plan and is on your key page. Every response after authentication carries X-ET-Parallel-Limit (the limit for your key) and X-ET-Queue-Ms (how many milliseconds the request waited before it started, 0 if it did not wait).
When your key is at its limit, an extra request does not fail at once. It waits in a short per-key queue and starts as soon as a slot frees. You see no bytes while it waits, and X-ET-Queue-Ms shows the wait. The wait time and the queue depth are Gateway settings the operator can change. If the queue is full or the wait runs out, you get one 429 (code parallel_cap) with a Retry-After header. Retry after that many seconds.
Headers. There are no x-ratelimit-* headers. Use X-ET-Parallel-Limit and Retry-After instead. Idempotency-Key is not supported yet: every request, including a retry, is processed as a new request. Billing is time-based, so a retry costs nothing extra. If your client disconnects, the gateway cancels the upstream call at once and frees the parallel slot.
Request ids. Every error response carries request-id and X-ET-Request-Id, and so do successful chat responses. Quote it when you contact support. If you send X-Client-Request-Id (1 to 128 characters: letters, digits, dot, underscore, hyphen), it is echoed back on the response and kept in our request log. An invalid value is ignored.
Browsers. CORS allows any origin (*) and the Authorization header on purpose, so browser-based tools can call the API. Requests go without credentials: keys are bearer tokens and never cookies, so send the key in a header, not a cookie. Never put a key in a public web page: anyone who opens the page can read it. These response headers are readable from browser code: request-id, X-ET-Request-Id, X-ET-Parallel-Limit, X-ET-Queue-Ms, X-ET-Time-Left, X-ET-Queued-Topups, X-ET-Expiry-Warning, X-ET-Tools-Stripped and Retry-After. The origin list is a Gateway setting the operator can narrow.
Status. GET https://api.endlesstokens.ai/v1/et/status without a key answers {"status":"ok"}. With your key it also lists, for each model your pass covers, the time left, queued top-ups, your active sessions and your session cap.
curl https://api.endlesstokens.ai/v1/et/status -H "Authorization: Bearer <your-key>"Streaming speed. A streamed chunk usually carries about 4 tokens, because the model server uses speculative decoding and we forward its chunks one for one. Do not count tokens by counting chunks.