TokenLab

Coding Tools

TokenLab Provider Setup

Connect a self-hosted OpenClaw instance to TokenLab

Let my agent set this up

Copy this task to an agent already running on your computer:

Read this guide and help me connect OpenClaw to TokenLab:
https://tokenlab.sh/docs/en/guides/tokenlab-provider
Check my installed version and active configuration first.
Preserve existing accounts, providers, permissions and other settings.
Back up local files and show proposed changes.
Have me enter any API key locally; never ask for, print or paste it in chat.
Check configuration loading first.
Explain any paid request test separately before running it.

This guide is for self-hosted OpenClaw. The TokenLab plugin is the shortest setup; manual configuration is available when you need a specific API format.

Install the plugin

Optional: install the published provider plugin 0.1.3. Supply TOKENLAB_API_KEY through the same Gateway environment described below and use session-only model selection. The plugin onboarding wizard changes the default model, so this guide does not run openclaw onboard. Keep existing plugin entries and permissions. Check the installed plugin and model list before making a request.

Review the capabilities requested by the installer and follow the client’s confirmation prompts. Do not grant unrelated permissions or change the permissions of existing plugins.

openclaw plugins install @tokenlabai/openclaw-provider@0.1.3
openclaw plugins list
openclaw models list --provider tokenlab
/model tokenlab/claude-sonnet-5 -s
/model default -s

npm · GitHub

Configure providers manually

Use models.providers only when OpenClaw needs Responses, Claude Messages, Gemini, or MiniMax formats separately. For ordinary chat, the tokenlab entry is enough.

ProviderOpenClaw apiBest forbaseUrl
tokenlabopenai-completionsGPT, DeepSeek, Qwen, and most OpenAI-compatible callshttps://api.tokenlab.sh/v1
tokenlab-responsesopenai-responsesOpenAI Responses workflows that expect /v1/responses semanticshttps://api.tokenlab.sh/v1
tokenlab-claudeanthropic-messagesNative Claude Messages APIhttps://api.tokenlab.sh
tokenlab-geminigoogle-generative-aiNative Gemini API formathttps://api.tokenlab.sh
tokenlab-minimaxanthropic-messagesMiniMax models over the Messages formathttps://api.tokenlab.sh

Use the /v1 suffix only for openai-completions and openai-responses.

Native providers such as anthropic-messages and google-generative-ai should use https://api.tokenlab.sh without /v1, otherwise OpenClaw may construct the wrong provider path.

Prerequisites

  • A self-hosted OpenClaw instance
  • For OpenClaw 2026.9.4, use Node.js >=24.16.0 <25 || >=26.1.0 (version requirements). For other OpenClaw releases, check that release's requirements.
  • A TokenLab API Key — Get one here

Configuration

Edit your OpenClaw config:

  • Self-hosted: ~/.openclaw/openclaw.json

Add TokenLab providers under models.providers:

Use the same profile, OPENCLAW_STATE_DIR and OPENCLAW_CONFIG_PATH as the running Gateway. Back up the active configuration before merging. Put TOKENLAB_API_KEY in that instance’s trusted global .env or service environment; a terminal export or project .env alone may not reach the background Gateway. See environment handling.

Back up the active configuration. Add only the TokenLab entry and preserve existing providers, accounts, default-model selection and permissions. If the name is already used, choose another name and update the commands. To undo setup, remove only your added entry or restore its previous backup.

{
  models: {
    mode: "merge",
    providers: {
      tokenlab: {
        api: "openai-completions",
        baseUrl: "https://api.tokenlab.sh/v1",
        apiKey: "${TOKENLAB_API_KEY}",
        models: [
          { id: "gpt-5.6-terra", name: "GPT-5.6 Terra" },
          { id: "deepseek-v4-pro", name: "DeepSeek V4 Pro" },
          { id: "qwen3-coder-flash", name: "Qwen 3 Coder Flash" }
        ]
      },
      "tokenlab-responses": {
        api: "openai-responses",
        baseUrl: "https://api.tokenlab.sh/v1",
        apiKey: "${TOKENLAB_API_KEY}",
        models: [
          { id: "gpt-5.6-terra", name: "GPT-5.6 Terra (Responses)" },
          { id: "gpt-5.2", name: "GPT-5.2 (Responses)" }
        ]
      },
      "tokenlab-claude": {
        api: "anthropic-messages",
        baseUrl: "https://api.tokenlab.sh",
        apiKey: "${TOKENLAB_API_KEY}",
        models: [
          { id: "claude-sonnet-5", name: "Claude Sonnet 5" },
          { id: "claude-opus-5", name: "Claude Opus 5" }
        ]
      },
      "tokenlab-gemini": {
        api: "google-generative-ai",
        baseUrl: "https://api.tokenlab.sh",
        apiKey: "${TOKENLAB_API_KEY}",
        models: [
          { id: "gemini-3.6-flash", name: "Gemini 3.6 Flash" },
          { id: "gemini-2.5-pro", name: "Gemini 2.5 Pro" }
        ]
      },
      "tokenlab-minimax": {
        api: "anthropic-messages",
        baseUrl: "https://api.tokenlab.sh",
        apiKey: "${TOKENLAB_API_KEY}",
        models: [
          { id: "minimax-m3", name: "MiniMax M3" }
        ]
      }
    }
  }
}

All 5 providers use the same API Key. You only need one TokenLab account.

The models arrays above only show common examples. Add more model IDs to each provider as needed.

Using Models

OpenClaw still references models with the provider/model format:

For OpenClaw 2026.9.4, select the model only for the current session with -s. Keep agents.defaults.model, agent defaults and permissions unchanged. Use /model default -s to return this session to its configured default.

/model tokenlab-claude/claude-sonnet-5 -s
/model default -s

Model Examples

ProviderModel referenceDescription
tokenlabtokenlab/gpt-5.6-terraOpenAI-compatible (Chat Completions)
tokenlab-responsestokenlab-responses/gpt-5.6-terraResponses API
tokenlab-claudetokenlab-claude/claude-sonnet-5Claude Messages
tokenlab-geminitokenlab-gemini/gemini-3.6-flashGemini
tokenlab-minimaxtokenlab-minimax/minimax-m3MiniMax over Messages

Browse all available models at tokenlab.sh/models.

When to Use Which Provider

  • tokenlab: default choice for most general-purpose agent and chat use cases.
  • tokenlab-responses: use when your OpenClaw workflow explicitly depends on OpenAI Responses semantics.
  • tokenlab-claude: use when you want Claude's native Messages behavior.
  • tokenlab-gemini: use when you want Gemini-native request/response formatting or existing Gemini-style integrations.
  • tokenlab-minimax: use when you want MiniMax models over the Messages format.

If you do not need Gemini-native behavior, you can still call Gemini models through tokenlab/gemini-* on the OpenAI-compatible format.

Common Mistakes

Verify Setup

Restart that instance, then inspect its selected model and provider. models status without --probe does not make a model-call test. A live --probe or a chat message can consume tokens. Check a real reply against the matching TokenLab request before declaring the setup working. To restore, choose the previous model and remove only the TokenLab entries you added.

openclaw gateway restart
openclaw models status

Generate images and video in the same agent

OpenClaw can also create images and short videos with the TokenLab MCP server. Each generation is paid from the same TokenLab balance.

openclaw mcp add tokenlab \
  --command npx \
  --arg -y \
  --arg @tokenlabai/mcp-server@0.6.48 \
  --env TOKENLAB_MCP_TOOL_PROFILE=core \
  --env 'TOKENLAB_API_KEY=${TOKENLAB_API_KEY}'
openclaw mcp probe tokenlab

Keep the single quotes. OpenClaw then stores a reference to the variable, not the key, and reads TOKENLAB_API_KEY from the environment it runs in when it starts the server. The probe lists the TokenLab tools. Then try:

Call get_model_pricing for nano-banana-2, then use create_image with nano-banana-2 at 1k to make a photo of a matte black coffee mug on a white desk.

create_video returns a task ID. The agent calls get_task_status until the video is ready.

Next Steps

Once OpenClaw is connected, these guides help you use TokenLab more effectively:

On this page