Using TOKENOPEN API with OpenClaw
Use OpenClaw with TOKENOPEN API to run an open-source coding AI agent locally
OpenClaw is an open-source AI coding agent. It can autonomously read files, write code, execute commands, and complete complex development tasks. By configuring TOKENOPEN API, you can use all models available on the platform.
OpenClaw requires Node.js 22+. Please ensure Node.js is installed before proceeding.
Step 1: Install OpenClaw
Use the official install script:
curl -fsSL https://install.openclaw.dev | bashVerify the installation:
openclaw --versionRun in PowerShell:
iex (irm https://install.openclaw.dev/windows)Verify the installation:
openclaw --versionStep 2: Configure TOKENOPEN API
Get an API Key
Log in to the TOKENOPEN Console, navigate to the API Keys page, and create or copy a key.
(Optional) Install System Daemon
If you want OpenClaw to run persistently as a background service, run:
openclaw onboard --install-daemonEdit the Configuration File
OpenClaw's configuration file is located at ~/.openclaw/openclaw.json. Open and edit it:
mkdir -p ~/.openclaw
vim ~/.openclaw/openclaw.jsonPaste the following content:
{
"models": {
"mode": "merge",
"providers": {
"my-proxy": {
"baseUrl": "replace-based-on-the-table-below",
"apiKey": "replace-with-your-api-key",
"api": "replace-based-on-the-table-below",
"authHeader": true,
"models": [
{
"id": "replace-with-model-id",
"name": "replace-with-model-name",
"contextWindow": 128000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "replace-based-on-the-table-below"
}
}
}
}Reference options:
| Parameter | Example value | Notes |
|---|---|---|
models[].id | gpt-5.5 or claude-sonnet-4-6 | Set the actual model ID to call, matching a model identifier supported by TOKENOPEN |
baseUrl | https://www.tokenopen.ai/v1 or https://www.tokenopen.ai | The former is for openai-completions; the latter is for anthropic and should not include /v1 |
api | openai-completions or anthropic | Choose the value that matches the API type you use |
agents.defaults.model.primary | gpt-5.5 or claude-sonnet-4-6 | Set this to the primary model ID you want to use |
Press Esc, then type :wq! to save and quit.
mkdir -p ~/.openclaw
vim ~/.openclaw/openclaw.jsonPaste the following content:
{
"models": {
"mode": "merge",
"providers": {
"my-proxy": {
"baseUrl": "replace-based-on-the-table-below",
"apiKey": "replace-with-your-api-key",
"api": "replace-based-on-the-table-below",
"authHeader": true,
"models": [
{
"id": "replace-with-model-id",
"name": "replace-with-model-name",
"contextWindow": 128000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "replace-based-on-the-table-below"
}
}
}
}Reference options:
| Parameter | Example value | Notes |
|---|---|---|
models[].id | gpt-5.5 or claude-sonnet-4-6 | Set the actual model ID to call, matching a model identifier supported by TOKENOPEN |
baseUrl | https://www.tokenopen.ai/v1 or https://www.tokenopen.ai | The former is for openai-completions; the latter is for anthropic and should not include /v1 |
api | openai-completions or anthropic | Choose the value that matches the API type you use |
agents.defaults.model.primary | gpt-5.5 or claude-sonnet-4-6 | Set this to the primary model ID you want to use |
Press Esc, then type :wq! to save and quit. Or open in TextEdit:
open -e ~/.openclaw/openclaw.jsonRun in PowerShell to create the config file automatically:
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.openclaw" | Out-Null
@'
{
"models": {
"mode": "merge",
"providers": {
"my-proxy": {
"baseUrl": "replace-based-on-the-table-below",
"apiKey": "replace-with-your-api-key",
"api": "replace-based-on-the-table-below",
"authHeader": true,
"models": [
{
"id": "replace-with-model-id",
"name": "replace-with-model-name",
"contextWindow": 128000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "replace-based-on-the-table-below"
}
}
}
}
'@ | Set-Content -Path "$env:USERPROFILE\.openclaw\openclaw.json" -Encoding UTF8Reference options:
| Parameter | Example value | Notes |
|---|---|---|
models[].id | gpt-5.5 or claude-sonnet-4-6 | Set the actual model ID to call, matching a model identifier supported by TOKENOPEN |
baseUrl | https://www.tokenopen.ai/v1 or https://www.tokenopen.ai | The former is for openai-completions; the latter is for anthropic and should not include /v1 |
api | openai-completions or anthropic | Choose the value that matches the API type you use |
agents.defaults.model.primary | gpt-5.5 or claude-sonnet-4-6 | Set this to the primary model ID you want to use |
Or open the config file manually in Notepad:
notepad "$env:USERPROFILE\.openclaw\openclaw.json"Set apiKey to the key obtained from the TOKENOPEN Console. You can adjust baseUrl, api, and agents.defaults.model.primary based on the table above. You can also add multiple model objects in the models array if needed.
Step 3: Use OpenClaw
Start a Chat
Once configured, start a conversation directly from the command line:
openclaw chatCommon Commands
| Command | Description |
|---|---|
openclaw chat | Start a conversation |
openclaw chat --session <session-id> | Start a new session |
openclaw dashboard | Open the web management UI |
openclaw models default set [model] | Set the default model |
openclaw --help | View all available commands |
Supported models on TOKENOPEN (examples):
| Model ID | Description |
|---|---|
gpt-5.5 | GPT-5.5, latest flagship model |
gpt-5.4-mini | GPT-5.4 Mini, low-latency lightweight model |
claude-sonnet-4-6 | Claude Sonnet 4.6, balanced model |
deepseek-r1 | DeepSeek R1, strong reasoning model |
For the full model list and pricing, visit the Model Marketplace.
Last updated on