Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

5.1 KB
Raw Blame
import type { RegistryEntry } from "../../shared.ts";
import {
  getClaudeCliHeaders,
  mapStainlessOs,
  mapStainlessArch,
  ANTHROPIC_BETA_CLAUDE_OAUTH,
  ANTHROPIC_VERSION_HEADER,
  CLAUDE_CLI_STAINLESS_PACKAGE_VERSION,
  CLAUDE_CLI_STAINLESS_RUNTIME_VERSION,
  resolvePublicCred,
} from "../../shared.ts";

export const claudeProvider: RegistryEntry = {
  id: "claude",
  alias: "cc",
  format: "claude",
  executor: "default",
  baseUrl: "https://api.anthropic.com/v1/messages",
  urlSuffix: "?beta=true",
  authType: "oauth",
  authHeader: "x-api-key",
  defaultContextLength: 200000,
  headers: getClaudeCliHeaders(),
  oauth: {
    clientIdEnv: "CLAUDE_OAUTH_CLIENT_ID",
    clientIdDefault: resolvePublicCred("claude_id"),
    tokenUrl: "https://api.anthropic.com/v1/oauth/token",
  },
  models: [
    {
      id: "claude-fable-5-1",
      name: "Claude Fable 5.1",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
      supportsXHighEffort: true,
      supportsVision: true,
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-fable-5",
      name: "Claude Fable 5",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      // Opus 4.7+/Fable 5 reject non-default temperature/top_p/top_k with a 400 (sampling
      // is fixed; reasoning is steered by output_config.effort). Strip them before dispatch.
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
      supportsXHighEffort: true,
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-opus-5",
      name: "Claude Opus 5",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
      supportsXHighEffort: true,
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    // Listed after Opus 5 so the cc/ Opus default stays on a model stale live catalogs still accept (#14612).
    {
      id: "claude-opus-5-5",
      name: "Claude Opus 5.5",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
      supportsXHighEffort: true,
      supportsVision: true,
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-opus-4-8",
      name: "Claude Opus 4.8",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
      supportsXHighEffort: true,
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-opus-4-7",
      name: "Claude Opus 4.7",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
      supportsXHighEffort: true,
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-opus-4-6",
      name: "Claude Opus 4.6",
      supportsXHighEffort: false,
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high", "max"],
    },
    {
      id: "claude-opus-4-5-20251101",
      name: "Claude Opus 4.5",
      supportsXHighEffort: false,
      contextLength: 200000,
      maxOutputTokens: 64000,
      supportsReasoning: true,
      supportedThinkingEfforts: ["low", "medium", "high"],
    },
    {
      id: "claude-sonnet-5",
      name: "Claude Sonnet 5",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      // Sonnet 5 is the first Sonnet-tier model to support xhigh effort — do NOT copy
      // the `supportsXHighEffort: false` from the older claude-sonnet-4-6/4-5 entries.
      supportsXHighEffort: true,
      // Sonnet 5 rejects non-default temperature/top_p/top_k with a 400 (adaptive-only;
      // reasoning steered by output_config.effort). Mirrors the Opus/Fable entries.
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-sonnet-5-5",
      name: "Claude Sonnet 5.5",
      contextLength: 1000000,
      maxOutputTokens: 128000,
      supportsXHighEffort: true,
      // Sonnet 5.5 caps effort at xhigh. Listing the tiers here makes the
      // executor lower a requested "max" to "xhigh" instead of forwarding it.
      supportedThinkingEfforts: ["low", "medium", "high", "xhigh"],
      unsupportedParams: ["temperature", "top_p", "top_k"],
    },
    {
      id: "claude-sonnet-4-6",
      name: "Claude Sonnet 4.6",
      supportsXHighEffort: false,
      contextLength: 1000000,
      maxOutputTokens: 64000,
    },
    {
      id: "claude-sonnet-4-5-20250929",
      name: "Claude Sonnet 4.5",
      supportsXHighEffort: false,
      contextLength: 200000,
      maxOutputTokens: 64000,
    },
    {
      id: "claude-haiku-4-5-20251001",
      name: "Claude Haiku 4.5",
      supportsXHighEffort: false,
      contextLength: 200000,
      maxOutputTokens: 64000,
    },
  ],
};