跳转至

CodeBair Client Integration Guide

This guide exists for one purpose: connect common clients to https://api.codebair.com / https://api.codebair.com/v1.

中文 Quick Start

1. Shared Parameters

  • Base URL: https://api.codebair.com/v1
  • API Key: CodeBair key (sk-...)
  • Model: use a model returned by /v1/models

Some clients use Anthropic- or Gemini-style variables and may not need /v1. Each section below notes that explicitly.

2. Choose Your Client

Client Best for Key configuration
Claude Code terminal users / developers ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN
CC Switch users who want a GUI for Claude config import custom config
Codex terminal users / developers config.toml + auth.json
Cursor IDE users Models settings
Cherry Studio desktop chat client users Anthropic provider
Kilo VS Code / Kilo users Anthropic provider + custom base URL
OpenCode developers opencode.json + OPENCODE_CONFIG
OpenClaw developers openclaw.json
Chatbox desktop chat users OpenAI API config
WorkBuddy enterprise chat / office users custom model / OpenAI-compatible
Gemini CLI CLI users GOOGLE_GEMINI_BASE_URL + GEMINI_API_KEY

3. Claude Code

Install

brew install --cask claude-code
curl -fsSL https://claude.ai/install.sh | bash
irm https://claude.ai/install.ps1 | iex
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

NPM install

npm install -g @anthropic-ai/claude-code
claude --version

Configure settings.json

  • Windows: C:\Users\<username>\.claude\settings.json
  • macOS / Linux: ~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.codebair.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx"
  }
}

Do not append /v1 to ANTHROPIC_BASE_URL.

Temporary bootstrap if settings.json is ignored

$env:ANTHROPIC_BASE_URL="https://api.codebair.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxxxxxxxxxx"
claude

Verify

Run:

claude

If Claude opens and responds normally, setup is complete.

4. CC Switch

  1. Open CC Switch
  2. Switch the group to Claude
  3. Choose 自定义配置 / custom configuration
  4. Paste this config and replace the token
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.codebair.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx"
  }
}
  1. Give it a name such as CodeBair
  2. Click 启用 / Enable

5. Codex

Install

npm install -g @openai/codex
codex --version

config.toml

model_provider = "codebair"
model = "gpt-5.3-codex"

[model_providers.codebair]
name = "codebair"
base_url = "https://api.codebair.com/v1"
wire_api = "responses"
requires_openai_auth = true

auth.json

{
  "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxx"
}

Verify

codex

6. Cursor

In Settings -> Models:

  1. Enable OpenAI API Key
  2. Paste your CodeBair key
  3. Enable Override OpenAI Base URL
  4. Set it to https://api.codebair.com/v1
  5. Add or enable a supported model

7. Cherry Studio

  1. Open Settings -> Model Services -> Add
  2. Choose provider type Anthropic
  3. Fill in:
  4. API URL: https://api.codebair.com
  5. API Key: CodeBair key
  6. Refresh the model list and add the models you need

8. VS Code Kilo

  1. Choose API provider Anthropic
  2. Enable custom base URL
  3. Set:
  4. Base API URL: https://api.codebair.com
  5. API Key: CodeBair key
  6. Test one reply

9. OpenCode

Create C:\Users\<username>\opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "zenchao": {
      "models": {
        "claude-haiku-4-5-20251001": { "name": "haiku 4.5" },
        "claude-opus-4-5-20251101": { "name": "opus 4.5" },
        "claude-opus-4-6": { "name": "opus 4.6" },
        "claude-sonnet-4-5-20250929": { "name": "sonnet 4.5" },
        "claude-sonnet-4-6": { "name": "sonnet 4.6" }
      },
      "npm": "@ai-sdk/anthropic",
      "options": {
        "apiKey": "sk-***",
        "baseURL": "https://api.codebair.com/v1"
      }
    }
  }
}

Set environment variable:

  • OPENCODE_CONFIG = C:\Users\<username>\opencode.json

Save auth:

opencode auth login
  • Provider ID: codeflow
  • Choose Other

Verify:

opencode

Then run /models.

10. OpenClaw

Open config:

openclaw dashboard

or

nano ~/.openclaw/openclaw.json

Use the same JSON structure as the Chinese guide, with provider base URL https://api.codebair.com and your CodeBair API key.

Apply changes:

openclaw gateway restart

11. Chatbox

  • Provider: OpenAI API
  • Base URL: https://api.codebair.com/v1
  • API Key: CodeBair key
  • Model: any supported model from /v1/models

12. WorkBuddy

Look for:

  • custom model
  • OpenAI-compatible
  • custom API

Use:

  • Base URL: https://api.codebair.com/v1
  • API Key: CodeBair key
  • Model: a supported model from /v1/models

13. Gemini CLI

Install

npm install -g @google/gemini-cli
gemini --version

Environment variables

export GOOGLE_GEMINI_BASE_URL="https://api.codebair.com"
export GEMINI_API_KEY="sk-xxxxxxxxxxxxxxxx"

or on Windows PowerShell:

$env:GOOGLE_GEMINI_BASE_URL="https://api.codebair.com"
$env:GEMINI_API_KEY="sk-xxxxxxxxxxxxxxxx"

.env file

  • Windows: C:\Users\<username>\.gemini\.env
  • macOS / Linux: ~/.gemini/.env
GOOGLE_GEMINI_BASE_URL="https://api.codebair.com"
GEMINI_API_KEY="sk-xxxxxxxxxxxxxxxx"

Verify

gemini

14. Troubleshooting

Error Common reason Fix
401 wrong key / extra spaces / not a CodeBair key recopy the key
403 not enough permission / no balance / restriction check account and balance
404 wrong Base URL confirm whether the client needs /v1
429 rate limit retry later with lower concurrency
5xx upstream instability retry with backoff
Model not found wrong model name use a model from /v1/models