Model availability changes over time. For current Claude model IDs, check
the CometAPI Models page.
Prerequisites
- A CometAPI key from your dashboard (starts with
sk-) - Git installed
- Supported OS: macOS, Linux, or Windows
Install Claude Code
Configure CometAPI endpoint
Create or edit the settings file:- macOS / Linux:
~/.claude/settings.json - Windows:
%USERPROFILE%\.claude\settings.json
sk-your-cometapi-key with your actual CometAPI key, then start Claude Code:
Troubleshooting
settings.json does not take effect
settings.json does not take effect
- Restart your terminal completely by closing all windows and reopening it.
- If it still does not work, create
~/.claude.jsonand add:
- As a fallback, export environment variables directly:
Invalid API Key or Please run /login
Invalid API Key or Please run /login
Check that
~/.claude/settings.json exists and the JSON format is valid with no trailing commas and correct quotes. Validate at jsonlint.com.Cached official credentials are used
Cached official credentials are used
Claude Code prioritizes cached official credentials. Run
/logout inside Claude Code, close it, then restart.If it still fails, remove the cached auth file:Status shows offline
Status shows offline
Claude Code checks connectivity via Google.
offline means Google is unreachable. This does not affect CometAPI usage.Fetch or web browsing fails
Fetch or web browsing fails
Claude Code’s Fetch feature calls Anthropic’s native service first, which requires direct internet access. A system-wide proxy may be needed.