How to Use TokenAir with OpenClaw
OpenClaw agents can make many model calls from one instruction. TokenAir can bring that spend down significantly when routine steps use lower-cost models and difficult work keeps a stronger route. OpenClaw supports custom providers through an OpenAI-compatible completions API.
Compatibility verdict
Direct setup
Direct setup is available. OpenClaw documents custom providers under models.providers with baseUrl, apiKey, api, and models fields.
The tool documents a custom OpenAI-compatible endpoint path.
Before you start
- A TokenAir API key available as an environment variable.
- An exact TokenAir model ID and its real context and output limits.
- Access to the OpenClaw configuration used by the target agent.
Setup and compatibility steps
Step 1
Store the API key in the environment
Set TOKENAIR_API_KEY in the environment used by OpenClaw. Keep live keys out of shared configuration files.
Step 2
Register TokenAir as a provider
Add a tokenair provider with the TokenAir base URL and openai-completions API type. Register at least one exact model ID.
Step 3
Choose the provider and model
Set the agent's primary model to tokenair/YOUR_TOKENAIR_MODEL_ID. Add aliases or more models only after the first route works.
Step 4
Validate agent behavior
Run a bounded task that uses the tools you rely on. Check the final output, tool calls, retries, context behavior, and total cost.
Example OpenClaw provider config
{
agents: {
defaults: {
model: { primary: "tokenair/YOUR_TOKENAIR_MODEL_ID" }
}
},
models: {
mode: "merge",
providers: {
tokenair: {
baseUrl: "https://api.tokenair.ai/v1",
apiKey: "${TOKENAIR_API_KEY}",
api: "openai-completions",
models: [
{
id: "YOUR_TOKENAIR_MODEL_ID",
name: "TokenAir model"
}
]
}
}
}
}Replace placeholders with values from your own TokenAir account. Never commit an API key to source control.
How to verify it
- OpenClaw lists the registered tokenair/model reference.
- The target agent starts with TokenAir as its resolved primary provider.
- A simple chat and one representative tool call both finish successfully.
- Configured context and output limits match the selected model before a long task is attempted.
How to lower cost without hiding quality loss
TokenAir gives the client access to premium and lower-cost model choices through one OpenAI-compatible API. Savings depend on matching each task with a model that still passes review.
- Route routine agent work to a lower-cost model and reserve stronger models for escalation.
- Set explicit context and output limits from the model's real capabilities instead of relying on defaults.
- Measure cost per completed agent job and include tool loops, retries, and fallback calls.
Limits to know before production
- OpenClaw applies compatibility shaping to non-native OpenAI-completions endpoints. Test any workflow that depends on provider-specific request fields.
- Optional context and token defaults may not match the selected TokenAir model. Configure verified values before production use.
- Do not assume OpenAI Responses features are available through an OpenAI Chat Completions route.
FAQ
Can OpenClaw use TokenAir as a custom model provider?
Yes. OpenClaw documents custom OpenAI-compatible providers with a baseUrl, API key, API type, and registered model list.
Which OpenClaw API type should TokenAir use?
Use openai-completions for TokenAir's documented /chat/completions surface. Use openai-responses only after TokenAir documents and tests that API.
Why should I set verified model limits?
OpenClaw has defaults for custom providers. Verified limits stop an agent from planning around a context window or output limit that the selected model does not support.
Official sources and related TokenAir docs
Tool settings change between releases. We checked these notes on July 17, 2026. Review the linked tool docs again before a production rollout.
Try one workflow before changing the default.
Use the cost checkup to choose a bounded test, then compare cost per accepted result with your current route.