51cowork APIDocs
Open docs navigation

Client guides

AI tool setup guides

These configurations use the current public gateway https://api.51cowork.com. Keys and model values come from Dashboard; check file permissions and version-control rules before persisting a Key.

Quick answer

Use environment variables or user-level files for CLI tools. In Cursor, Cherry Studio, and WorkBuddy, enter the endpoint, API Key, and model ID in settings. Keep Keys out of Git.

Claude Code
Anthropic environment
Codex
config.toml + auth.json
OpenCode
opencode.json
Cursor
OpenAI Base URL
Cherry Studio
Custom provider
WorkBuddy
Custom model
01

Before you start

  1. 1Create and copy an API Key in Dashboard.
  2. 2Use https://api.51cowork.com and select a model through https://api.51cowork.com/v1/models.
  3. 3Back up existing client files and merge rather than overwrite providers.
  4. 4Test CLI tools in a temporary shell. For desktop tools, save the configuration, select the model, and send a test request.
02

Claude Code

Claude Code uses the Gateway root and ANTHROPIC_AUTH_TOKEN.

macOS / Linux · Terminalbash
export ANTHROPIC_BASE_URL="https://api.51cowork.com"
export ANTHROPIC_AUTH_TOKEN="<key-from-dashboard>"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export CLAUDE_CODE_ATTRIBUTION_HEADER=0
claude
Windows · PowerShellpowershell
$env:ANTHROPIC_BASE_URL="https://api.51cowork.com"
$env:ANTHROPIC_AUTH_TOKEN="<key-from-dashboard>"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
$env:CLAUDE_CODE_ATTRIBUTION_HEADER="0"
claude

For user-level persistence, save the following to ~/.claude/settings.json. On Windows use %USERPROFILE%\.claude\settings.json.

~/.claude/settings.jsonjson
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.51cowork.com",
    "ANTHROPIC_AUTH_TOKEN": "<key-from-dashboard>",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
  }
}
03

Codex CLI / Extension

Codex uses the Responses wire API.

Merge the provider into ~/.codex/config.toml; Windows uses %USERPROFILE%\.codex\config.toml. Replace the model placeholder with a current gateway model.

~/.codex/config.tomltoml
model_provider = "51cowork"
model = "<model-from-gateway>"

[model_providers."51cowork"]
name = "51cowork"
base_url = "https://api.51cowork.com"
wire_api = "responses"
requires_openai_auth = true
~/.codex/auth.jsonjson
{
  "OPENAI_API_KEY": "<key-from-dashboard>"
}
  • Create the directory if needed.
  • Do not remove other providers or settings from an existing config.
  • Quit and restart the CLI or extension, then open a new task.
04

OpenCode

Save this OpenAI-compatible provider to ~/.config/opencode/opencode.json or opencode.jsonc. Use a real model ID from /v1/models.

~/.config/opencode/opencode.jsonjson
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "51cowork": {
      "npm": "@ai-sdk/openai",
      "name": "51cowork",
      "options": {
        "baseURL": "https://api.51cowork.com/v1",
        "apiKey": "<key-from-dashboard>"
      }
    }
  }
}
05

Cursor

  1. 1Open model or API settings and enable a custom OpenAI Base URL.
  2. 2Enter https://api.51cowork.com/v1 and the API Key from Dashboard.
  3. 3Add a model ID returned by /v1/models, select it, and send a test request.
06

Cherry Studio

  1. 1Open Model Services in settings and add a provider named 51cowork with type OpenAI.
  2. 2Set API Address to the gateway root https://api.51cowork.com; Cherry Studio appends /v1/chat/completions automatically.
  3. 3Enter the API Key from Dashboard, fetch the model list, and add the models you need.
  4. 4Enable the provider, select a model in chat, and send a test request.
07

WorkBuddy

  1. 1Open Settings → Model, add a custom model, and choose Custom.
  2. 2Enter the full endpoint URL: https://api.51cowork.com/v1/chat/completions.
  3. 3Enter the API Key from Dashboard and an exact model ID returned by /v1/models.
  4. 4Enable Custom Protocol in advanced settings to use the full URL without appending a path.
  5. 5Save, select the custom model in chat, send a test request, and check Dashboard usage.
08

Update a Key

  1. 1Create or select a replacement Key in Dashboard.
  2. 2Update every environment or user config with the new Key.
  3. 3Fully restart clients that cache credentials.
  4. 4Send a minimal request and verify it in Usage.
  5. 5Delete an unused Key only after the migration is complete.
09

Configuration acceptance checklist

  • Gateway root is https://api.51cowork.com; OpenAI SDK Base URL is https://api.51cowork.com/v1.
  • The Key has no extra spaces, quotes, or line breaks.
  • The model ID comes from /v1/models.
  • Client protocol matches the selected endpoint.
  • The successful request appears in Dashboard Usage.