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¶
Option 1: native install (recommended)¶
Native install is the recommended method because it provides:
- a self-contained executable
- no Node.js dependency
- more stable auto-updates
Option 2: npm install¶
For environments that prefer or require npm:
Do not use sudo npm install -g, as it may cause permission and security issues.
Extra notes for Windows¶
- Option 1: run in WSL (supports WSL 1 and WSL 2)
- Option 2: run locally in Git Bash (requires Git for Windows)
After installation, enter the project directory and start:
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
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¶
CMD temporary variables¶
macOS / Linux temporary variables¶
VS Code integration with local Claude Code¶
2. Option 2: configure with CC Switch¶
- open the CC Switch GitHub Releases page
- scroll to the bottom and choose the package that matches your platform
- on Windows, the regular
.msipackage is recommended
Claude Code configuration¶
- open CC Switch
- choose the Claude group
- choose custom configuration in the provider section
- paste the template below and replace
ANTHROPIC_AUTH_TOKENwith 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"
}
}
- after it is added successfully, the configured group appears on the main screen
- click Enable on the right side; when it shows In Use, the configuration is complete
- run
claudein 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:
After installation, verify it:
To upgrade to the latest version:
Option 1: environment variable configuration (recommended)¶
Point Gemini CLI to Model Bay using environment variables.
macOS / Linux¶
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¶
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¶
To make them persistent system-wide:
- press
Win + R, typesysdm.cpl, and press Enter - click Advanced → Environment Variables
- under User variables, click New and add
GOOGLE_GEMINI_BASE_URLandGEMINI_API_KEY - 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
Gemini CLI checks .env files in this order:
- project
.gemini/.env - user
~/.gemini/.env ~/.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¶
Windows PowerShell¶
Or add it in .gemini/.env:
You can also specify it on startup:
Verify the configuration¶
Start Gemini CLI with:
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_URLishttps://model-bay.comand 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_MODELenvironment variable - Method 2: start with
gemini --model <model-name> - Method 3: define
GEMINI_MODELin.gemini/.env
Codex configuration guide¶
Follow the steps below to use Codex through Model Bay.
Prerequisite: install Codex¶
Option 1: global npm install (recommended)¶
Make sure Node.js v22 or later is installed, then run:
Option 2: install with yarn¶
After installation, verify it:
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:
File paths¶
- Windows:
C:\Users\<username>\.codex\auth.json - macOS:
/Users/<username>/.codex/auth.json - Linux:
~/.codex/auth.json
Verify the configuration¶
Run:
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:
Authentication failed¶
- verify the key in
auth.jsonstarts withsk- - 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.
Reference links¶
- 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
endpointto your Model Bay website API URL:https://model-bay.com/v1 - Replace
YOUR_API_KEY_HEADERandYOUR_API_KEY_VALUEwith 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"
}