Docs
Agents
You connect coding agents to TOKENWERK through a custom base URL. Choose a model with tool
calling and a large context window; replace MODEL with its name.
Claude Code
Claude Code speaks the Anthropic format. Set the base URL and the key as environment variables and point every model role at a TOKENWERK model.
curl -fsSL https://claude.ai/install.sh | bash
export ANTHROPIC_BASE_URL="https://api.tokenwerk.ai"
export ANTHROPIC_AUTH_TOKEN="$TOKENWERK_API_KEY"
export ANTHROPIC_MODEL="MODEL"
export ANTHROPIC_DEFAULT_OPUS_MODEL="MODEL"
export ANTHROPIC_DEFAULT_SONNET_MODEL="MODEL"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="MODEL"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS="CONTEXT_WINDOW"
claude
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.tokenwerk.ai",
"ANTHROPIC_AUTH_TOKEN": "tw-...",
"ANTHROPIC_MODEL": "MODEL",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "MODEL",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MODEL",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "MODEL",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "CONTEXT_WINDOW"
}
}
CLAUDE_CODE_MAX_CONTEXT_TOKENSis the model's context window (see the model list). Claude Code doesn't know TOKENWERK's models and would otherwise assume 200,000 tokens, so it would compact the conversation too late or too early.- Only put the key in
~/.claude/settings.jsonor.claude/settings.local.json, not in a project's shared.claude/settings.json. - Anthropic does not officially support using models other than Claude through gateways. If a model
answers beta features with
400errors,CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1helps.
Official guide: Claude Code: LLM gateways ↗
opencode
opencode adds TOKENWERK as its own provider via the OpenAI format. Save the configuration as
opencode.json in your project or globally as ~/.config/opencode/opencode.json.
curl -fsSL https://opencode.ai/install | bash
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"tokenwerk": {
"npm": "@ai-sdk/openai-compatible",
"name": "TOKENWERK",
"options": {
"baseURL": "https://api.tokenwerk.ai/v1",
"apiKey": "{env:TOKENWERK_API_KEY}"
},
"models": {
"MODEL": {
"name": "MODEL"
}
}
}
},
"model": "tokenwerk/MODEL"
}
- Optionally add
contextandoutputundermodels.<name>.limit(values under Models), so opencode compacts long sessions in time.
Official guide: opencode: Providers ↗
OpenClaw
OpenClaw gets TOKENWERK as its own provider in ~/.openclaw/openclaw.json.
npm install -g openclaw@latest
openclaw onboard --install-daemon
{
agents: { defaults: { model: { primary: "tokenwerk/MODEL" } } },
models: {
mode: "merge",
providers: {
tokenwerk: {
baseUrl: "https://api.tokenwerk.ai/v1",
apiKey: "${TOKENWERK_API_KEY}",
api: "openai-completions",
models: [{ id: "MODEL", name: "MODEL" }],
},
},
},
}
- For the Anthropic format, set
baseUrltohttps://api.tokenwerk.aiandapito"anthropic-messages". - Every model must be listed under
modelswith itsid; you can addcontextWindowandmaxTokensthere.
Official guide: OpenClaw: Custom providers ↗
Hermes Agent
Hermes Agent by Nous Research connects through a “Custom endpoint”. The easiest way is hermes
model, or directly in the configuration:
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
model:
provider: custom
base_url: https://api.tokenwerk.ai/v1
default: MODEL
key_env: TOKENWERK_API_KEY
- Hermes needs a model with tool calling and at least 64,000 tokens of context.
Official guide: Hermes Agent: Providers ↗
Codex CLI
Codex CLI only speaks the Responses API (/v1/responses). TOKENWERK passes it through; it works
with models that support this API.
npm install -g @openai/codex
model = "MODEL"
model_provider = "tokenwerk"
[model_providers.tokenwerk]
name = "TOKENWERK"
base_url = "https://api.tokenwerk.ai/v1"
env_key = "TOKENWERK_API_KEY"
wire_api = "responses"
Official guide: Codex: Configuration ↗
Aider
Aider uses the OpenAI format; the model name gets the prefix openai/.
python -m pip install aider-install
aider-install
export OPENAI_API_BASE="https://api.tokenwerk.ai/v1"
export OPENAI_API_KEY="$TOKENWERK_API_KEY"
aider --model openai/MODEL
- You can ignore warnings about unknown models; Aider only knows the models of large providers.
Official guide: Aider: OpenAI compatible APIs ↗
Cline, Roo Code, Kilo Code
The three VS Code extensions have an “OpenAI Compatible” provider. Enter in their settings:
| Field | Value |
|---|---|
| API Provider | OpenAI Compatible |
| Base URL | https://api.tokenwerk.ai/v1 |
| API Key | your key (tw-…) |
| Model ID | MODEL |
- In the model settings you can set the context window, maximum output and image input.
- Kilo Code also offers “Anthropic Messages”, then with the base URL
https://api.tokenwerk.ai. - Roo Code only works with models that support tool calling.
Official guides: Cline ↗ · Roo Code ↗ · Kilo Code ↗
Continue
In Continue's config.yaml (opened from the extension's settings), add a model with the
provider openai:
models:
- name: TOKENWERK MODEL
provider: openai
model: MODEL
apiBase: https://api.tokenwerk.ai/v1
apiKey: tw-...
capabilities:
- tool_use
roles:
- chat
- edit
- apply
Official guide: Continue: config.yaml ↗
Goose
Goose gets TOKENWERK as its own provider: create the file, then choose the provider in goose
configure.
curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash
{
"name": "tokenwerk",
"engine": "openai",
"display_name": "TOKENWERK",
"description": "TOKENWERK API",
"api_key_env": "TOKENWERK_API_KEY",
"base_url": "https://api.tokenwerk.ai/v1/chat/completions",
"models": [{ "name": "MODEL", "context_limit": 128000 }],
"supports_streaming": true,
"requires_auth": true
}
- Set
context_limitto the model's context window (see Models).
Official guide: Goose: Providers ↗
Zed
Zed adds TOKENWERK as an OpenAI compatible provider in its settings.json. For the provider
tokenwerk, Zed reads the key from TOKENWERK_API_KEY automatically; otherwise it
asks for it on first use.
{
"language_models": {
"openai_compatible": {
"tokenwerk": {
"api_url": "https://api.tokenwerk.ai/v1",
"available_models": [
{ "name": "MODEL", "display_name": "MODEL", "max_tokens": 128000 }
]
}
}
}
}
max_tokensis the model's context window (see Models).
Official guide: Zed: API access ↗