Use TokenRex with OpenClaw
Use TokenRex models in OpenClaw with a custom provider and your own API key.
Setup checked against the linked documentation. Screenshots are reference examples from the tool's publisher, not proof of a TokenRex connection. Live execution inside this third-party app has not been tested; verify a short request before running larger tasks.
Before you start
- OpenClaw installed
- A TokenRex API key
- An enabled chat model suitable for agent tasks
Setup methods
Gateway configuration
- 1
Install OpenClaw from its official instructions and review tool permissions before connecting files, terminals or accounts.
- 2
Save TOKENREX_API_KEY in the gateway's private environment or ~/.openclaw/.env.
- 3
Merge the example into ~/.openclaw/openclaw.json. Keep api set to openai-completions for Chat Completions.
- 4
Use the exact TokenRex model ID in models; the agent's primary model includes the additional tokenrex/ provider prefix. Restart the gateway and test.
{
"models": {
"mode": "merge",
"providers": {
"tokenrex": {
"baseUrl": "https://tokenrex.ai/api/public/v1",
"apiKey": "${TOKENREX_API_KEY}",
"api": "openai-completions",
"models": [
{
"id": "gpt-6-astra",
"name": "TokenRex model"
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "tokenrex/gpt-6-astra"
}
}
}
}Custom-provider onboarding
- 1
Run the documented onboarding flow and choose a custom provider rather than a subscription provider.
- 2
Supply https://tokenrex.ai/api/public/v1, your private API key, an exact model ID and the OpenAI Chat Completions protocol.
- 3
Review the saved provider configuration and agent selection, then test a short message.
Agent-specific provider configuration
- 1
For a per-agent endpoint, review ~/.openclaw/agents/<agentId>/agent/models.json and the documented provider schema.
- 2
Agent-specific endpoint and key values can override the gateway configuration. Keep credentials in environment variables or supported SecretRef values.
- 3
Declare image input or tool capabilities only when verified for your model. Use openai-responses only with compatible Responses behavior.
Troubleshooting
- Changing the gateway URL has no effect
- Check the agent-specific models.json for endpoint or credential overrides, then restart the gateway.
- Authentication fails
- Check that the saved TokenRex key is active and belongs in the tool's API-key field, not its subscription sign-in. Remove accidental spaces, check your wallet balance, and never share the key in screenshots or exported settings.
- The model is missing or the request URL returns 404
- Copy an exact enabled model ID from Models & Pricing. Follow this method's URL field: some tools expect the versioned base, others the root or full completion address. Check the documented API protocol before changing the path.
- Chat works but streaming or tools fail
- Test a short plain-text conversation first. Confirm the selected model and installed tool version support the required protocol and capabilities. Enable agent actions only after separately checking streaming and tool calls.
Verify the connection
Send a short message with the selected model, read its response, then confirm the exact model appears in your TokenRex usage. Test streaming and tool use separately before larger agent tasks.