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 not taking effect?
- Restart your terminal completely (close all windows and reopen)
- If still not working, create
~/.claude.jsonand add: - As a fallback, export environment variables directly:
Invalid API Key or Please run /login?
Check that ~/.claude/settings.json exists and the JSON format is valid (no trailing commas, correct quotes). Validate at jsonlint.com.
Previously logged into Anthropic official?
Claude Code prioritizes cached official credentials. Run /logout inside Claude Code, close it, then restart. If still failing:
offline?
Claude Code checks connectivity via Google. offline just means Google is unreachable — this does not affect CometAPI usage.
Fetch / 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.