mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
feat(grok-cli): add Grok CLI / Grok Build provider with OAuth device-code flow (#2502)
New OAuth provider routing through cli-chat-proxy.grok.com (OpenAI Responses
API), distinct from xai (api.x.ai) and grok-web (cookie SSO):
- Registry + GrokCliExecutor: Chat Completions -> Responses transform, CLI
fingerprint headers, virtual effort models grok-4.5-{low,medium,high}
- OAuth device-code flow (auth.x.ai) with no-PKCE, shared xAI token refresh
- store=false multi-turn continuity via reasoning encrypted_content
- Quota tracker: on-demand window + prepaid balance on dashboard
- Connection test: 402 spending-limit = soft success (auth OK, out of credits)
- Alias/oauth/provider baselines + unit tests
This commit is contained in:
committed by
decolua
parent
c73c419d09
commit
a11937cdd6
@@ -66,6 +66,10 @@
|
||||
"vertex-partner": "vertex-partner",
|
||||
"gw": "grok-web",
|
||||
"grok-web": "grok-web",
|
||||
"gcli": "grok-cli",
|
||||
"gb": "grok-cli",
|
||||
"grok-build": "grok-cli",
|
||||
"grok-cli": "grok-cli",
|
||||
"pw": "perplexity-web",
|
||||
"perplexity-web": "perplexity-web",
|
||||
"mimo": "xiaomi-mimo",
|
||||
@@ -104,6 +108,7 @@
|
||||
"chutes": "chutes",
|
||||
"claude": "cc",
|
||||
"cline": "cl",
|
||||
"clinepass": "clinepass",
|
||||
"cloudflare-ai": "cloudflare-ai",
|
||||
"codebuddy-cn": "cbcn",
|
||||
"codex": "cx",
|
||||
@@ -119,11 +124,13 @@
|
||||
"gitlab": "gitlab",
|
||||
"glm": "glm",
|
||||
"glm-cn": "glm-cn",
|
||||
"grok-cli": "gcli",
|
||||
"grok-web": "grok-web",
|
||||
"groq": "groq",
|
||||
"hyperbolic": "hyperbolic",
|
||||
"iflow": "if",
|
||||
"kilocode": "kc",
|
||||
"kimchi": "kimchi",
|
||||
"kimi": "kimi",
|
||||
"kimi-coding": "kmc",
|
||||
"kiro": "kr",
|
||||
@@ -147,6 +154,7 @@
|
||||
"qwen": "qw",
|
||||
"siliconflow": "siliconflow",
|
||||
"together": "together",
|
||||
"venice": "venice",
|
||||
"vercel-ai-gateway": "vercel-ai-gateway",
|
||||
"vertex": "vertex",
|
||||
"vertex-partner": "vertex-partner",
|
||||
@@ -168,6 +176,7 @@
|
||||
"cc",
|
||||
"cerebras",
|
||||
"cl",
|
||||
"clinepass",
|
||||
"cloudflare-ai",
|
||||
"cohere",
|
||||
"comfyui",
|
||||
@@ -181,6 +190,7 @@
|
||||
"fal-ai",
|
||||
"fireworks",
|
||||
"gc",
|
||||
"gcli",
|
||||
"gemini",
|
||||
"gemini-tts-models",
|
||||
"gemini-tts-voices",
|
||||
@@ -194,6 +204,7 @@
|
||||
"hyperbolic",
|
||||
"if",
|
||||
"kc",
|
||||
"kimchi",
|
||||
"kimi",
|
||||
"kmc",
|
||||
"kr",
|
||||
@@ -224,6 +235,7 @@
|
||||
"siliconflow",
|
||||
"stability-ai",
|
||||
"together",
|
||||
"venice",
|
||||
"vertex",
|
||||
"vertex-partner",
|
||||
"volcengine-ark",
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
"auth": "https://api.anthropic.com/v1/oauth/authorize"
|
||||
},
|
||||
"qwen": {
|
||||
"token": "https://qwen.ai/api/v1/oauth2/token",
|
||||
"auth": "https://qwen.ai/api/v1/oauth2/device/code"
|
||||
"token": "https://chat.qwen.ai/api/v1/oauth2/token",
|
||||
"auth": "https://chat.qwen.ai/api/v1/oauth2/device/code"
|
||||
},
|
||||
"iflow": {
|
||||
"token": "https://iflow.cn/oauth/token",
|
||||
@@ -33,24 +33,25 @@
|
||||
"iflow": "https://iflow.cn/oauth/token",
|
||||
"kiro": "https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",
|
||||
"xai": "https://auth.x.ai/oauth2/token",
|
||||
"grok-cli": "https://auth.x.ai/oauth2/token",
|
||||
"cline": "https://api.cline.bot/api/v1/auth/token",
|
||||
"kimi-coding": "https://auth.kimi.com/api/oauth/token"
|
||||
},
|
||||
"authUrls": {
|
||||
"qwen": "https://chat.qwen.ai/api/v1/oauth2/device/code",
|
||||
"iflow": "https://iflow.cn/oauth",
|
||||
"kiro": "https://prod.us-east-1.auth.desktop.kiro.dev"
|
||||
},
|
||||
"refreshUrls": {
|
||||
"cline": "https://api.cline.bot/api/v1/auth/refresh",
|
||||
"kimi-coding": "https://auth.kimi.com/api/oauth/token",
|
||||
"xai": "https://auth.x.ai/oauth2/token"
|
||||
"xai": "https://auth.x.ai/oauth2/token",
|
||||
"grok-cli": "https://auth.x.ai/oauth2/token"
|
||||
},
|
||||
"clientIds": {
|
||||
"claude": "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
|
||||
"codex": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"qwen": "f0304373b74a44d2b584a3fb70ca9e56",
|
||||
"iflow": "10009311001",
|
||||
"kimi-coding": "17e5f671-d194-4dfb-9706-5516cb48c098"
|
||||
"kimi-coding": "17e5f671-d194-4dfb-9706-5516cb48c098",
|
||||
"grok-cli": "b1a00492-073a-47ea-816f-4c329264a828"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,8 @@ const ALIAS_TOKENS = [
|
||||
"mistral","pplx","perplexity","together","fireworks","cerebras","cohere","nvidia","nebius",
|
||||
"siliconflow","hyp","hyperbolic","dg","deepgram","aai","assemblyai","nb","nanobanana","ch",
|
||||
"chutes","ark","volcengine-ark","byteplus","bpm","cursor","vx","vertex","vxp","vertex-partner",
|
||||
"gw","grok-web","pw","perplexity-web","mimo","xiaomi-mimo","xmtp","xiaomi-tokenplan","cf",
|
||||
"gw","grok-web","gcli","gb","grok-build","grok-cli","pw","perplexity-web","mimo","xiaomi-mimo",
|
||||
"xmtp","xiaomi-tokenplan","cf",
|
||||
"cloudflare-ai","fal","fal-ai","stability","stability-ai","bfl","black-forest-labs","recraft",
|
||||
"topaz","runway","runwayml","jina","jina-ai","polly","aws-polly","bb","blackbox",
|
||||
];
|
||||
|
||||
@@ -19,6 +19,8 @@ const resolved = {
|
||||
iflow: PROVIDERS.iflow?.tokenUrl,
|
||||
kiro: PROVIDERS.kiro?.tokenUrl,
|
||||
xai: PROVIDERS.xai?.tokenUrl,
|
||||
// Grok CLI injects oauth.tokenUrl onto PROVIDERS via OAUTH_INJECT_FIELDS
|
||||
"grok-cli": PROVIDERS["grok-cli"]?.tokenUrl,
|
||||
cline: PROVIDERS.cline?.tokenUrl,
|
||||
"kimi-coding": PROVIDERS["kimi-coding"]?.tokenUrl,
|
||||
},
|
||||
@@ -31,6 +33,7 @@ const resolved = {
|
||||
cline: PROVIDERS.cline?.refreshUrl,
|
||||
"kimi-coding": PROVIDERS["kimi-coding"]?.refreshUrl,
|
||||
xai: PROVIDERS.xai?.refreshUrl,
|
||||
"grok-cli": PROVIDERS["grok-cli"]?.tokenUrl,
|
||||
},
|
||||
clientIds: {
|
||||
claude: PROVIDERS.claude?.clientId,
|
||||
@@ -38,6 +41,7 @@ const resolved = {
|
||||
qwen: PROVIDERS.qwen?.clientId,
|
||||
iflow: PROVIDERS.iflow?.clientId,
|
||||
"kimi-coding": PROVIDERS["kimi-coding"]?.clientId,
|
||||
"grok-cli": PROVIDERS["grok-cli"]?.clientId,
|
||||
},
|
||||
};
|
||||
const current = JSON.parse(JSON.stringify(resolved));
|
||||
|
||||
Reference in New Issue
Block a user