Back to Blog
Aifyles

Aifyles

Configure Claude Code, Cursor & Cline with Custom LLM APIs

Configure Claude Code, Cursor & Cline with Custom LLM APIs

Why Most Custom API Setups Fail: Protocol Mismatch Explained

Over 90% of 400 and 404 errors when wiring coding tools into an LLM API gateway come from mixing up OpenAI Chat Completions (/v1/chat/completions) and Anthropic Messages (/v1/messages):

ClientNative ProtocolExpected Base URL ShapeRecommended Gateways
Claude Code (CLI)Anthropic /v1/messagesRoot URL (often without /v1)AIKuBot Coding API or native Anthropic-compatible gateways
Cursor (AI IDE)OpenAI Compatible (/v1)https://your-gateway/v1AIKuBot, AISuhui, OpenRouter
Cline / Roo CodeBoth OpenAI & Anthropic.../v1 (OpenAI) or root (Anthropic)AIKuBot, OpenRouter
Cherry StudioOpenAI / Anthropic / Geminihttps://your-gateway/v1AISuhui, SiliconFlow, OpenRouter

Still comparing providers? Read our 2026 Best LLM API Gateways & OpenRouter Alternatives Guide or browse the AI API Relays Directory.


1. Configure Claude Code with a Custom Gateway

Set the Anthropic environment variables in your shell profile (~/.zshrc / ~/.bashrc):

export ANTHROPIC_BASE_URL="https://aikubot.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-gateway-api-key"

On Windows PowerShell:

[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://aikubot.com", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-your-gateway-api-key", "User")

Restart your terminal and run claude inside any repository. If you see 404, check your gateway docs for whether /v1 should be appended or omitted.


2. Configure Cursor (Override OpenAI Base URL)

  1. Open Cursor → Settings → Models.
  2. Paste your gateway API key into OpenAI API Key.
  3. Enable Override OpenAI Base URL and enter https://aikubot.com/v1 (or https://aisuhui.com/v1 / https://openrouter.ai/api/v1).
  4. Click Verify, then enable the exact model IDs supported by your gateway.

3. Configure Cline / Roo Code for Maximum Prompt-Caching Savings

  1. Open Cline or Roo Code settings in VS Code.
  2. Select Anthropic (with Custom Base URL enabled) when your gateway supports native /v1/messages prompt caching, or OpenAI Compatible for universal models.
  3. Enter your Base URL, API Key, and model ID.
  4. Keep prompt caching active—on multi-turn repo refactors, cache hits reduce repeated context costs by 50–80%.

4. Configure Cherry Studio for Multi-Model Chat & Local RAG

  1. Open Cherry Studio → Settings → Model Providers.
  2. Add an OpenAI-compatible provider (or pick built-in OpenRouter / SiliconFlow).
  3. Enter your gateway Base URL (https://aisuhui.com/v1) and API Key, click Check, and click Manage to fetch available models.

Quick Error Troubleshooting

  • HTTP 401: Invalid/revoked key, trailing whitespace, or conflicting ANTHROPIC_API_KEY vs. ANTHROPIC_AUTH_TOKEN.
  • HTTP 404: Double /v1/v1 path or pasting /chat/completions inside the Base URL field.
  • HTTP 429: Insufficient balance or upstream burst limit—switch to an official-tier coding route or add a failover provider in Cloudflare AI Gateway.

Explore more BYOK open-source developer tools in our AI Coding Category.

Copyright © 2026 Aifyles
All rights reserved

Subscribe to Newsletter

Get the latest updates and news directly in your inbox.