Claude Code

Use Claude Code with Gab AI through the Anthropic-compatible /v1/messages endpoint.

Prerequisites

Configuration

Claude Code expects Anthropic's Messages API and appends /v1/messages itself. Set the base URL to the root domain, not https://gab.ai/v1.

Environment variables

Base URL

Use https://gab.ai for Claude Code. If you set https://gab.ai/v1, Claude Code may call /v1/v1/messages.

Supported Features

Smoke Test

You can validate the endpoint directly with cURL before launching Claude Code:

cURL

Troubleshooting

export ANTHROPIC_BASE_URL="https://gab.ai"
export ANTHROPIC_AUTH_TOKEN="YOUR_GAB_API_KEY"

claude

Base URL

Use https://gab.ai for Claude Code. If you set https://gab.ai/v1, Claude Code may call /v1/v1/messages.

curl https://gab.ai/v1/messages \\
  -H "x-api-key: YOUR_GAB_API_KEY" \\
  -H "anthropic-version: 2023-06-01" \\
  -H "content-type: application/json" \\
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 128,
    "messages": [
      {
        "role": "user",
        "content": [{ "type": "text", "text": "Say hello from Claude Code." }]
      }
    ]
  }'