Connecting Cursor / Claude Code / Cherry Studio to a Custom AI Gateway

Tool setup · 2026-11-20 · ~7 min read

Mainstream AI tools all support custom APIs — which means you can point them at your own gateway (e.g. 4-4 AI) and use one key and one billing account everywhere. This guide covers the three most-used tools plus a universal troubleshooting approach.

Prerequisite: you have an API key. If not, start with the 5-minute quickstart. We use 4-4 AI's Base URL (https://www.4-4.vip/v1) as the example — any OpenAI-compatible gateway works the same way.

Cursor

Cursor's chat models can run over a custom OpenAI-compatible endpoint:

  1. Open Settings → Models;
  2. Expand the OpenAI API Key section and enter your gateway key (sk-...);
  3. Fill in Override OpenAI Base URL: https://www.4-4.vip/v1;
  4. Add the model names available on your gateway (exactly matching the gateway-side names, case-sensitive);
  5. Click Verify; once it passes, pick your custom model in the chat panel.

Note: Cursor's built-in Tab completion and parts of Composer run on Cursor's own service and are unaffected; custom models mainly apply to Chat.

Claude Code

Claude Code speaks the Anthropic protocol. The prerequisite is that your gateway supports the Anthropic endpoint (/v1/messages) — gateways in the new-api ecosystem (including 4-4 AI) support protocol conversion, routing Anthropic-format requests to whatever model channel you configured.

Configure via environment variables (in the terminal where you launch claude):

export ANTHROPIC_BASE_URL="https://www.4-4.vip"
export ANTHROPIC_AUTH_TOKEN="sk-your-gateway-key"

# launch
claude

Windows PowerShell equivalent:

$env:ANTHROPIC_BASE_URL = "https://www.4-4.vip"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-gateway-key"
Two details: ① ANTHROPIC_BASE_URL takes no /v1 suffix (the tool appends the protocol path itself); ② if you want Claude Code to use non-Claude models, make sure the gateway channel has the corresponding model mapping configured, and use the gateway-side model names.

Cherry Studio

Cherry Studio supports custom OpenAI-compatible providers directly:

  1. Settings → Model Providers: add or select an OpenAI-compatible provider;
  2. API address: https://www.4-4.vip/v1 (some versions auto-append /v1 — don't duplicate it);
  3. API key: your gateway key;
  4. Add available model names in model management, save, and select them in chat.

The universal pattern: any OpenAI-compatible tool

Plenty of tools (LobeChat, Open WebUI, immersive-translate, various IDE plugins) follow the same three-part pattern:

SettingValueCommon pitfall
Base URLhttps://www.4-4.vip/v1some tools want /v1, some don't — on a 404, toggle /v1 first
API Keygateway key (sk-...)copied whitespace, expired key, exhausted quota
Model namethe gateway channel's namemust match the gateway exactly — presets with non-existent names fail

Troubleshooting cheat sheet

401 Unauthorized

404 Not Found

400 Model Not Found / no available channel

Streaming cuts off / no response

FAQ

Is my data safe through a gateway?

Your requests transit the gateway to the upstream channel. Check the platform's logging and privacy policy; for sensitive data, disable conversation log storage on the gateway or pick channels with no-data-retention.

Can one tool connect to multiple gateways?

Most tools support multiple providers with instant switching (Cherry Studio, Cursor, etc.). Give each tool its own token — that also separates usage stats and quota caps.

Why route tools through one gateway instead of direct vendor connections?

Three reasons: centralized key management (smaller leak surface), unified billing and usage visibility (no multi-platform reconciliation), and vendor decoupling (switching models is a gateway config change, not a rewrite).

Related articles

4-4 AI Quickstart: Connect to a Unified AI API in 5 Minutes Step-by-step: register on 4-4 AI, create an API key, and use the OpenAI-compatible Base URL to reach GLM, Deep 7 Engineering Practices to Cut Token Costs in AI Applications From model tiering and context trimming to prefix caching and budget guards: 7 practical, code-level engineeri
Ready to build?

One key for GLM, DeepSeek, Qwen and more — unified billing and usage analytics.

View models & pricing Get started