normalizeClaudeApiBaseUrl (usage/claude-api.ts)

oh-my-pi · packages/ai/src/usage/claude-api.ts · typescript · MIT
auth

Module exposing: normalizeClaudeApiBaseUrl, claudeOAuthBaseUrl, claudeOAuthBaseUrls, claudeApiUrl, buildClaudeOAuthHeaders, DEFAULT_CLAUDE_API_BASE_URL, DEFAULT_CLAUDE_OAUTH_BASE_URL, CLAUDE_OAUTH_BETA

// Source: https://github.com/can1357/oh-my-pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
import { getClaudeCodeUserAgent } from "../providers/claude-code-fingerprint";

/** Canonical host for Claude's first-party account API. */
export const DEFAULT_CLAUDE_API_BASE_URL = "https://api.anthropic.com";
/** Canonical subscription usage and profile endpoint. */
export const DEFAULT_CLAUDE_OAUTH_BASE_URL = `${DEFAULT_CLAUDE_API_BASE_URL}/api/oauth`;
/** OAuth protocol beta required by Claude's account routes. */
export const CLAUDE_OAUTH_BETA = "oauth-2025-04-20";

/**
 * Normalize Messages (`/v1`) and OAuth (`/api/oauth`) endpoints to the common
 * API root used by both usage and reset routes. Custom path prefixes survive.
 */

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key