Use TulexAI models in Claude Code, opencode and Pi
One API key, two compatible surfaces, 49+ models behind one bill. Point your agent at TulexAI and keep the harness you already use.
TulexAI exposes two API surfaces: an OpenAI-compatible one at https://api.tulexai.com/v1 for opencode, Pi and any OpenAI SDK, and an Anthropic-compatible one at https://api.tulexai.com/anthropic for Claude Code. One API key works on both, calls are billed to the same Platform Token balance as the website, and plans start at $11/month.
Before you start
- 1
A TulexAI account
A free verified account gets one trial key with a 400 PT budget - connect, run a real request, watch the hard stop. A subscription (from $11/month) unlocks all models; standard keys stop working if it lapses.
- 2
An API key from Settings
Go to Settings and open the API keys section, then create a key. The full key is shown once and never again - store it before closing the dialog.
- 3
The right base URL for your tool
Anthropic-shaped clients and OpenAI-shaped clients use different URLs. Copy the one that matches your harness from the next section.
Prove it works before you open a terminal
Paste your key and watch a live streamed reply from /anthropic/v1/messages - the exact endpoint Claude Code calls. If it streams here, your harness will work, and any failure names itself instead of leaving you guessing.
Two surfaces, one key
Pick by the shape your tool speaks, not by the model you want - every model is reachable from both. The same sk_live_ key authenticates each one.
OpenAI-compatible
https://api.tulexai.com/v1
opencode, Pi, the OpenAI SDKs, Cline, Aider, LangChain. Ends in /v1.
Anthropic-compatible
https://api.tulexai.com/anthropic
Claude Code and the Anthropic SDKs. No /v1 - the client adds it.
The most common setup mistake is adding /v1 to the Anthropic URL. That produces requests to /anthropic/v1/v1/messages and every call 404s.
curl https://api.tulexai.com/v1/chat/completions \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5",
"messages": [{"role": "user", "content": "Reply with OK"}]
}'A 200 means the key works. 401 means the key is wrong or missing; 402 means the account has no active subscription.
Claude Code
Claude Code speaks only the Anthropic Messages API, so it needs the /anthropic surface. No plugin, no proxy.
export ANTHROPIC_BASE_URL="https://api.tulexai.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk_live_your_key_here"
# Optional. ANTHROPIC_MODEL sets the main session model;
# the DEFAULT_* variables override what each tier resolves to.
export ANTHROPIC_MODEL="claude-opus-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5"
# Claude tiers stay on Claude by default. If you would rather run the
# background tier on a cheaper non-Claude model, set it explicitly:
# export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"Add these to your shell profile, then run claude. ANTHROPIC_API_KEY works too - Claude Code sends it as x-api-key, and both surfaces accept either header.
What to expect
- Model names map by tier, so an unmodified install works: anything containing opus routes to Claude Opus 5, sonnet to Claude Sonnet 5, and haiku to Claude Sonnet 5. A Claude tier always resolves to a Claude model - we will not quietly serve you another vendor behind an Anthropic name. Point any tier elsewhere yourself with the variables above.
- Features that require Anthropic's own backend - Remote Control, voice dictation - are disabled while a custom base URL is set. This is Claude Code's behaviour, not ours.
- Sign out of any existing claude.ai session first. A saved login plus a gateway token produces a startup warning and confusing auth failures.
opencode
Register TulexAI as a custom OpenAI-compatible provider. Add models you actually use - each entry becomes a pickable model in the TUI.
{
"$schema": "https://opencode.ai/config.json",
"model": "tulexai/claude-opus-5",
"small_model": "tulexai/gpt-codex-mini",
"provider": {
"tulexai": {
"npm": "@ai-sdk/openai-compatible",
"name": "TulexAI",
"options": {
"baseURL": "https://api.tulexai.com/v1",
"apiKey": "{env:TULEXAI_API_KEY}"
},
"models": {
"claude-opus-5": { "name": "Claude Opus 5", "tool_call": true, "limit": { "context": 200000, "output": 8192 } },
"claude-sonnet-5": { "name": "Claude Sonnet 5", "tool_call": true, "limit": { "context": 200000, "output": 4096 } },
"deepseek-v4-pro": { "name": "DeepSeek V4 Pro", "tool_call": true, "limit": { "context": 128000, "output": 8192 } },
"gpt-codex-mini": { "name": "Codex Mini", "tool_call": true, "limit": { "context": 128000, "output": 4096 } }
}
}
}
}Export TULEXAI_API_KEY in your shell first. opencode reads {env:VAR} at load; a literal key in the file works too but ends up in your dotfiles.
Pi
Pi uses a different config shape from opencode: providers is an object keyed by provider name, the key is baseUrl (not baseURL), and environment variables interpolate as $VAR. Copying the opencode block here will not work.
{
"providers": {
"tulexai": {
"api": "openai-completions",
"baseUrl": "https://api.tulexai.com/v1",
"apiKey": "$TULEXAI_API_KEY",
"models": [
{ "id": "claude-opus-5", "name": "Claude Opus 5", "maxTokens": 8192 },
{ "id": "deepseek-v4-pro", "name": "DeepSeek V4 Pro", "maxTokens": 8192 }
]
}
}
}Include apiKey (or sign in first) - Pi hides models from the picker until the provider has credentials, which looks like the models are missing.
Models worth pointing an agent at
Every model below is live and handles tool calls. Use the exact id as the model name. PT is the cost per ~750 tokens - see what a turn really costs below.
| Model | Model id | PT | Use it for |
|---|---|---|---|
| Claude Fable 5 | fable-5 | 25 | Planning and architecture. The most capable, the most expensive per turn, and Pro and up only. |
| Claude Opus 5 | claude-opus-5 | 12 | Implementation. The default choice for hard multi-file edits. |
| Claude Opus 4.6 (Code) | claude-opus-code | 12 | Implementation, code-tuned variant. Pro and up only. |
| Claude Sonnet 5 | claude-sonnet-5 | 7 | Everyday edits at roughly half the cost of Opus. |
| GPT-5.6 Terra | gpt-5.6-terra | 7 | Strong all-rounder. Note: reasoning is off when tools are attached. |
| Grok 4.5 | grok-4.5 | 3 | Fast and cheap for a frontier-class model. |
| Kimi K2.7 Code | kimi-k2.7-code | 4 | Purpose-built for coding agents. A strong middle option for the implement-and-iterate loop. |
| Kimi K2.6 | kimi-k2.6 | 2 | Cheap long-context work - large repos, wide file reads. |
| DeepSeek V4 Pro | deepseek-v4-pro | 1 | The value pick for long agent loops. |
| GPT-5.4 Mini (Code) | gpt-codex-mini | 1 | Cheap inner loop - lint fixes, renames, test runs. |
| Grok Build (Code) | grok-code | 1.2 | Cheap inner loop, alternative provider. |
| DeepSeek V4 Flash | deepseek-v4-flash | 0.5 | Cheapest. Good for background and summarization work. |
Other text models work too - these are the ones we recommend for agent loops. Max output per response is the per-model figure above, capped at 8,192 on both surfaces; asking for more is clamped down silently rather than rejected. Running Grok Build or Grok 4.5 as your daily driver? Grok on TulexAI breaks down what one subscription covers versus SuperGrok.
What an agent turn actually costs
This is the number that surprises people, so it is worth being blunt about it.
One PT buys ~750 tokens at a 1 PT model. The multiplier scales with the model, and the token count scales with your context - both input and output count.
An agent is not a chat. It resends the entire conversation plus file contents on every turn, so a single turn is routinely 20,000+ tokens. That is ~27 billing units, so on a 12 PT model one turn costs roughly 320 PT - not 12.
Plans also carry a monthly cap per model category, and it binds well before your PT balance runs out. Past it, requests are served by a cheaper model rather than failing. Every response names the model that actually ran, streaming included, so check that field if quality changes. Running a frontier model for every turn of a long session will reach the cap; using a cheap model for the inner loop will not.
Rate limits by plan
Limits are per account, shared across the API and the website. Extra API keys do not increase throughput.
| Plan | Per month | Tokens / mo | Premium text / mo | Requests / min | In flight |
|---|---|---|---|---|---|
| Basic | $11 | 5,000 PT | 600 PT | 20 | 3 |
| Pro | $23 | 15,000 PT | 2,640 PT | 30 | 5 |
| VIP | $46 | 40,000 PT | 3,720 PT | 50 | 10 |
| Elite | $99 | 130,000 PT | 1,080 PT | 80 | 20 |
Two limits that are not in the table above
- Monthly PT cap per model category. The “Premium text” column is the one agents hit first: it covers the premium-tier text models (Claude Opus 4.6-5, GPT-5.4/5.5/5.6 Sol and Terra, Kimi K3, Grok 4.5, Perplexity Sonar). Fable 5, standard text and code, images and voice each carry their own separate cap. Past a cap the request is served by the category's fallback model rather than failing, and you are told: the response names the model that actually ran, carries an X-TulexAI-Notice header and an x_tulex.limit_notice object naming the requested model, the one that served it and when the cap resets — and on the Anthropic endpoint the reply opens with a plain-language line saying so, so it is visible inside your agent rather than only in the raw response. DeepSeek V4 Flash is the text and code fallback, so it is never capped against itself.
- Rolling 24h provider-spend cap. Separate from PT: a per-account ceiling on the real provider cost your calls generate in any 24-hour window, sized from your plan price. Approaching it swaps a frontier model for a cheaper one; crossing it stops new generations until the spend rolls out of the window.
How your agent should handle errors
- 429 with a Retry-After header is a temporary throttle - requests per minute or concurrent requests. Wait the stated seconds and continue; the task does not need to restart. A 429 without that header is not a throttle: both API surfaces remap it to 402, described next.
- 402 carries no Retry-After and means retrying cannot help, so the task should stop and surface the message rather than back off. Three cases produce it: monthly PT budget exhausted, a model your plan does not include, and the rolling 24h provider-spend cap. The first two are terminal for the billing period; the third clears on its own as spend rolls out of the 24-hour window, but not on any timescale worth retrying inside a session.
- 401 means the key is missing, revoked, or sent in a header the surface did not expect.
A workflow that does not burn your month in a day
The point of 49+ models on one key is that you can switch mid-task. Most harnesses let you set a main model and a small/fast model separately - use both.
Plan with Fable 5
One expensive turn to produce the plan is cheaper than ten cheap turns spent going the wrong direction.
Implement with Opus 5
Frontier quality where it matters: multi-file edits, tricky refactors, anything with real blast radius.
Loop on a cheap model
Kimi K2.7 Code, Codex Mini or DeepSeek V4 Pro for the iterate-and-verify grind - the bulk of an agent session by volume.
Frequently asked questions
Yes. Set ANTHROPIC_BASE_URL to https://api.tulexai.com/anthropic and ANTHROPIC_AUTH_TOKEN to your TulexAI API key, then run claude as usual. TulexAI serves the Anthropic Messages API, including streaming and tool use, so Claude Code works without a plugin. Leave the base URL without a trailing /v1 - Claude Code appends that itself.
One key. Every model. Any harness.
Claude Code, opencode, Pi or your own script - 49+ models on one subscription from $11/mo.
Try 1 prompt free1 free prompt · no credit card · cancel any time