Providers and gateways

Every provider, gateway and local runtime Cusp supports, how it detects them, and how it adapts to each model family.

Cusp talks to models through four wire protocols. Almost every provider, gateway and local server speaks at least one of them, which is how one runtime covers so many models.

Wire protocolEndpointUsed for
Anthropic MessagesPOST {root}/v1/messagesAnthropic, and the Anthropic-compatible endpoints of Z.ai, Moonshot, MiniMax, DeepSeek, Qwen, OpenRouter, Vercel, LiteLLM, Ollama and others
OpenAI ResponsesPOST {base}/responsesOpenAI, Azure OpenAI, xAI, and gateways that support it
OpenAI Chat CompletionsPOST {base}/chat/completionsEverything OpenAI-compatible: Groq, Together, Fireworks, Mistral, vLLM, LM Studio, …
Google Gemini…/models/{model}:streamGenerateContentGoogle AI Studio and Vertex AI

When a provider speaks more than one, Cusp prefers the one that preserves the most: Responses for OpenAI and xAI, Messages for Anthropic, Z.ai, Moonshot and MiniMax, and generateContent for Gemini.

Providers

ProviderProtocolsKey prefixEnvironment variableNotes
AnthropicMessagessk-ant-ANTHROPIC_API_KEYPrompt caching, token counting and documents fully supported
OpenAIResponses, Chatsk-proj-, sk-svcacct-OPENAI_API_KEYNative apply_patch tool and encrypted reasoning replay on Responses
Google GeminiGemini, ChatAIzaGEMINI_API_KEY, GOOGLE_API_KEYThought signatures round-tripped
xAIResponses, Chatxai-XAI_API_KEYConversation id header for cache affinity
DeepSeekChat, Messages—DEEPSEEK_API_KEYReasoning content replayed as required
Z.ai (GLM)Messages, Chat—ZAI_API_KEY, ZHIPU_API_KEYCoding plan endpoint; api.z.ai and open.bigmodel.cn
Moonshot (Kimi)Messages, Chat—MOONSHOT_API_KEY, KIMI_API_KEY.ai and .cn hosts
Alibaba Qwen (DashScope)Chat, Messagessk-sp-DASHSCOPE_API_KEYInternational, US and China regions
MiniMaxMessages, Chat—MINIMAX_API_KEYMessages is MiniMax's recommended path
Xiaomi MiMoChat, Messagestp-MIMO_API_KEY
MistralChat—MISTRAL_API_KEYTool call ids normalized to Mistral's format
GroqChatgsk_GROQ_API_KEY
CerebrasChatcsk-CEREBRAS_API_KEY
Together AIChat—TOGETHER_API_KEY
Fireworks AIChat, Messagesfw_FIREWORKS_API_KEY
DeepInfraChat, Messages—DEEPINFRA_API_KEY
Novita AIChat, Messages—NOVITA_API_KEY
SiliconFlowChat, Messages—SILICONFLOW_API_KEY

A dash in the key prefix column means the key format isn't distinctive. Cusp still identifies the provider by probing, or from the base URL.

Cloud platforms

PlatformHow to connectStatus
Azure OpenAIUse your resource URL (https://{resource}.openai.azure.com/openai/v1/) with an API key. The model id is your deployment nameSupported through the Responses protocol
Amazon BedrockUse a Bedrock OpenAI-compatible or Anthropic-compatible endpoint with a Bedrock API key (bearer token)Preview. SigV4 signing with AWS credentials is coming soon
Google Vertex AIUse the Vertex endpoint with an access token, or express mode with an API keyPreview. Application Default Credentials are coming soon

Cusp recognizes these from the host name (*.openai.azure.com, bedrock…, aiplatform.googleapis.com) and applies each platform's request differences automatically.

Gateways

A gateway gives you many models behind one key. Cusp treats each gateway as a provider and reads its model list, so you pick models by their gateway slug.

GatewayProtocolsKey prefixEnvironment variableNotes
OpenRouterChat, Messages, Responsessk-or-OPENROUTER_API_KEYSession id for sticky routing; reasoning details replayed; prompt caching for Claude models
Vercel AI GatewayChat, Messages, Responsesvck_AI_GATEWAY_API_KEYPrompt caching for Claude models
LiteLLM proxyChat, Messages——Self-hosted; default http://localhost:4000

Other OpenAI-compatible gateways (Portkey, Cloudflare AI Gateway, Helicone, and so on) work as a custom endpoint: give Cusp the base URL and any extra headers the gateway needs.

Local models

RuntimeDefault URLProtocols
Ollamahttp://localhost:11434Chat, Messages
LM Studiohttp://localhost:1234Chat, Messages
vLLMhttp://localhost:8000Chat
llama.cpp server, SGLangYour server's URLChat

No key is required for local runtimes. For local models Cusp picks the largest loaded model that supports tool calling with at least a 32k context window.

Small local models struggle with long agentic sessions. Cusp gives them the edit format that suits them best (see below), but expect more retries than with a frontier model. Give the server enough context length; many runtimes default to 4k or 8k tokens, which is too short for an agent.

Auto-detection

When you paste a key, with or without a base URL, Cusp runs a short pipeline:

  1. Hints. The key prefix (sk-ant-, sk-or-, AIza, …) and the host of the base URL each point to a provider.
  2. Probes. Cusp sends cheap, token-free requests (such as listing models) to each candidate protocol in parallel, with a 6-second timeout per probe.
  3. Fingerprints. Even a 401 tells Cusp something: error bodies and headers identify the provider behind an unknown URL.
  4. Models. The model list comes from the endpoint, enriched from Cusp's built-in catalog (context window, pricing, capabilities) and public sources.
  5. Pick. Cusp chooses a main model (the highest agentic score among models with tool calling) and a small model for auxiliary work: session titles, the auto-mode classifier, compaction and web page extraction.

You can override every result. Auto-detection only fills in a configuration; nothing is hidden.

Per-model-family adapters

The protocol is only half the story. Models from different labs were trained with different tool conventions, and they behave best when the harness speaks their dialect. Cusp keeps a profile per model family and adapts to it.

Edit format

FamilyEdit toolWhy
Claude, GeminiEdit and MultiEdit (str_replace: exact old text → new text)The format these models were trained on
GPTApplyPatch, sent as apply_patch (the V4A patch format)OpenAI's models are trained on it; on OpenAI and Azure it is sent as the native tool
Weaker or local modelsEditLines with hash-anchored linesEach line in Read output carries a short content hash. The model edits by anchor (12:a3) instead of reproducing exact text, which removes the most common failure mode for small models

Write is available to every family. Fuzzy matching for Edit goes through a ladder (exact, normalized whitespace, trimmed, re-indented, block-anchored) and reports which tier it used, so a near miss doesn't silently edit the wrong place.

Reasoning round-trip

Reasoning models return state that must be sent back on the next turn: Anthropic thinking signatures, OpenAI encrypted reasoning, Gemini thought signatures, and reasoning_content from DeepSeek, Kimi and GLM. Dropping it causes errors on some providers and a quiet loss of quality on others. Cusp stores this state opaquely with each message and replays it byte-exact to the same model. When you switch models mid-session, it sends a safe projection instead and notes the change.

Other adaptations

  • Tool names and descriptions. GPT models see update_plan instead of TodoWrite. Hooks and permission rules always see the canonical name.
  • Strict schemas. On OpenAI, tool schemas are sent in strict mode, with optional fields made nullable and mapped back.
  • Broken tool calls. Open models sometimes emit malformed JSON or tool calls embedded in text (Hermes, Qwen, GLM, MiniMax and Kimi markup). Cusp repairs JSON, coerces types against the schema, and extracts text-embedded calls before giving up.
  • Parallel calls. Turned off for runtimes that don't support them.
  • System prompts. Dynamic context goes where each provider handles it best: a mid-conversation system message on Claude, a developer item on OpenAI, a system reminder elsewhere.

Caching and cost

Cusp keeps the system prompt and tool list byte-stable across turns so providers can cache them. It sets the cache key each provider understands (prompt_cache_key on OpenAI, the session id on OpenRouter, a conversation header on xAI) and places Anthropic cache breakpoints automatically. Cost is computed per turn from the model's pricing, counting cache reads and writes separately. /cost in the CLI shows the running total.

Retries and fallbacks

Transient errors (rate limits, overloaded servers, dropped streams) are retried with backoff, and the UI tells you what happened: "Rate limited by Anthropic — retrying in 8 s." If a request fails because the endpoint rejects a parameter, Cusp learns from the error and retries without it. You can configure a fallback model (fallbackModel in settings); Cusp stays on one route as long as it works, to keep the cache warm.

Environment variables

The CLI and daemon pick up keys from these variables:

ANTHROPIC_API_KEY  OPENAI_API_KEY      GEMINI_API_KEY     GOOGLE_API_KEY
OPENROUTER_API_KEY AI_GATEWAY_API_KEY  XAI_API_KEY        DEEPSEEK_API_KEY
ZAI_API_KEY        ZHIPU_API_KEY       MOONSHOT_API_KEY   KIMI_API_KEY
MINIMAX_API_KEY    DASHSCOPE_API_KEY   MIMO_API_KEY       MISTRAL_API_KEY
GROQ_API_KEY       CEREBRAS_API_KEY    TOGETHER_API_KEY   FIREWORKS_API_KEY
DEEPINFRA_API_KEY  NOVITA_API_KEY      SILICONFLOW_API_KEY

In the desktop app, keys you paste are stored in the OS keychain instead.

On this page