Claude Code

Claude Code speaks the Anthropic Messages protocol. Use the site root as the gateway URL (no /v1):

npm install -g @anthropic-ai/claude-code
export ANTHROPIC_BASE_URL="https://47.237.177.122"
export ANTHROPIC_AUTH_TOKEN="sk-YOUR_KEY"
claude
  • ANTHROPIC_BASE_URL is the site root; Claude Code appends /v1/messages itself.
  • ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer.
  • Pick a Claude model returned by /v1/models, or one marked Live settlement on the home page.

Codex CLI

Codex speaks the OpenAI Responses protocol. Use a dedicated profile so your existing OpenAI configuration stays untouched:

  1. Install the client:
npm install -g @openai/codex
codex --version
  1. Create ~/.codex/opentokenrouter.config.toml:
model_provider = "opentokenrouter"

[model_providers.opentokenrouter]
name = "OpenTokenRouter"
base_url = "https://47.237.177.122/v1"
env_key = "OPENTOKENROUTER_API_KEY"
wire_api = "responses"
  1. Start with the dedicated profile:
export OPENTOKENROUTER_API_KEY="sk-YOUR_KEY"
codex --profile opentokenrouter --model "MODEL_ID"

OpenAI SDK (generic)

Python:

from openai import OpenAI

client = OpenAI(base_url="https://47.237.177.122/v1", api_key="sk-YOUR_KEY")

Node.js / TypeScript:

import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: "https://47.237.177.122/v1",
  apiKey: "sk-YOUR_KEY",
})

Desktop client

OpenTokenRouter Desktop wraps gateway URL, key, and model selection into a guided flow. Get the installer from the Download page and follow the first-launch checklist there (macOS Gatekeeper / Windows SmartScreen). For the full environment, one-click setup, and pricing workflow, see the Desktop Client Guide.