[Go to site: main page, start]

Skip to main content
Use this guide to connect Claude Code to CometAPI. Official references:
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

1

Run the official installer

2

Verify installation

Configure CometAPI endpoint

Create or edit the settings file:
  • macOS / Linux: ~/.claude/settings.json
  • Windows: %USERPROFILE%\.claude\settings.json
Replace sk-your-cometapi-key with your actual CometAPI key, then start Claude Code:

Troubleshooting

  1. Restart your terminal completely by closing all windows and reopening it.
  2. If it still does not work, create ~/.claude.json and add:
  1. As a fallback, export environment variables directly:
Check that ~/.claude/settings.json exists and the JSON format is valid with no trailing commas and correct quotes. Validate at jsonlint.com.
Claude Code prioritizes cached official credentials. Run /logout inside Claude Code, close it, then restart.If it still fails, remove the cached auth file:
Claude Code checks connectivity via Google. offline means Google is unreachable. This does not affect CometAPI usage.
Claude Code’s Fetch feature calls Anthropic’s native service first, which requires direct internet access. A system-wide proxy may be needed.
Last modified on July 2, 2026