OpenClaw logo
AI agents

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

1

Gateway configuration

  1. 1.

    Install OpenClaw from its official instructions and review tool permissions before connecting files, terminals or accounts.

  2. 2.

    Save TOKENREX_API_KEY in the gateway's private environment or ~/.openclaw/.env.

  3. 3.

    Merge the example into ~/.openclaw/openclaw.json. Keep api set to openai-completions for Chat Completions.

  4. 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.

Configuration
json
{
  "models": {
    "mode": "merge",
    "providers": {
      "tokenrex": {
        "baseUrl": "https://tokenrex.ai/api/public/v1",
        "apiKey": "${TOKENREX_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "openai/gpt-6-astra",
            "name": "TokenRex model"
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "tokenrex/openai/gpt-6-astra"
      }
    }
  }
}
Setup reference
2

Custom-provider onboarding

  1. 1.

    Run the documented onboarding flow and choose a custom provider rather than a subscription provider.

  2. 2.

    Supply https://tokenrex.ai/api/public/v1, your private API key, an exact model ID and the OpenAI Chat Completions protocol.

  3. 3.

    Review the saved provider configuration and agent selection, then test a short message.

Setup reference
3

Agent-specific provider configuration

  1. 1.

    For a per-agent endpoint, review ~/.openclaw/agents/<agentId>/agent/models.json and the documented provider schema.

  2. 2.

    Agent-specific endpoint and key values can override the gateway configuration. Keep credentials in environment variables or supported SecretRef values.

  3. 3.

    Declare image input or tool capabilities only when verified for your model. Use openai-responses only with compatible Responses behavior.

Setup reference

Troubleshooting

Changing the gateway URL has no effect
Check the agent-specific models.json for endpoint or credential overrides, then restart the gateway.

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.