Skip to content

Model Bay API Guide

Base URL

The Base URL can be obtained from the API information panel on the right side of the dashboard. Multiple nodes are available, and you should choose the one that fits your usage.

Current guide coverage

  • Claude Code installation and configuration
  • Gemini CLI configuration
  • Codex configuration
  • Cursor API key configuration
  • Cherry Studio API key configuration
  • VS Code Kilo extension setup
  • Opencode setup
  • OpenClaw setup

Claude Code installation and configuration

1. Install Claude Code

Native install is the recommended method because it provides:

  • a self-contained executable
  • no Node.js dependency
  • more stable auto-updates
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

Option 2: npm install

For environments that prefer or require npm:

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

Do not use sudo npm install -g, as it may cause permission and security issues.

Extra notes for Windows

  1. Option 1: run in WSL (supports WSL 1 and WSL 2)
  2. Option 2: run locally in Git Bash (requires Git for Windows)

After installation, enter the project directory and start:

cd your-awesome-project
claude

Official docs reference: https://code.claude.com/docs/zh-CN/setup#安装

Claude Code CLI configuration file guide

This part describes how to use JSON configuration files in the .claude directory under the user home directory to manage Claude Code global settings, such as editor preferences, auto-update behavior, and permission control.

1. Option 1: manual file configuration

First, insert the following into .claude.json so startup does not require entering the account flow.

File paths:

  • Windows: C:\Users\<username>\.claude.json
  • macOS / Linux: ~/.claude.json
"hasCompletedOnboarding": true,

Claude Code settings are stored in the hidden .claude directory in the user home directory.

File paths:

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

Some users report that self-created settings.json does not take effect. In that case, the source recommends using temporary PowerShell variables.

Also note: after the first Claude Code installation, one initialization run is required before settings.json can be recognized. After initialization, future launches can directly use the values in settings.json.

PowerShell temporary variables

$env:ANTHROPIC_BASE_URL="https://model-bay.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxxxxxxxxxx"

CMD temporary variables

set ANTHROPIC_BASE_URL=https://model-bay.com
set ANTHROPIC_AUTH_TOKEN=sk-xxxxxxxxxxxxxxxxxx

macOS / Linux temporary variables

export ANTHROPIC_BASE_URL="https://model-bay.com"
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxxxxxxxxxx"

VS Code integration with local Claude Code

2. Option 2: configure with CC Switch

  1. open the CC Switch GitHub Releases page
  2. scroll to the bottom and choose the package that matches your platform
  3. on Windows, the regular .msi package is recommended

Claude Code configuration

  1. open CC Switch
  2. choose the Claude group
  3. choose custom configuration in the provider section
  4. paste the template below and replace ANTHROPIC_AUTH_TOKEN with your own API key; also give this API configuration any name you want
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://model-bay.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx"
  }
}
  1. after it is added successfully, the configured group appears on the main screen
  2. click Enable on the right side; when it shows In Use, the configuration is complete
  3. run claude in the terminal; if the chat interface opens and replies normally, the setup is complete

Gemini CLI configuration guide

Follow the steps below to use Gemini CLI through Model Bay.

Prerequisite: install Gemini CLI

Make sure Node.js v20 or later is installed, then install Gemini CLI globally with npm:

npm install -g @google/gemini-cli

After installation, verify it:

gemini --version

To upgrade to the latest version:

npm upgrade -g @google/gemini-cli

Point Gemini CLI to Model Bay using environment variables.

macOS / Linux

export GOOGLE_GEMINI_BASE_URL="https://model-bay.com"
export GEMINI_API_KEY="sk-xxxxxxxxxxxxxxxx"

To make the settings persistent, append them to your shell config:

# append to ~/.bashrc or ~/.zshrc
echo 'export GOOGLE_GEMINI_BASE_URL="https://model-bay.com"' >> ~/.bashrc
echo 'export GEMINI_API_KEY="sk-xxxxxxxxxxxxxxxx"' >> ~/.bashrc
source ~/.bashrc

Windows PowerShell

$env:GOOGLE_GEMINI_BASE_URL="https://model-bay.com"
$env:GEMINI_API_KEY="sk-xxxxxxxxxxxxxxxx"

To make them persistent, append them to the PowerShell profile:

# append to $PROFILE
Add-Content $PROFILE 'Set-Item -Path Env:GOOGLE_GEMINI_BASE_URL -Value "https://model-bay.com"'
Add-Content $PROFILE 'Set-Item -Path Env:GEMINI_API_KEY -Value "sk-xxxxxxxxxxxxxxxx"'

Windows CMD

set GOOGLE_GEMINI_BASE_URL=https://model-bay.com
set GEMINI_API_KEY=sk-xxxxxxxxxxxxxxxx

To make them persistent system-wide:

  1. press Win + R, type sysdm.cpl, and press Enter
  2. click AdvancedEnvironment Variables
  3. under User variables, click New and add GOOGLE_GEMINI_BASE_URL and GEMINI_API_KEY
  4. restart the terminal

Option 2: .env file configuration

Gemini CLI supports loading variables from a .env file. Create .gemini/.env in the user home directory.

File paths:

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

Gemini CLI checks .env files in this order:

  1. project .gemini/.env
  2. user ~/.gemini/.env
  3. ~/.env

It stops at the first file found and does not merge multiple files.

Optional default model

To set a default model, define GEMINI_MODEL.

macOS / Linux

export GEMINI_MODEL="gemini-2.5-pro"

Windows PowerShell

$env:GEMINI_MODEL="gemini-2.5-pro"

Or add it in .gemini/.env:

GEMINI_MODEL="gemini-2.5-pro"

You can also specify it on startup:

gemini --model gemini-2.5-pro

Verify the configuration

Start Gemini CLI with:

gemini

If everything is configured correctly, Gemini CLI will connect to Model Bay.

You can use /auth to inspect the authentication mode and choose Use Gemini API key.

Common issues

GEMINI_API_KEY is not set

  • check whether the environment variable is set correctly
  • verify the variable name spelling
  • if you use .env, confirm the path is correct (~/.gemini/.env, not ~/.gemini.env)
  • Windows users must restart the terminal after setting system variables

Timeout or connection errors

  • verify GOOGLE_GEMINI_BASE_URL is https://model-bay.com and does not have a trailing /
  • check network connectivity
  • make sure the API key is valid and not expired

How to switch models

  • Method 1: set the GEMINI_MODEL environment variable
  • Method 2: start with gemini --model <model-name>
  • Method 3: define GEMINI_MODEL in .gemini/.env

Codex configuration guide

Follow the steps below to use Codex through Model Bay.

Prerequisite: install Codex

Make sure Node.js v22 or later is installed, then run:

npm install -g @openai/codex

Option 2: install with yarn

yarn global add @openai/codex

After installation, verify it:

codex --version

Step 1: configure config.toml

Find and edit config.toml (create it if it does not exist) and use the following content:

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

[model_providers.model-bay]
name = "model-bay"
base_url = "https://model-bay.com/v1"
wire_api = "responses"
requires_openai_auth = true

File paths

  • Windows: C:\Users\<username>\.codex\config.toml
  • macOS: /Users/<username>/.codex/config.toml
  • Linux: ~/.codex/config.toml

Step 2: configure auth.json

Find and edit auth.json (create it if it does not exist) and replace OPENAI_API_KEY with the key generated in the backend:

{
  "OPENAI_API_KEY": "your key"
}

File paths

  • Windows: C:\Users\<username>\.codex\auth.json
  • macOS: /Users/<username>/.codex/auth.json
  • Linux: ~/.codex/auth.json

Verify the configuration

Run:

codex

If everything is configured correctly, Codex will connect to Model Bay and use the gpt-5.3-codex model.

Common issues

config.toml or .codex directory not found

Create the .codex directory manually:

# Windows (PowerShell)
mkdir "$env:USERPROFILE\.codex"
# macOS / Linux
mkdir -p ~/.codex

Authentication failed

  • verify the key in auth.json starts with sk-
  • make sure there are no extra spaces or line breaks
  • make sure the key has not expired; check token status in backend token management

How to switch models

Edit config.toml and change the model field to another supported model name.


  • Claude Code official docs: https://code.claude.com/docs/en/overview#native-install-recommended
  • Node installation reference: https://blog.csdn.net/2509_94001037/article/details/156696400
  • CC Switch reference: https://docs.packyapi.com/docs/ccswitch/
  • Cherry Studio reference: https://docs.cherry-ai.com/
  • Opencode docs: https://opencode.ai/docs
  • Opencode configuration reference: https://zhuanlan.zhihu.com/p/1992957270024283486

Galileo AI CFG setup

If you are using a custom Galileo AI provider config (CFG), you can use this template directly.

Notes:

  • Set endpoint to your Model Bay website API URL: https://model-bay.com/v1
  • Replace YOUR_API_KEY_HEADER and YOUR_API_KEY_VALUE with your actual values
{
  "authentication_type": "api_key",
  "api_key_header": "YOUR_API_KEY_HEADER",
  "api_key_value": "YOUR_API_KEY_VALUE",
  "model_properties": [
    {
      "name": "gpt-5.2-codex",
      "alias": "GPT 5.2 Codex",
      "supported_parameters": [
        "max_tokens",
        "n",
        "reasoning_effort",
        "stop_sequences",
        "temperature",
        "tool_choice",
        "tools",
        "verbosity"
      ]
    },
    {
      "name": "gpt-5.3-codex",
      "alias": "GPT 5.3 Codex",
      "based_on": "gpt-5.3-codex"
    },
    {
      "name": "gpt-5.3-codex-spark",
      "alias": "GPT 5.3 Codex Spark",
      "based_on": "gpt-5.3-codex-spark"
    },
    {
      "name": "gpt-5.4",
      "alias": "GPT 5.4",
      "based_on": "gpt-5.4"
    },
    {
      "name": "gpt-5.5",
      "alias": "GPT 5.5",
      "based_on": "gpt-5.5"
    },
    {
      "name": "claude-haiku-4-6",
      "alias": "Claude Haiku 4.6",
      "based_on": "Claude Haiku 4.6"
    },
    {
      "name": "claude-opus-4-6",
      "alias": "Claude Opus 4.6",
      "based_on": "Claude Opus 4.6"
    },
    {
      "name": "claude-opus-4-7",
      "alias": "Claude Opus 4.7",
      "based_on": "Claude Opus 4.7"
    },
    {
      "name": "claude-sonnet-4-6",
      "alias": "Claude Sonnet 4.6",
      "based_on": "Claude Sonnet 4.6"
    }
  ],
  "endpoint": "https://model-bay.com/v1"
}