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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
import {
ANTIGRAVITY_BOOTSTRAP_BASE_URLS,
ANTIGRAVITY_RUNTIME_BASE_URLS,
getAntigravityFetchAvailableModelsUrls,
} from "@omniroute/open-sse/config/antigravityUpstream.ts";
import {
CODEBUDDY_CN_USER_AGENT,
CODEBUDDY_INTL_USER_AGENT,
GITHUB_COPILOT_API_VERSION,
GITHUB_COPILOT_CHAT_PLUGIN_VERSION,
GITHUB_COPILOT_CHAT_USER_AGENT,
GITHUB_COPILOT_EDITOR_VERSION,
} from "@omniroute/open-sse/config/providerHeaderProfiles.ts";
// userAgent / editorVersion on GITHUB_CONFIG are captured-pin snapshots for
// lockstep tests. Request construction must call getGitHubCopilotChatUserAgent()
// (#12417) — see providers/github.ts and providers/ghe-copilot.ts.
import {
GROK_BUILD_DEVICE_CODE_URL,
GROK_BUILD_OAUTH_ISSUER,
GROK_BUILD_OAUTH_SCOPES,
GROK_BUILD_TOKEN_URL,
} from "@omniroute/open-sse/config/grokBuild.ts";
import { resolvePublicCred } from "@omniroute/open-sse/utils/publicCreds.ts";
import { CURSOR_AGENT_CLI_VERSION } from "@omniroute/open-sse/utils/cursorAgentCliVersionPin.ts";
import { buildGitLabOAuthEndpoints, GITLAB_DUO_DEFAULT_BASE_URL } from "../gitlab";
/**
* OAuth Configuration Constants
*
* All credentials are read exclusively from environment variables.
* Default values match the public CLI client IDs from .env.example
* (auto-populated by scripts/dev/sync-env.mjs on install).
*
* These are public OAuth client credentials for desktop/CLI applications
* that rely on PKCE for security (RFC 8252), not on secret confidentiality.
* Shared header/version fingerprints now come from the central provider
* header profile module so OAuth, usage fetchers and executors stay aligned.
*/
// Claude OAuth Configuration (Authorization Code Flow with PKCE)
export const CLAUDE_CONFIG = {
clientId: resolvePublicCred("claude_id", "CLAUDE_OAUTH_CLIENT_ID"),
authorizeUrl: "https://claude.ai/oauth/authorize",
tokenUrl: "https://api.anthropic.com/v1/oauth/token",
redirectUri:
process.env.CLAUDE_CODE_REDIRECT_URI || "https://platform.claude.com/oauth/code/callback",
scopes: [
"org:create_api_key",
"user:profile",
"user:inference",
"user:sessions:claude_code",
"user:mcp_servers",
],
codeChallengeMethod: "S256",
};
// Codex (OpenAI) OAuth Configuration (Authorization Code Flow with PKCE)
export const CODEX_CONFIG = {
clientId: resolvePublicCred("codex_id", "CODEX_OAUTH_CLIENT_ID"),
authorizeUrl: "https://auth.openai.com/oauth/authorize",
tokenUrl: "https://auth.openai.com/oauth/token",
scope: "openid profile email offline_access",
codeChallengeMethod: "S256",
// Additional OpenAI-specific params
extraParams: {
id_token_add_organizations: "true",
codex_cli_simplified_flow: "true",
originator: "codex_cli_rs",
// prompt=login forces Auth0/OpenAI to RE-AUTHENTICATE the user instead of
// silently reusing an existing browser session. This is THE KEY parameter
// that enables multi-account OAuth on the same device + same client_id:
// without it, OAuth flow #2 carries over session state from OAuth flow #1
// and Auth0 invalidates the previous account's refresh_token family as a
// "session takeover". With prompt=login, each OAuth flow creates an
// isolated session that does not trample siblings.
// Ported from ndycode/codex-multi-auth (auth.ts: forceNewLogin option) —
// the only known tool that sustains multiple Codex OAuth accounts.
prompt: "login",
},
};
// Qoder OAuth Configuration (Authorization Code)
const QODER_OAUTH_AUTHORIZE_URL = process.env.QODER_OAUTH_AUTHORIZE_URL || "";
const QODER_OAUTH_TOKEN_URL = process.env.QODER_OAUTH_TOKEN_URL || "";
const QODER_OAUTH_USERINFO_URL = process.env.QODER_OAUTH_USERINFO_URL || "";
const QODER_OAUTH_CLIENT_ID = process.env.QODER_OAUTH_CLIENT_ID || "";
const QODER_OAUTH_CLIENT_SECRET = process.env.QODER_OAUTH_CLIENT_SECRET || "";
const QODER_OAUTH_ENABLED =
!!QODER_OAUTH_AUTHORIZE_URL &&
!!QODER_OAUTH_TOKEN_URL &&
!!QODER_OAUTH_USERINFO_URL &&
!!QODER_OAUTH_CLIENT_ID &&
!!QODER_OAUTH_CLIENT_SECRET;
export const QODER_CONFIG = {
enabled: QODER_OAUTH_ENABLED,
clientId: QODER_OAUTH_CLIENT_ID,
clientSecret: QODER_OAUTH_CLIENT_SECRET,
authorizeUrl: QODER_OAUTH_AUTHORIZE_URL,
tokenUrl: QODER_OAUTH_TOKEN_URL,
userInfoUrl: QODER_OAUTH_USERINFO_URL,
extraParams: {
loginMethod: "phone",
type: "phone",
},
};
// CodeBuddy CN (Tencent — copilot.tencent.com) OAuth Configuration
// (Custom Device-Auth Flow: POST stateUrl → open authUrl → GET pollUrl?state=).
// No client_id/secret — the upstream CLI ships none.
export { CODEBUDDY_CN_USER_AGENT };
export const CODEBUDDY_CN_CONFIG = {
baseUrl: "https://copilot.tencent.com",
stateUrl: "https://copilot.tencent.com/v2/plugin/auth/state",
tokenUrl: "https://copilot.tencent.com/v2/plugin/auth/token",
refreshUrl: "https://copilot.tencent.com/v2/plugin/auth/token/refresh",
userAgent: CODEBUDDY_CN_USER_AGENT,
platform: "CLI",
domain: "copilot.tencent.com",
pollInterval: 5000,
};
// CodeBuddy International (codebuddy.ai) OAuth Configuration
export const CODEBUDDY_INTL_CONFIG = {
baseUrl: "https://www.codebuddy.ai",
stateUrl: "https://www.codebuddy.ai/v2/plugin/auth/state",
tokenUrl: "https://www.codebuddy.ai/v2/plugin/auth/token",
refreshUrl: "https://www.codebuddy.ai/v2/plugin/auth/token/refresh",
userAgent: CODEBUDDY_INTL_USER_AGENT,
platform: "ide",
domain: "www.codebuddy.ai",
pollInterval: 5000,
};
// WorkBuddy config lives with its device-flow module so this god-file only
// re-exports. Do not alias CODEBUDDY_CN_CONFIG — different host and account.
export { WORKBUDDY_CONFIG } from "../providers/workbuddy";
// Grok Build (xAI) OAuth Configuration (Device Code + import-token fallback)
// Public client_id resolved through resolvePublicCred so it is never a literal.
export const GROK_CLI_CONFIG = {
clientId: resolvePublicCred("grok_id", "GROK_OAUTH_CLIENT_ID"),
issuer: GROK_BUILD_OAUTH_ISSUER,
deviceCodeUrl: GROK_BUILD_DEVICE_CODE_URL,
tokenUrl: GROK_BUILD_TOKEN_URL,
scope: GROK_BUILD_OAUTH_SCOPES.join(" "),
};
// Grok Build (xAI) OAuth Configuration (Browser PKCE Flow — added #7013)
// Same auth.x.ai authorize/token endpoints and public client_id as XAI_OAUTH_CONFIG,
// but scoped to the Grok Build (cli-chat-proxy.grok.com) entitlement and kept as a
// separate config so grok-cli's own baseUrl/model registry stay untouched.
export const GROK_BUILD_OAUTH_CONFIG = {
clientId: resolvePublicCred("grok_id", "GROK_OAUTH_CLIENT_ID"),
authorizeUrl: "https://auth.x.ai/oauth2/authorize",
tokenUrl: "https://auth.x.ai/oauth2/token",
scope: "openid profile email offline_access grok-cli:access",
codeChallengeMethod: "S256",
loopbackPort: 56122, // distinct from xai-oauth's 56121 — both can run concurrently
callbackPath: "/callback",
callbackHost: "127.0.0.1",
};
// xAI API OAuth Configuration (Authorization Code Flow with PKCE)
// This intentionally uses a separate provider from Grok Build: both use the
// public Grok CLI OAuth client, but their inference endpoints and model
// entitlements differ (`api.x.ai` vs `cli-chat-proxy.grok.com`).
export const XAI_OAUTH_CONFIG = {
clientId: resolvePublicCred("grok_id", "GROK_OAUTH_CLIENT_ID"),
authorizeUrl: "https://auth.x.ai/oauth2/authorize",
tokenUrl: "https://auth.x.ai/oauth2/token",
scope: "openid profile email offline_access grok-cli:access api:access",
codeChallengeMethod: "S256",
loopbackPort: 56121,
callbackPath: "/callback",
callbackHost: "127.0.0.1",
};
// Openference OAuth Configuration (Authorization Code Flow with PKCE)
export const OPENFERENCE_CONFIG = {
clientId: resolvePublicCred("openference_id"),
authorizeUrl: "https://openference.com/app/oauth/authorize",
tokenUrl: "https://openference.com/oauth/token",
userinfoUrl: "https://openference.com/oauth/userinfo",
scope: "openid profile email model:invoke offline_access",
codeChallengeMethod: "S256",
loopbackPort: 56123,
callbackPath: "/callback",
callbackHost: "127.0.0.1",
};
// Muse Code (Meta) OAuth — RFC 8628 device grant + subscription key mint.
// Public CLI client id (Muse Code CLI); PKCE is not used on this grant.
export const MUSE_CODE_CONFIG = {
clientId: resolvePublicCred("muse_id", "MUSE_CODE_OAUTH_CLIENT_ID"),
deviceCodeUrl: "https://auth.meta.com/oidc/device/authorization/",
tokenUrl: "https://auth.meta.com/oidc/device/token/",
mintUrl: "https://api.meta.ai/muse-code/key",
};
// Kimi Coding OAuth Configuration (Device Code Flow)
export const KIMI_CODING_CONFIG = {
clientId: resolvePublicCred("kimi_id", "KIMI_CODING_OAUTH_CLIENT_ID"),
deviceCodeUrl: "https://auth.kimi.com/api/oauth/device_authorization",
tokenUrl: "https://auth.kimi.com/api/oauth/token",
};
// KiloCode OAuth Configuration (Custom Device Auth Flow)
export const KILOCODE_CONFIG = {
apiBaseUrl: "https://api.kilo.ai",
initiateUrl: "https://api.kilo.ai/api/device-auth/codes",
pollUrlBase: "https://api.kilo.ai/api/device-auth/codes",
};
// Cline OAuth Configuration (Local Callback Flow via app.cline.bot)
export const CLINE_CONFIG = {
appBaseUrl: "https://app.cline.bot",
apiBaseUrl: "https://api.cline.bot",
authorizeUrl: "https://api.cline.bot/api/v1/auth/authorize",
tokenExchangeUrl: "https://api.cline.bot/api/v1/auth/token",
refreshUrl: "https://api.cline.bot/api/v1/auth/refresh",
};
// Antigravity OAuth Configuration (Standard OAuth2 with Google)
// clientId/clientSecret are public values shipped in the Antigravity CLI;
// resolved through resolvePublicCred so they don't appear as literals here.
export const ANTIGRAVITY_CONFIG = {
clientId: resolvePublicCred("antigravity_id", "ANTIGRAVITY_OAUTH_CLIENT_ID"),
clientSecret: resolvePublicCred("antigravity_alt", "ANTIGRAVITY_OAUTH_CLIENT_SECRET"),
authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth",
tokenUrl: "https://oauth2.googleapis.com/token",
userInfoUrl: "https://www.googleapis.com/oauth2/v1/userinfo",
// No "openid" scope — the working 9router flow requests only the Cloud Code /
// userinfo scopes below. "openid" (with PKCE) routed Google into the hanging
// `firstparty/nativeapp` consent. Match 9router exactly (antigravity login fix).
scopes: [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/cclog",
"https://www.googleapis.com/auth/experimentsandconfigs",
],
// Antigravity specific
apiEndpoint: ANTIGRAVITY_RUNTIME_BASE_URLS[0],
apiVersion: "v1internal",
loadCodeAssistEndpoints: ANTIGRAVITY_BOOTSTRAP_BASE_URLS.map(
(baseUrl) => `${baseUrl}/v1internal:loadCodeAssist`
),
onboardUserEndpoints: ANTIGRAVITY_BOOTSTRAP_BASE_URLS.map(
(baseUrl) => `${baseUrl}/v1internal:onboardUser`
),
fetchAvailableModelsEndpoints: getAntigravityFetchAvailableModelsUrls(),
loadCodeAssistEndpoint: `${ANTIGRAVITY_BOOTSTRAP_BASE_URLS[0]}/v1internal:loadCodeAssist`,
onboardUserEndpoint: `${ANTIGRAVITY_BOOTSTRAP_BASE_URLS[0]}/v1internal:onboardUser`,
fetchAvailableModelsEndpoint: getAntigravityFetchAvailableModelsUrls()[0],
};
// Antigravity CLI (`agy`) OAuth Configuration.
// `agy` is the standalone Antigravity CLI; it authenticates against the EXACT same Google
// consumer-OAuth client as ANTIGRAVITY_CONFIG (the client_id was verified byte-for-byte
// identical: 1071006060591-tmhssin2h21lcre235vtolojh4g403ep). It reuses the antigravity
// public credentials and Code Assist endpoints — no new embedded secret — and the same
// loopback-redirect browser flow (popup locally; paste-the-callback-URL on remote/headless),
// so the entire existing antigravity OAuth UI machinery applies unchanged.
export const AGY_CONFIG = {
clientId: resolvePublicCred("antigravity_id", "ANTIGRAVITY_OAUTH_CLIENT_ID"),
clientSecret: resolvePublicCred("antigravity_alt", "ANTIGRAVITY_OAUTH_CLIENT_SECRET"),
authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth",
tokenUrl: "https://oauth2.googleapis.com/token",
userInfoUrl: "https://www.googleapis.com/oauth2/v1/userinfo",
scopes: [...ANTIGRAVITY_CONFIG.scopes],
// Reuse the antigravity Code Assist endpoints (identical backend).
apiEndpoint: ANTIGRAVITY_CONFIG.apiEndpoint,
apiVersion: ANTIGRAVITY_CONFIG.apiVersion,
loadCodeAssistEndpoints: [...ANTIGRAVITY_CONFIG.loadCodeAssistEndpoints],
onboardUserEndpoints: [...ANTIGRAVITY_CONFIG.onboardUserEndpoints],
fetchAvailableModelsEndpoints: [...ANTIGRAVITY_CONFIG.fetchAvailableModelsEndpoints],
loadCodeAssistEndpoint: ANTIGRAVITY_CONFIG.loadCodeAssistEndpoint,
onboardUserEndpoint: ANTIGRAVITY_CONFIG.onboardUserEndpoint,
fetchAvailableModelsEndpoint: ANTIGRAVITY_CONFIG.fetchAvailableModelsEndpoint,
};
// OpenAI OAuth Configuration (Authorization Code Flow with PKCE)
// Re-uses CODEX_CONFIG.clientId to avoid duplication — same provider, different originator.
// IMPORTANT: same Auth0 backend as Codex → same multi-account session-takeover
// risk. `prompt: "login"` is mandatory to allow multiple OpenAI Native accounts
// on the same device. See CODEX_CONFIG above for the full explanation.
export const OPENAI_CONFIG = {
clientId: CODEX_CONFIG.clientId,
authorizeUrl: "https://auth.openai.com/oauth/authorize",
tokenUrl: "https://auth.openai.com/oauth/token",
scope: "openid profile email offline_access",
codeChallengeMethod: "S256",
extraParams: {
id_token_add_organizations: "true",
originator: "openai_native",
prompt: "login",
},
};
// GitHub Copilot OAuth Configuration (Device Code Flow)
export const GITHUB_CONFIG = {
clientId: resolvePublicCred("github_copilot_id", "GITHUB_OAUTH_CLIENT_ID"),
deviceCodeUrl: "https://github.com/login/device/code",
tokenUrl: "https://github.com/login/oauth/access_token",
userInfoUrl: "https://api.github.com/user",
scopes: "read:user",
apiVersion: GITHUB_COPILOT_API_VERSION,
copilotTokenUrl: "https://api.github.com/copilot_internal/v2/token",
userAgent: GITHUB_COPILOT_CHAT_USER_AGENT,
editorVersion: GITHUB_COPILOT_EDITOR_VERSION,
editorPluginVersion: GITHUB_COPILOT_CHAT_PLUGIN_VERSION,
};
// GitHub Enterprise (GHE) Copilot OAuth Configuration (Device Code Flow)
export const GHE_COPILOT_CONFIG = {
clientId:
process.env.GHE_COPILOT_OAUTH_CLIENT_ID ||
resolvePublicCred("github_copilot_id", "GITHUB_OAUTH_CLIENT_ID"),
deviceCodeUrl: "", // Derived dynamically in provider flow
tokenUrl: "", // Derived dynamically in provider flow
userInfoUrl: "", // Derived dynamically in provider flow
scopes: "read:user",
apiVersion: GITHUB_COPILOT_API_VERSION,
copilotTokenUrl: "", // Derived dynamically in provider flow
userAgent: GITHUB_COPILOT_CHAT_USER_AGENT,
editorVersion: GITHUB_COPILOT_EDITOR_VERSION,
editorPluginVersion: GITHUB_COPILOT_CHAT_PLUGIN_VERSION,
};
const GITLAB_DUO_ENDPOINTS = buildGitLabOAuthEndpoints(GITLAB_DUO_DEFAULT_BASE_URL);
export const GITLAB_DUO_CONFIG = {
baseUrl: GITLAB_DUO_ENDPOINTS.root,
clientId: process.env.GITLAB_DUO_OAUTH_CLIENT_ID || process.env.GITLAB_OAUTH_CLIENT_ID || "",
clientSecret:
process.env.GITLAB_DUO_OAUTH_CLIENT_SECRET || process.env.GITLAB_OAUTH_CLIENT_SECRET || "",
authorizeUrl: GITLAB_DUO_ENDPOINTS.authorizeUrl,
tokenUrl: GITLAB_DUO_ENDPOINTS.tokenUrl,
userInfoUrl: GITLAB_DUO_ENDPOINTS.userUrl,
directAccessUrl: GITLAB_DUO_ENDPOINTS.directAccessUrl,
scope: "ai_features read_user",
codeChallengeMethod: "S256",
};
// AWS region allowlist — prevents SSRF via region injection into upstream URLs
// (GHSA-6mwv-4mrm-5p3m). Region values flow user-supplied through the kiro OAuth
// import surfaces (request body, providerSpecificData) and are interpolated into
// URLs like `https://oidc.${region}.amazonaws.com/...`. Without this guard, a
// region like "127.0.0.1" or "evil.com" would redirect the proxy's outbound
// fetch to an attacker-controlled host. Canonical AWS region shape only:
// two letters, dash, one-or-more letters, dash, one-or-two digits.
export const AWS_REGION_PATTERN = /^[a-z]{2}-[a-z]+-\d{1,2}$/;
export function assertValidAwsRegion(region: string): string {
if (typeof region !== "string" || !AWS_REGION_PATTERN.test(region)) {
throw new Error("Invalid region");
}
return region;
}
// Kiro OAuth Configuration
// Supports multiple auth methods:
// 1. AWS Builder ID (Device Code Flow)
// 2. AWS IAM Identity Center/IDC (Device Code Flow with custom startUrl/region)
// 3. Google/GitHub Social Login (Authorization Code Flow - manual callback)
// 4. Import Token (paste refresh token from Kiro IDE)
export const KIRO_CONFIG = {
// AWS SSO OIDC endpoints for Builder ID/IDC (Device Code Flow)
ssoOidcEndpoint: "https://oidc.us-east-1.amazonaws.com",
registerClientUrl: "https://oidc.us-east-1.amazonaws.com/client/register",
deviceAuthUrl: "https://oidc.us-east-1.amazonaws.com/device_authorization",
tokenUrl: "https://oidc.us-east-1.amazonaws.com/token",
// AWS Builder ID default start URL
startUrl: "https://view.awsapps.com/start",
// Client registration params
clientName: "kiro-oauth-client",
clientType: "public",
scopes: ["codewhisperer:completions", "codewhisperer:analysis", "codewhisperer:conversations"],
grantTypes: ["urn:ietf:params:oauth:grant-type:device_code", "refresh_token"],
issuerUrl: "https://identitycenter.amazonaws.com/ssoins-722374e8c3c8e6c6",
// Social auth endpoints (Google/GitHub via AWS Cognito)
socialAuthEndpoint: "https://prod.us-east-1.auth.desktop.kiro.dev",
socialLoginUrl: "https://prod.us-east-1.auth.desktop.kiro.dev/login",
socialTokenUrl: "https://prod.us-east-1.auth.desktop.kiro.dev/oauth/token",
socialRefreshUrl: "https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",
// Social device-code flow (Google/GitHub).
// `socialClientId` is a public CLI identifier — Kiro's device endpoint accepts
// any non-empty string and behaves like a User-Agent rather than a secret.
// The env override exists so operators on locked-down builds can pin a
// custom value if AWS ever starts enforcing this field (Hard Rule #11 spirit).
socialClientId: process.env.KIRO_OAUTH_CLIENT_ID || "kiro-cli",
socialDeviceAuthorizeUrl:
"https://prod.us-east-1.auth.desktop.kiro.dev/oauth/device/authorization",
socialDevicePollUrl: "https://prod.us-east-1.auth.desktop.kiro.dev/oauth/device/poll",
// Auth methods
authMethods: ["builder-id", "idc", "google", "github", "import"],
};
// Cursor OAuth Configuration (deep-control PKCE + optional IDE import)
// Cursor stores credentials in SQLite database: state.vscdb
// Keys: cursorAuth/accessToken, cursorAuth/refreshToken, storage.serviceMachineId
// Deep-control PKCE + refresh aligned with OpenCodex (lidge-jun/opencodex src/oauth/cursor.ts).
// clientVersion pin lives in open-sse/utils/cursorAgentCliVersionPin.ts — single source of truth.
export const CURSOR_CONFIG = {
// API endpoints
apiEndpoint: "https://api2.cursor.sh",
chatEndpoint: "/aiserver.v1.ChatService/StreamUnifiedChatWithTools",
modelsEndpoint: "/aiserver.v1.AiService/AvailableModels",
// Standalone deep-control login (no IDE/CLI required)
loginUrl: "https://cursor.com/loginDeepControl",
pollUrl: "https://api2.cursor.sh/auth/poll",
refreshUrl: "https://api2.cursor.sh/auth/exchange_user_api_key",
// Additional endpoints
api3Endpoint: "https://api3.cursor.sh", // Telemetry
agentEndpoint: "https://agent.api5.cursor.sh", // Privacy mode
agentNonPrivacyEndpoint: "https://agentn.api5.cursor.sh", // Non-privacy mode
// Client metadata — pin from cursorAgentCliVersion (not a second hardcoded string)
clientVersion: CURSOR_AGENT_CLI_VERSION,
clientType: "ide",
// Token storage locations (for user reference)
tokenStoragePaths: {
linux: "~/.config/Cursor/User/globalStorage/state.vscdb",
macos: "/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",
windows: "%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb",
},
// Database keys
dbKeys: {
accessToken: "cursorAuth/accessToken",
refreshToken: "cursorAuth/refreshToken",
machineId: "storage.serviceMachineId",
},
};
// Trae IDE Configuration (#2658)
//
// Trae is an AI-native IDE by ByteDance. Authentication is currently imported
// token only — users sign in inside Trae and paste the resulting API token
// here. ByteDance has not published a public OAuth client_id/secret or a CLI
// with extractable credentials, so no automated discovery is possible yet.
// If ByteDance ever publishes a public device-code or PKCE flow, swap
// flowType in src/lib/oauth/providers/trae.ts and wire endpoints below.
export const TRAE_CONFIG = {
apiEndpoint: "https://api.trae.ai",
clientType: "ide",
tokenStoragePaths: {
linux: "~/.config/Trae/User/globalStorage/state.vscdb",
macos: "/Users/<user>/Library/Application Support/Trae/User/globalStorage/state.vscdb",
windows: "%APPDATA%\\Trae\\User\\globalStorage\\state.vscdb",
},
// Chat completions path (mirrored from OpenAI-compatible providers)
chatEndpoint: "/v1/chat/completions",
// Trae website — users retrieve their token here after signing in
webUrl: "https://trae.ai",
// SOLO remote agent base — the executor's real upstream. Also set as the
// provider registry baseUrl, which is the source of truth at request time.
soloApiEndpoint: "https://core-normal.trae.ai/api/remote/v1",
// SOLO model catalogue endpoint (relative to soloApiEndpoint).
modelsEndpoint: "/models?functions=solo_agent_remote,solo_work_remote",
// Authorization scheme: `Authorization: Cloud-IDE-JWT <token>` (RS256).
authScheme: "Cloud-IDE-JWT",
// Observed Cloud-IDE-JWT lifetime — drives default expiry hints.
tokenLifetimeDays: 14,
// Token storage note — solo.trae.ai exposes no public SQLite/keychain path,
// so the token is captured via the /authorize flow or pasted manually.
tokenNote:
"Authorize via trae.ai in the popup, or sign in to solo.trae.ai and paste the Cloud-IDE-JWT from the Authorization header (~14-day lifetime).",
};
// Devin Desktop / Devin CLI import-token configuration.
// Public product identity is Devin. The upstream transport still identifies
// the IDE as `windsurf`; authentication itself is import-only.
export const DEVIN_DESKTOP_CONFIG = {
apiServerUrl: "https://server.codeium.com",
inferenceUrl: "https://inference.codeium.com",
ideName: "windsurf",
defaultVersion: "3.6.27",
};
// Zed IDE credential import — no standard OAuth flow.
// Credentials are extracted from the OS keychain via POST /api/providers/zed/import.
// Docker environments fall back to manual token paste via POST /api/providers/zed/manual-import.
// This config is a placeholder so that getProvider("zed") doesn't throw
// "Unknown provider: zed" when the UI probes the OAuth capability endpoint.
export const ZED_CONFIG = {
importUrl: "/api/providers/zed/import",
discoverUrl: "/api/providers/zed/discover",
manualImportUrl: "/api/providers/zed/manual-import",
};
// Zed Hosted Models Configuration (native-app RSA-keypair sign-in)
//
// Zed's cloud aggregator (cloud.zed.dev) does not use a registered OAuth
// client_id/secret. The client generates a fresh RSA keypair per login
// attempt and sends the public key to zed.dev/native_app_signin; Zed
// encrypts the resulting access token against that public key and redirects
// the browser to a local "native app" callback
// (http://127.0.0.1:<port>/?user_id=...&access_token=...). OmniRoute decrypts
// the token with the matching private key — see open-sse/shared/zedAuth.ts.
// No client_id/secret/Firebase key is embedded here (Hard Rule #11 does not
// apply — there is no upstream secret to embed).
export const ZED_HOSTED_CONFIG = {
webBaseUrl: "https://zed.dev",
cloudBaseUrl: "https://cloud.zed.dev",
llmBaseUrl: "https://cloud.zed.dev",
nativeSignInPath: "/native_app_signin",
userInfoUrl: "https://cloud.zed.dev/client/users/me",
llmTokenUrl: "https://cloud.zed.dev/client/llm_tokens",
modelsUrl: "https://cloud.zed.dev/models",
completionsUrl: "https://cloud.zed.dev/completions",
defaultNativeAppPort: 58443,
};
// OAuth timeout (5 minutes)
export const OAUTH_TIMEOUT = 300000;
// Provider list
export const PROVIDERS = {
CLAUDE: "claude",
CODEX: "codex",
GEMINI: "gemini",
QODER: "qoder",
ANTIGRAVITY: "antigravity",
AGY: "agy",
KIMI_CODING: "kimi-coding",
OPENAI: "openai",
GITHUB: "github",
GHE_COPILOT: "ghe-copilot",
GITLAB_DUO: "gitlab-duo",
KIRO: "kiro",
AMAZON_Q: "amazon-q",
CURSOR: "cursor",
KILOCODE: "kilocode",
CLINE: "cline",
CLINEPASS: "clinepass",
DEVIN_DESKTOP: "devin-desktop",
DEVIN_CLI: "devin-cli",
TRAE: "trae",
CODEBUDDY_CN: "codebuddy-cn",
CODEBUDDY_INTL: "codebuddy-intl",
WORKBUDDY: "workbuddy",
GROK_CLI: "grok-cli",
XAI_OAUTH: "xai-oauth",
OPENFERENCE: "openference",
ZED: "zed",
ZED_HOSTED: "zed-hosted",
MUSE_CODE: "muse-code",
};