Claude Code
Configure Claude Code CLI to use OhMyGPT as the API provider.
Claude Code is Anthropic's official agentic coding tool. This guide connects it to OhMyGPT so you can pay-as-you-go without an Anthropic subscription.
Quick Setup
Run the interactive installer:
npx omgvibeThis configures your environment automatically. For manual setup, continue reading.
Installation
curl -fsSL https://claude.ai/install.sh | bashnpm installation requires Node.js 18+.
Manual Configuration
Option 1: Shell Profile (Recommended)
Add to your shell profile (~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish):
export ANTHROPIC_BASE_URL="https://api.ohmygpt.com/code-assist/v1"
export ANTHROPIC_API_KEY="<your-ohmygpt-api-key>"Option 2: User Settings File
Edit ~/.claude/settings.json for user-wide configuration:
{
"env": {
"ANTHROPIC_API_KEY": "<your-ohmygpt-api-key>",
"ANTHROPIC_BASE_URL": "https://api.ohmygpt.com/code-assist/v1"
}
}Option 3: Project Settings File
Create .claude/settings.local.json in your project root for project-specific configuration:
{
"env": {
"ANTHROPIC_API_KEY": "<your-ohmygpt-api-key>",
"ANTHROPIC_BASE_URL": "https://api.ohmygpt.com/code-assist/v1"
}
}Project settings override user settings. Add .claude/settings.local.json to .gitignore to avoid committing your API key.
Do not use a .env file—Claude Code does not read standard .env files.
Configuration Reference
| Variable | Value | Required |
|---|---|---|
ANTHROPIC_BASE_URL | https://api.ohmygpt.com/code-assist/v1 | Yes |
ANTHROPIC_API_KEY | Your OhMyGPT API key | Yes |
DISABLE_TELEMETRY | 1 | Optional |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC | 1 | Optional |
Verification
After configuration, start Claude Code and run the /status command:
claude> /status
Anthropic base URL: https://api.ohmygpt.com/code-assist/v1If the base URL shows the OhMyGPT endpoint, your configuration is active.
GitHub Actions
Use Claude Code in CI/CD workflows to automate code reviews and issue responses.
Setup
Add these secrets to your repository:
| Secret | Value |
|---|---|
ANTHROPIC_API_KEY | Your OhMyGPT API key |
ANTHROPIC_BASE_URL | https://api.ohmygpt.com/code-assist/v1 |
Workflow Example
Create .github/workflows/claude.yml:
name: Claude Assistant
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "60"
claude_env: |
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}
DISABLE_TELEMETRY: 1Mention @claude in any issue or PR comment to trigger the assistant.
How It Works
OhMyGPT exposes an endpoint fully compatible with the Anthropic Messages API:
- Direct Connection — Setting
ANTHROPIC_BASE_URLroutes Claude Code's native protocol directly to OhMyGPT. No local proxy is required. - API Compatibility — OhMyGPT handles model mapping and passes through advanced features like extended thinking and native tool use.
- Pay-as-you-go — You are billed using your OhMyGPT balance. Usage appears in your OhMyGPT dashboard.
Troubleshooting
| Symptom | Cause | Solution |
|---|---|---|
| "Invalid API key" | Key not set or incorrect | Verify ANTHROPIC_API_KEY contains your OhMyGPT key |
| "Connection refused" | Wrong base URL | Ensure ANTHROPIC_BASE_URL is https://api.ohmygpt.com/code-assist/v1 |
| "Model not found" | Using unsupported model | Verify model name is correct |
| Prompts for API key | Config not loaded | Select "Yes" when prompted, or check settings file path |
| Tool use errors | Model doesn't support tools | Claude Code requires tool use; ensure you're using a supported model |
| Context length errors | Conversation too long | Start a new session or use a model with larger context window |
API Reference
| Item | Value |
|---|---|
| Base URL | https://api.ohmygpt.com/code-assist/v1 |
| Endpoint | POST /messages |
| Auth Header | Authorization: Bearer <api-key> |
| Content-Type | application/json |
Request and response formats follow the Anthropic Messages API specification.
How is this guide?
Last updated on
