@earendil-works/pi-ai 0.80.8 → 0.80.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/api/openai-completions.d.ts +2 -1
  2. package/dist/api/openai-completions.d.ts.map +1 -1
  3. package/dist/api/openai-completions.js +42 -2
  4. package/dist/api/openai-completions.js.map +1 -1
  5. package/dist/auth/helpers.d.ts +1 -0
  6. package/dist/auth/helpers.d.ts.map +1 -1
  7. package/dist/auth/helpers.js +1 -0
  8. package/dist/auth/helpers.js.map +1 -1
  9. package/dist/auth/oauth/xai.d.ts.map +1 -1
  10. package/dist/auth/oauth/xai.js +6 -1
  11. package/dist/auth/oauth/xai.js.map +1 -1
  12. package/dist/auth/types.d.ts +2 -0
  13. package/dist/auth/types.d.ts.map +1 -1
  14. package/dist/auth/types.js.map +1 -1
  15. package/dist/models.generated.d.ts +151 -0
  16. package/dist/models.generated.d.ts.map +1 -1
  17. package/dist/providers/kimi-coding.models.d.ts +20 -0
  18. package/dist/providers/kimi-coding.models.d.ts.map +1 -1
  19. package/dist/providers/kimi-coding.models.js +18 -0
  20. package/dist/providers/kimi-coding.models.js.map +1 -1
  21. package/dist/providers/moonshotai-cn.models.d.ts +36 -0
  22. package/dist/providers/moonshotai-cn.models.d.ts.map +1 -1
  23. package/dist/providers/moonshotai-cn.models.js +19 -0
  24. package/dist/providers/moonshotai-cn.models.js.map +1 -1
  25. package/dist/providers/moonshotai.models.d.ts +36 -0
  26. package/dist/providers/moonshotai.models.d.ts.map +1 -1
  27. package/dist/providers/moonshotai.models.js +19 -0
  28. package/dist/providers/moonshotai.models.js.map +1 -1
  29. package/dist/providers/openrouter.models.d.ts +42 -0
  30. package/dist/providers/openrouter.models.d.ts.map +1 -1
  31. package/dist/providers/openrouter.models.js +46 -10
  32. package/dist/providers/openrouter.models.js.map +1 -1
  33. package/dist/providers/vercel-ai-gateway.models.d.ts +17 -0
  34. package/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
  35. package/dist/providers/vercel-ai-gateway.models.js +17 -0
  36. package/dist/providers/vercel-ai-gateway.models.js.map +1 -1
  37. package/dist/providers/xai.d.ts.map +1 -1
  38. package/dist/providers/xai.js +5 -1
  39. package/dist/providers/xai.js.map +1 -1
  40. package/dist/types.d.ts +2 -0
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js.map +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"xai.js","sourceRoot":"","sources":["../../../src/auth/oauth/xai.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAC7D,MAAM,SAAS,GAAG,gEAAgE,CAAC;AACnF,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,aAAa,GAAG,gCAAgC,CAAC;AACvD,4FAA4F;AAC5F,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACtC,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAkB5C,SAAS,cAAc,CAAC,IAAgB,EAAE,KAAa,EAAU;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AAAA,CACb;AAED,SAAS,cAAc,CAAC,IAAgB,EAAE,KAAa,EAAU;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;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,CAAC;AAAA,CACjE;AAED,MAAM,CAAC,MAAM,QAAQ,GAAc;IAClC,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC;IAE5E,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;QACxB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;IAAA,CACrC;CACD,CAAC","sourcesContent":["/**\n * xAI OAuth device-code flow.\n */\n\nimport type { AuthInteraction, OAuthAuth, OAuthCredential } from \"../types.ts\";\nimport { pollOAuthDeviceCodeFlow } from \"./device-code.ts\";\n\nconst XAI_CLIENT_ID = \"b1a00492-073a-47ea-816f-4c329264a828\";\nconst XAI_SCOPE = \"openid profile email offline_access grok-cli:access api:access\";\nconst XAI_DEVICE_CODE_URL = \"https://auth.x.ai/oauth2/device/code\";\nconst XAI_TOKEN_URL = \"https://auth.x.ai/oauth2/token\";\n// Refresh slightly before the reported expiry to avoid using a token that dies mid-request.\nconst REFRESH_SKEW_MS = 5 * 60 * 1000;\nconst DEFAULT_TOKEN_LIFETIME_SECONDS = 3600;\n\ntype JsonObject = Record<string, unknown>;\n\ntype OAuthHttpResponse = {\n\tok: boolean;\n\tstatus: number;\n\tbody: JsonObject;\n};\n\ntype XaiDeviceCode = {\n\tdeviceCode: string;\n\tuserCode: string;\n\tverificationUri: string;\n\tintervalSeconds?: number;\n\texpiresInSeconds: number;\n};\n\nfunction requiredString(body: JsonObject, field: string): string {\n\tconst value = body[field];\n\tif (typeof value !== \"string\" || value.length === 0) {\n\t\tthrow new Error(`Invalid xAI OAuth response field: ${field}`);\n\t}\n\treturn value;\n}\n\nfunction positiveNumber(body: JsonObject, field: string): number {\n\tconst value = body[field];\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(`Invalid xAI OAuth response field: ${field}`);\n\t}\n\treturn value;\n}\n\n// The verification URI is opened in the user's browser; force it to be an https URL\n// so a malicious response cannot make `open` launch something else.\nfunction validateVerificationUri(raw: string): string {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(raw);\n\t} catch {\n\t\tthrow new Error(\"Untrusted verification URI in xAI OAuth response\");\n\t}\n\tif (url.protocol !== \"https:\") {\n\t\tthrow new Error(\"Untrusted verification URI in xAI OAuth response\");\n\t}\n\treturn url.href;\n}\n\nasync function postForm(url: string, fields: Record<string, string>, signal?: AbortSignal): Promise<OAuthHttpResponse> {\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(url, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/json\",\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\n\t\t\t},\n\t\t\tbody: new URLSearchParams(fields),\n\t\t\tsignal,\n\t\t});\n\t} catch (error) {\n\t\tif (signal?.aborted) {\n\t\t\tthrow new Error(\"Login cancelled\");\n\t\t}\n\t\tthrow error;\n\t}\n\n\tlet body: JsonObject;\n\ttry {\n\t\tconst parsed = (await response.json()) as unknown;\n\t\tbody = parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? (parsed as JsonObject) : {};\n\t} catch {\n\t\tif (signal?.aborted) {\n\t\t\tthrow new Error(\"Login cancelled\");\n\t\t}\n\t\tthrow new Error(`xAI OAuth returned invalid JSON (HTTP ${response.status})`);\n\t}\n\treturn {\n\t\tok: response.ok,\n\t\tstatus: response.status,\n\t\tbody,\n\t};\n}\n\nfunction requestFailure(action: string, response: OAuthHttpResponse): Error {\n\tconst error = typeof response.body.error === \"string\" ? response.body.error : undefined;\n\tconst description =\n\t\ttypeof response.body.error_description === \"string\" ? response.body.error_description : undefined;\n\tconst detail = [error, description].filter(Boolean).join(\": \");\n\treturn new Error(`xAI OAuth ${action} failed (HTTP ${response.status})${detail ? `: ${detail}` : \"\"}`);\n}\n\nfunction parseDeviceCode(body: JsonObject): XaiDeviceCode {\n\t// RFC 8628 allows interval 0 (no minimum wait); fall back to the poller's\n\t// default instead of failing on non-positive or malformed values.\n\tconst interval = body.interval;\n\tconst intervalSeconds =\n\t\ttypeof interval === \"number\" && Number.isFinite(interval) && interval > 0 ? interval : undefined;\n\treturn {\n\t\tdeviceCode: requiredString(body, \"device_code\"),\n\t\tuserCode: requiredString(body, \"user_code\"),\n\t\tverificationUri: validateVerificationUri(requiredString(body, \"verification_uri\")),\n\t\tintervalSeconds,\n\t\texpiresInSeconds: positiveNumber(body, \"expires_in\"),\n\t};\n}\n\nfunction credentialsFromTokenResponse(body: JsonObject, previousRefreshToken?: string): OAuthCredential {\n\tconst access = requiredString(body, \"access_token\");\n\t// xAI may omit refresh_token on refresh when the token is not rotated.\n\tconst refresh =\n\t\tbody.refresh_token === undefined && previousRefreshToken\n\t\t\t? previousRefreshToken\n\t\t\t: requiredString(body, \"refresh_token\");\n\tconst expiresInSeconds =\n\t\tbody.expires_in === undefined ? DEFAULT_TOKEN_LIFETIME_SECONDS : positiveNumber(body, \"expires_in\");\n\treturn {\n\t\ttype: \"oauth\",\n\t\taccess,\n\t\trefresh,\n\t\texpires: Date.now() + expiresInSeconds * 1000 - REFRESH_SKEW_MS,\n\t};\n}\n\nasync function requestDeviceCode(signal?: AbortSignal): Promise<XaiDeviceCode> {\n\tconst response = await postForm(\n\t\tXAI_DEVICE_CODE_URL,\n\t\t{\n\t\t\tclient_id: XAI_CLIENT_ID,\n\t\t\tscope: XAI_SCOPE,\n\t\t\treferrer: \"pi\",\n\t\t},\n\t\tsignal,\n\t);\n\tif (!response.ok) {\n\t\tthrow requestFailure(\"device authorization\", response);\n\t}\n\treturn parseDeviceCode(response.body);\n}\n\nasync function pollForTokens(device: XaiDeviceCode, signal?: AbortSignal): Promise<OAuthCredential> {\n\treturn pollOAuthDeviceCodeFlow<OAuthCredential>({\n\t\tintervalSeconds: device.intervalSeconds,\n\t\texpiresInSeconds: device.expiresInSeconds,\n\t\twaitBeforeFirstPoll: true,\n\t\tsignal,\n\t\tpoll: async () => {\n\t\t\tconst response = await postForm(\n\t\t\t\tXAI_TOKEN_URL,\n\t\t\t\t{\n\t\t\t\t\tgrant_type: \"urn:ietf:params:oauth:grant-type:device_code\",\n\t\t\t\t\tclient_id: XAI_CLIENT_ID,\n\t\t\t\t\tdevice_code: device.deviceCode,\n\t\t\t\t},\n\t\t\t\tsignal,\n\t\t\t);\n\n\t\t\tif (response.ok) {\n\t\t\t\treturn { status: \"complete\", value: credentialsFromTokenResponse(response.body) };\n\t\t\t}\n\n\t\t\tconst error = response.body.error;\n\t\t\tif (error === \"authorization_pending\") {\n\t\t\t\treturn { status: \"pending\" };\n\t\t\t}\n\t\t\tif (error === \"slow_down\") {\n\t\t\t\tconst interval = response.body.interval;\n\t\t\t\treturn { status: \"slow_down\", intervalSeconds: typeof interval === \"number\" ? interval : undefined };\n\t\t\t}\n\t\t\tif (error === \"access_denied\" || error === \"authorization_denied\") {\n\t\t\t\treturn { status: \"failed\", message: \"xAI device authorization was denied\" };\n\t\t\t}\n\t\t\tif (error === \"expired_token\") {\n\t\t\t\treturn { status: \"failed\", message: \"xAI device code expired\" };\n\t\t\t}\n\t\t\treturn { status: \"failed\", message: requestFailure(\"device token polling\", response).message };\n\t\t},\n\t});\n}\n\nasync function loginXai(interaction: AuthInteraction): Promise<OAuthCredential> {\n\tconst device = await requestDeviceCode(interaction.signal);\n\tinteraction.notify({\n\t\ttype: \"device_code\",\n\t\tuserCode: device.userCode,\n\t\tverificationUri: device.verificationUri,\n\t\tintervalSeconds: device.intervalSeconds,\n\t\texpiresInSeconds: device.expiresInSeconds,\n\t});\n\treturn pollForTokens(device, interaction.signal);\n}\n\nasync function refreshXaiToken(refreshToken: string, signal?: AbortSignal): Promise<OAuthCredential> {\n\tconst response = await postForm(\n\t\tXAI_TOKEN_URL,\n\t\t{\n\t\t\tgrant_type: \"refresh_token\",\n\t\t\tclient_id: XAI_CLIENT_ID,\n\t\t\trefresh_token: refreshToken,\n\t\t},\n\t\tsignal,\n\t);\n\tif (!response.ok) {\n\t\tthrow requestFailure(\"token refresh\", response);\n\t}\n\treturn credentialsFromTokenResponse(response.body, refreshToken);\n}\n\nexport const xaiOAuth: OAuthAuth = {\n\tname: \"xAI (Grok/X subscription)\",\n\tlogin: loginXai,\n\trefresh: (credential, signal) => refreshXaiToken(credential.refresh, signal),\n\n\tasync toAuth(credential) {\n\t\treturn { apiKey: credential.access };\n\t},\n};\n"]}
1
+ {"version":3,"file":"xai.js","sourceRoot":"","sources":["../../../src/auth/oauth/xai.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAC7D,MAAM,SAAS,GAAG,gEAAgE,CAAC;AACnF,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,aAAa,GAAG,gCAAgC,CAAC;AACvD,4FAA4F;AAC5F,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACtC,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAmB5C,SAAS,cAAc,CAAC,IAAgB,EAAE,KAAa,EAAU;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AAAA,CACb;AAED,SAAS,cAAc,CAAC,IAAgB,EAAE,KAAa,EAAU;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,E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Ae;QAC3B,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,YAAY;KAC3B,EACD,MAAM,CACN,CAAC;IACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QAClB,MAAM,cAAc,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,4BAA4B,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAAA,CACjE;AAED,MAAM,CAAC,MAAM,QAAQ,GAAc;IAClC,IAAI,EAAE,2BAA2B;IACjC,UAAU,EAAE,qCAAqC;IACjD,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC;IAE5E,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;QACxB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;IAAA,CACrC;CACD,CAAC","sourcesContent":["/**\n * xAI OAuth device-code flow.\n */\n\nimport type { AuthInteraction, OAuthAuth, OAuthCredential } from \"../types.ts\";\nimport { pollOAuthDeviceCodeFlow } from \"./device-code.ts\";\n\nconst XAI_CLIENT_ID = \"b1a00492-073a-47ea-816f-4c329264a828\";\nconst XAI_SCOPE = \"openid profile email offline_access grok-cli:access api:access\";\nconst XAI_DEVICE_CODE_URL = \"https://auth.x.ai/oauth2/device/code\";\nconst XAI_TOKEN_URL = \"https://auth.x.ai/oauth2/token\";\n// Refresh slightly before the reported expiry to avoid using a token that dies mid-request.\nconst REFRESH_SKEW_MS = 5 * 60 * 1000;\nconst DEFAULT_TOKEN_LIFETIME_SECONDS = 3600;\n\ntype JsonObject = Record<string, unknown>;\n\ntype OAuthHttpResponse = {\n\tok: boolean;\n\tstatus: number;\n\tbody: JsonObject;\n};\n\ntype XaiDeviceCode = {\n\tdeviceCode: string;\n\tuserCode: string;\n\tverificationUri: string;\n\tverificationUriComplete?: string;\n\tintervalSeconds?: number;\n\texpiresInSeconds: number;\n};\n\nfunction requiredString(body: JsonObject, field: string): string {\n\tconst value = body[field];\n\tif (typeof value !== \"string\" || value.length === 0) {\n\t\tthrow new Error(`Invalid xAI OAuth response field: ${field}`);\n\t}\n\treturn value;\n}\n\nfunction positiveNumber(body: JsonObject, field: string): number {\n\tconst value = body[field];\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(`Invalid xAI OAuth response field: ${field}`);\n\t}\n\treturn value;\n}\n\n// The verification URI is opened in the user's browser; force it to be an https URL\n// so a malicious response cannot make `open` launch something else.\nfunction validateVerificationUri(raw: string): string {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(raw);\n\t} catch {\n\t\tthrow new Error(\"Untrusted verification URI in xAI OAuth response\");\n\t}\n\tif (url.protocol !== \"https:\") {\n\t\tthrow new Error(\"Untrusted verification URI in xAI OAuth response\");\n\t}\n\treturn url.href;\n}\n\nasync function postForm(url: string, fields: Record<string, string>, signal?: AbortSignal): Promise<OAuthHttpResponse> {\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(url, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/json\",\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\n\t\t\t},\n\t\t\tbody: new URLSearchParams(fields),\n\t\t\tsignal,\n\t\t});\n\t} catch (error) {\n\t\tif (signal?.aborted) {\n\t\t\tthrow new Error(\"Login cancelled\");\n\t\t}\n\t\tthrow error;\n\t}\n\n\tlet body: JsonObject;\n\ttry {\n\t\tconst parsed = (await response.json()) as unknown;\n\t\tbody = parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? (parsed as JsonObject) : {};\n\t} catch {\n\t\tif (signal?.aborted) {\n\t\t\tthrow new Error(\"Login cancelled\");\n\t\t}\n\t\tthrow new Error(`xAI OAuth returned invalid JSON (HTTP ${response.status})`);\n\t}\n\treturn {\n\t\tok: response.ok,\n\t\tstatus: response.status,\n\t\tbody,\n\t};\n}\n\nfunction requestFailure(action: string, response: OAuthHttpResponse): Error {\n\tconst error = typeof response.body.error === \"string\" ? response.body.error : undefined;\n\tconst description =\n\t\ttypeof response.body.error_description === \"string\" ? response.body.error_description : undefined;\n\tconst detail = [error, description].filter(Boolean).join(\": \");\n\treturn new Error(`xAI OAuth ${action} failed (HTTP ${response.status})${detail ? `: ${detail}` : \"\"}`);\n}\n\nfunction parseDeviceCode(body: JsonObject): XaiDeviceCode {\n\t// RFC 8628 allows interval 0 (no minimum wait); fall back to the poller's\n\t// default instead of failing on non-positive or malformed values.\n\tconst interval = body.interval;\n\tconst intervalSeconds =\n\t\ttypeof interval === \"number\" && Number.isFinite(interval) && interval > 0 ? interval : undefined;\n\tconst verificationUriComplete =\n\t\ttypeof body.verification_uri_complete === \"string\" && body.verification_uri_complete.length > 0\n\t\t\t? validateVerificationUri(body.verification_uri_complete)\n\t\t\t: undefined;\n\treturn {\n\t\tdeviceCode: requiredString(body, \"device_code\"),\n\t\tuserCode: requiredString(body, \"user_code\"),\n\t\tverificationUri: validateVerificationUri(requiredString(body, \"verification_uri\")),\n\t\tverificationUriComplete,\n\t\tintervalSeconds,\n\t\texpiresInSeconds: positiveNumber(body, \"expires_in\"),\n\t};\n}\n\nfunction credentialsFromTokenResponse(body: JsonObject, previousRefreshToken?: string): OAuthCredential {\n\tconst access = requiredString(body, \"access_token\");\n\t// xAI may omit refresh_token on refresh when the token is not rotated.\n\tconst refresh =\n\t\tbody.refresh_token === undefined && previousRefreshToken\n\t\t\t? previousRefreshToken\n\t\t\t: requiredString(body, \"refresh_token\");\n\tconst expiresInSeconds =\n\t\tbody.expires_in === undefined ? DEFAULT_TOKEN_LIFETIME_SECONDS : positiveNumber(body, \"expires_in\");\n\treturn {\n\t\ttype: \"oauth\",\n\t\taccess,\n\t\trefresh,\n\t\texpires: Date.now() + expiresInSeconds * 1000 - REFRESH_SKEW_MS,\n\t};\n}\n\nasync function requestDeviceCode(signal?: AbortSignal): Promise<XaiDeviceCode> {\n\tconst response = await postForm(\n\t\tXAI_DEVICE_CODE_URL,\n\t\t{\n\t\t\tclient_id: XAI_CLIENT_ID,\n\t\t\tscope: XAI_SCOPE,\n\t\t\treferrer: \"pi\",\n\t\t},\n\t\tsignal,\n\t);\n\tif (!response.ok) {\n\t\tthrow requestFailure(\"device authorization\", response);\n\t}\n\treturn parseDeviceCode(response.body);\n}\n\nasync function pollForTokens(device: XaiDeviceCode, signal?: AbortSignal): Promise<OAuthCredential> {\n\treturn pollOAuthDeviceCodeFlow<OAuthCredential>({\n\t\tintervalSeconds: device.intervalSeconds,\n\t\texpiresInSeconds: device.expiresInSeconds,\n\t\twaitBeforeFirstPoll: true,\n\t\tsignal,\n\t\tpoll: async () => {\n\t\t\tconst response = await postForm(\n\t\t\t\tXAI_TOKEN_URL,\n\t\t\t\t{\n\t\t\t\t\tgrant_type: \"urn:ietf:params:oauth:grant-type:device_code\",\n\t\t\t\t\tclient_id: XAI_CLIENT_ID,\n\t\t\t\t\tdevice_code: device.deviceCode,\n\t\t\t\t},\n\t\t\t\tsignal,\n\t\t\t);\n\n\t\t\tif (response.ok) {\n\t\t\t\treturn { status: \"complete\", value: credentialsFromTokenResponse(response.body) };\n\t\t\t}\n\n\t\t\tconst error = response.body.error;\n\t\t\tif (error === \"authorization_pending\") {\n\t\t\t\treturn { status: \"pending\" };\n\t\t\t}\n\t\t\tif (error === \"slow_down\") {\n\t\t\t\tconst interval = response.body.interval;\n\t\t\t\treturn { status: \"slow_down\", intervalSeconds: typeof interval === \"number\" ? interval : undefined };\n\t\t\t}\n\t\t\tif (error === \"access_denied\" || error === \"authorization_denied\") {\n\t\t\t\treturn { status: \"failed\", message: \"xAI device authorization was denied\" };\n\t\t\t}\n\t\t\tif (error === \"expired_token\") {\n\t\t\t\treturn { status: \"failed\", message: \"xAI device code expired\" };\n\t\t\t}\n\t\t\treturn { status: \"failed\", message: requestFailure(\"device token polling\", response).message };\n\t\t},\n\t});\n}\n\nasync function loginXai(interaction: AuthInteraction): Promise<OAuthCredential> {\n\tconst device = await requestDeviceCode(interaction.signal);\n\tinteraction.notify({\n\t\ttype: \"device_code\",\n\t\tuserCode: device.userCode,\n\t\tverificationUri: device.verificationUriComplete ?? device.verificationUri,\n\t\tintervalSeconds: device.intervalSeconds,\n\t\texpiresInSeconds: device.expiresInSeconds,\n\t});\n\treturn pollForTokens(device, interaction.signal);\n}\n\nasync function refreshXaiToken(refreshToken: string, signal?: AbortSignal): Promise<OAuthCredential> {\n\tconst response = await postForm(\n\t\tXAI_TOKEN_URL,\n\t\t{\n\t\t\tgrant_type: \"refresh_token\",\n\t\t\tclient_id: XAI_CLIENT_ID,\n\t\t\trefresh_token: refreshToken,\n\t\t},\n\t\tsignal,\n\t);\n\tif (!response.ok) {\n\t\tthrow requestFailure(\"token refresh\", response);\n\t}\n\treturn credentialsFromTokenResponse(response.body, refreshToken);\n}\n\nexport const xaiOAuth: OAuthAuth = {\n\tname: \"xAI (Grok/X subscription)\",\n\tloginLabel: \"Sign in with SuperGrok or X Premium\",\n\tlogin: loginXai,\n\trefresh: (credential, signal) => refreshXaiToken(credential.refresh, signal),\n\n\tasync toAuth(credential) {\n\t\treturn { apiKey: credential.access };\n\t},\n};\n"]}
@@ -192,6 +192,8 @@ export interface ApiKeyAuth {
192
192
  export interface OAuthAuth {
193
193
  /** Display name, e.g. "Anthropic (Claude Pro/Max)". */
194
194
  name: string;
195
+ /** Selector label for the subscription login option, e.g. "Sign in with SuperGrok or X Premium". */
196
+ loginLabel?: string;
195
197
  login(interaction: AuthInteraction): Promise<OAuthCredential>;
196
198
  /**
197
199
  * Exchange the refresh token. Network call; throws on failure
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAA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W,CAAC;QAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACrG;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9D;;;OAGG;IACH,OAAO,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAErF;;;;OAIG;IACH,MAAM,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CAClB","sourcesContent":["import type { ProviderEnv, ProviderHeaders } from \"../types.ts\";\n\n/**\n * Request auth for a single model request. If a value cannot be expressed as\n * `apiKey`, `headers`, or `baseUrl`, it is provider config, not auth.\n */\nexport interface ModelAuth {\n\tapiKey?: string;\n\theaders?: ProviderHeaders;\n\tbaseUrl?: string;\n}\n\n/**\n * Stored api-key credential. `env` holds provider-scoped environment/config\n * values such as Cloudflare account/gateway ids.\n */\nexport interface ApiKeyCredential {\n\ttype: \"api_key\";\n\tkey?: string;\n\tenv?: ProviderEnv;\n}\n\n/** OAuth token data returned by extension compatibility flows. */\nexport interface OAuthCredentials {\n\trefresh: string;\n\taccess: string;\n\texpires: number;\n\t[key: string]: unknown;\n}\n\n/** Stored canonical OAuth credential. */\nexport interface OAuthCredential extends OAuthCredentials {\n\ttype: \"oauth\";\n}\n\n/** One type-tagged credential per provider — the shape of today's auth.json. */\nexport type Credential = ApiKeyCredential | OAuthCredential;\n\n/** Non-secret credential metadata for account/status enumeration. */\nexport interface CredentialInfo {\n\tproviderId: string;\n\ttype: Credential[\"type\"];\n}\n\n/**\n * App-owned credential storage, keyed by `Provider.id`, one credential per\n * provider. `modify` is the only write path, so every mutation is a\n * serialized read-modify-write; `Models.getAuth()` runs OAuth refresh inside\n * `modify` so concurrent requests cannot double-refresh a rotated token. The\n * app persists a credential after login via\n * `modify(provider.id, async () => credential)`. Login/logout orchestration\n * is app-owned.\n *\n * Error semantics: `read` resolves `undefined` for missing entries. Methods\n * reject only on storage failure; `Models` wraps such rejections in\n * `ModelsError` with code \"auth\". Best-effort stores that serve an in-memory\n * view and record persistence errors internally (like coding-agent's\n * AuthStorage) are valid implementations.\n */\nexport interface CredentialStore {\n\t/**\n\t * Read the stored credential, possibly expired. Display/status use;\n\t * resolved request auth comes from `Models.getAuth()`.\n\t */\n\tread(providerId: string): Promise<Credential | undefined>;\n\n\t/**\n\t * List stored credential metadata without resolving or exposing secrets.\n\t * Implementations must not execute configured API-key commands while listing.\n\t */\n\tlist(): Promise<readonly CredentialInfo[]>;\n\n\t/**\n\t * Serialized write — the only write path. `fn` sees the current credential\n\t * because correct writes (refresh, login-during-refresh) depend on it;\n\t * return the new credential, or undefined to leave the entry unchanged.\n\t * Mutual exclusion per provider id, cross-process too where the backing\n\t * store supports it (e.g. a file lock). Resolves with the post-write\n\t * credential. Rejections from `fn` propagate.\n\t */\n\tmodify(\n\t\tproviderId: string,\n\t\tfn: (current: Credential | undefined) => Promise<Credential | undefined>,\n\t): Promise<Credential | undefined>;\n\n\t/** Remove a credential (logout). Implementations serialize this against `modify`. */\n\tdelete(providerId: string): Promise<void>;\n}\n\n/** Environment access for auth resolution. Injectable for tests and browsers. */\nexport interface AuthContext {\n\tenv(name: string): Promise<string | undefined>;\n\t/** Check whether a file exists. Supports a leading `~`. Always false in browsers. */\n\tfileExists(path: string): Promise<boolean>;\n}\n\n/** Result of resolving auth for a model. */\nexport interface AuthResult {\n\tauth: ModelAuth;\n\t/** Provider-scoped environment/config values resolved from credentials and ambient context. */\n\tenv?: ProviderEnv;\n\t/** Human-readable label for status UI: \"ANTHROPIC_API_KEY\", \"OAuth\", \"~/.aws/credentials\". */\n\tsource?: string;\n}\n\nexport interface AuthCheck {\n\tsource?: string;\n\ttype: \"api_key\" | \"oauth\";\n}\n\nexport type AuthType = \"api_key\" | \"oauth\";\n\n/**\n * Prompt shown to the user during login. `signal` lets the flow cancel a\n * pending prompt when an out-of-band event resolves the step, e.g. a\n * `manual_code` prompt raced against a callback server, aborted when the\n * callback wins.\n */\nexport type AuthPrompt = { signal?: AbortSignal } & (\n\t| { type: \"text\"; message: string; placeholder?: string }\n\t| { type: \"secret\"; message: string; placeholder?: string }\n\t| { type: \"select\"; message: string; options: readonly { id: string; label: string; description?: string }[] }\n\t| { type: \"manual_code\"; message: string; placeholder?: string }\n);\n\nexport interface AuthInfoLink {\n\turl: string;\n\tlabel?: string;\n}\n\nexport type AuthEvent =\n\t| { type: \"info\"; message: string; links?: readonly AuthInfoLink[] }\n\t| { type: \"auth_url\"; url: string; instructions?: string }\n\t| {\n\t\t\ttype: \"device_code\";\n\t\t\tuserCode: string;\n\t\t\tverificationUri: string;\n\t\t\tintervalSeconds?: number;\n\t\t\texpiresInSeconds?: number;\n\t }\n\t| { type: \"progress\"; message: string };\n\n/**\n * Login interaction callbacks serving both api-key and OAuth flows.\n *\n * `prompt()` returns the entered/selected string (`select` returns the option\n * id). Rejects on cancel/abort. `signal` aborts the whole login flow;\n * per-prompt cancellation uses `AuthPrompt.signal`.\n */\nexport interface AuthInteraction {\n\tsignal?: AbortSignal;\n\n\tprompt(prompt: AuthPrompt): Promise<string>;\n\tnotify(event: AuthEvent): void;\n}\n\n/**\n * Api-key auth: stored key/provider env plus ambient sources (env vars, AWS\n * profiles, ADC files). Ambient-only providers omit `login`.\n */\nexport interface ApiKeyAuth {\n\t/** Display name, e.g. \"Anthropic API key\". */\n\tname: string;\n\n\t/** Interactive setup (prompt for key/provider env). Absent = ambient-only. */\n\tlogin?(interaction: AuthInteraction): Promise<ApiKeyCredential>;\n\n\t/**\n\t * Optional side-effect-free availability check. Use this when `resolve()` may\n\t * execute commands or perform other request-time work. Missing means Models\n\t * checks availability by resolving auth.\n\t */\n\tcheck?(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthCheck | undefined>;\n\n\t/**\n\t * Resolve auth from the stored credential and/or ambient sources, merging\n\t * per field (`credential.key ?? env(\"...\")`, `credential.env?.NAME ?? env(\"...\")`).\n\t * undefined = not configured. Resolution is provider-scoped; model-specific\n\t * endpoint preparation happens after auth has been resolved.\n\t */\n\tresolve(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthResult | undefined>;\n}\n\n/**\n * OAuth auth. The `refresh`/`toAuth` split lets `Models` own the locked\n * refresh pattern: `refresh` produces a credential, `toAuth` derives request\n * auth from whatever credential ends up stored.\n */\nexport interface OAuthAuth {\n\t/** Display name, e.g. \"Anthropic (Claude Pro/Max)\". */\n\tname: string;\n\n\tlogin(interaction: AuthInteraction): Promise<OAuthCredential>;\n\n\t/**\n\t * Exchange the refresh token. Network call; throws on failure\n\t * (invalid_grant etc.). `Models` runs this under the store lock.\n\t */\n\trefresh(credential: OAuthCredential, signal?: AbortSignal): Promise<OAuthCredential>;\n\n\t/**\n\t * Side-effect-free derivation of request auth from a valid credential.\n\t * Covers per-credential baseUrl (GitHub Copilot). Async so lazy wrappers\n\t * can load the implementation on first use.\n\t */\n\ttoAuth(credential: OAuthCredential): Promise<ModelAuth>;\n}\n\n/**\n * Provider auth. At least one of `apiKey`/`oauth` must be present: even\n * ambient-credential providers and keyless local servers provide `apiKey`\n * auth whose `resolve()` reports whether the provider is configured.\n */\nexport interface ProviderAuth {\n\tapiKey?: ApiKeyAuth;\n\toauth?: OAuthAuth;\n}\n"]}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE;;;GAGG;AACH,MAAM,W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AAW,CAAC;QAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACrG;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IAEb,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9D;;;OAGG;IACH,OAAO,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAErF;;;;OAIG;IACH,MAAM,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CAClB","sourcesContent":["import type { ProviderEnv, ProviderHeaders } from \"../types.ts\";\n\n/**\n * Request auth for a single model request. If a value cannot be expressed as\n * `apiKey`, `headers`, or `baseUrl`, it is provider config, not auth.\n */\nexport interface ModelAuth {\n\tapiKey?: string;\n\theaders?: ProviderHeaders;\n\tbaseUrl?: string;\n}\n\n/**\n * Stored api-key credential. `env` holds provider-scoped environment/config\n * values such as Cloudflare account/gateway ids.\n */\nexport interface ApiKeyCredential {\n\ttype: \"api_key\";\n\tkey?: string;\n\tenv?: ProviderEnv;\n}\n\n/** OAuth token data returned by extension compatibility flows. */\nexport interface OAuthCredentials {\n\trefresh: string;\n\taccess: string;\n\texpires: number;\n\t[key: string]: unknown;\n}\n\n/** Stored canonical OAuth credential. */\nexport interface OAuthCredential extends OAuthCredentials {\n\ttype: \"oauth\";\n}\n\n/** One type-tagged credential per provider — the shape of today's auth.json. */\nexport type Credential = ApiKeyCredential | OAuthCredential;\n\n/** Non-secret credential metadata for account/status enumeration. */\nexport interface CredentialInfo {\n\tproviderId: string;\n\ttype: Credential[\"type\"];\n}\n\n/**\n * App-owned credential storage, keyed by `Provider.id`, one credential per\n * provider. `modify` is the only write path, so every mutation is a\n * serialized read-modify-write; `Models.getAuth()` runs OAuth refresh inside\n * `modify` so concurrent requests cannot double-refresh a rotated token. The\n * app persists a credential after login via\n * `modify(provider.id, async () => credential)`. Login/logout orchestration\n * is app-owned.\n *\n * Error semantics: `read` resolves `undefined` for missing entries. Methods\n * reject only on storage failure; `Models` wraps such rejections in\n * `ModelsError` with code \"auth\". Best-effort stores that serve an in-memory\n * view and record persistence errors internally (like coding-agent's\n * AuthStorage) are valid implementations.\n */\nexport interface CredentialStore {\n\t/**\n\t * Read the stored credential, possibly expired. Display/status use;\n\t * resolved request auth comes from `Models.getAuth()`.\n\t */\n\tread(providerId: string): Promise<Credential | undefined>;\n\n\t/**\n\t * List stored credential metadata without resolving or exposing secrets.\n\t * Implementations must not execute configured API-key commands while listing.\n\t */\n\tlist(): Promise<readonly CredentialInfo[]>;\n\n\t/**\n\t * Serialized write — the only write path. `fn` sees the current credential\n\t * because correct writes (refresh, login-during-refresh) depend on it;\n\t * return the new credential, or undefined to leave the entry unchanged.\n\t * Mutual exclusion per provider id, cross-process too where the backing\n\t * store supports it (e.g. a file lock). Resolves with the post-write\n\t * credential. Rejections from `fn` propagate.\n\t */\n\tmodify(\n\t\tproviderId: string,\n\t\tfn: (current: Credential | undefined) => Promise<Credential | undefined>,\n\t): Promise<Credential | undefined>;\n\n\t/** Remove a credential (logout). Implementations serialize this against `modify`. */\n\tdelete(providerId: string): Promise<void>;\n}\n\n/** Environment access for auth resolution. Injectable for tests and browsers. */\nexport interface AuthContext {\n\tenv(name: string): Promise<string | undefined>;\n\t/** Check whether a file exists. Supports a leading `~`. Always false in browsers. */\n\tfileExists(path: string): Promise<boolean>;\n}\n\n/** Result of resolving auth for a model. */\nexport interface AuthResult {\n\tauth: ModelAuth;\n\t/** Provider-scoped environment/config values resolved from credentials and ambient context. */\n\tenv?: ProviderEnv;\n\t/** Human-readable label for status UI: \"ANTHROPIC_API_KEY\", \"OAuth\", \"~/.aws/credentials\". */\n\tsource?: string;\n}\n\nexport interface AuthCheck {\n\tsource?: string;\n\ttype: \"api_key\" | \"oauth\";\n}\n\nexport type AuthType = \"api_key\" | \"oauth\";\n\n/**\n * Prompt shown to the user during login. `signal` lets the flow cancel a\n * pending prompt when an out-of-band event resolves the step, e.g. a\n * `manual_code` prompt raced against a callback server, aborted when the\n * callback wins.\n */\nexport type AuthPrompt = { signal?: AbortSignal } & (\n\t| { type: \"text\"; message: string; placeholder?: string }\n\t| { type: \"secret\"; message: string; placeholder?: string }\n\t| { type: \"select\"; message: string; options: readonly { id: string; label: string; description?: string }[] }\n\t| { type: \"manual_code\"; message: string; placeholder?: string }\n);\n\nexport interface AuthInfoLink {\n\turl: string;\n\tlabel?: string;\n}\n\nexport type AuthEvent =\n\t| { type: \"info\"; message: string; links?: readonly AuthInfoLink[] }\n\t| { type: \"auth_url\"; url: string; instructions?: string }\n\t| {\n\t\t\ttype: \"device_code\";\n\t\t\tuserCode: string;\n\t\t\tverificationUri: string;\n\t\t\tintervalSeconds?: number;\n\t\t\texpiresInSeconds?: number;\n\t }\n\t| { type: \"progress\"; message: string };\n\n/**\n * Login interaction callbacks serving both api-key and OAuth flows.\n *\n * `prompt()` returns the entered/selected string (`select` returns the option\n * id). Rejects on cancel/abort. `signal` aborts the whole login flow;\n * per-prompt cancellation uses `AuthPrompt.signal`.\n */\nexport interface AuthInteraction {\n\tsignal?: AbortSignal;\n\n\tprompt(prompt: AuthPrompt): Promise<string>;\n\tnotify(event: AuthEvent): void;\n}\n\n/**\n * Api-key auth: stored key/provider env plus ambient sources (env vars, AWS\n * profiles, ADC files). Ambient-only providers omit `login`.\n */\nexport interface ApiKeyAuth {\n\t/** Display name, e.g. \"Anthropic API key\". */\n\tname: string;\n\n\t/** Interactive setup (prompt for key/provider env). Absent = ambient-only. */\n\tlogin?(interaction: AuthInteraction): Promise<ApiKeyCredential>;\n\n\t/**\n\t * Optional side-effect-free availability check. Use this when `resolve()` may\n\t * execute commands or perform other request-time work. Missing means Models\n\t * checks availability by resolving auth.\n\t */\n\tcheck?(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthCheck | undefined>;\n\n\t/**\n\t * Resolve auth from the stored credential and/or ambient sources, merging\n\t * per field (`credential.key ?? env(\"...\")`, `credential.env?.NAME ?? env(\"...\")`).\n\t * undefined = not configured. Resolution is provider-scoped; model-specific\n\t * endpoint preparation happens after auth has been resolved.\n\t */\n\tresolve(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthResult | undefined>;\n}\n\n/**\n * OAuth auth. The `refresh`/`toAuth` split lets `Models` own the locked\n * refresh pattern: `refresh` produces a credential, `toAuth` derives request\n * auth from whatever credential ends up stored.\n */\nexport interface OAuthAuth {\n\t/** Display name, e.g. \"Anthropic (Claude Pro/Max)\". */\n\tname: string;\n\n\t/** Selector label for the subscription login option, e.g. \"Sign in with SuperGrok or X Premium\". */\n\tloginLabel?: string;\n\n\tlogin(interaction: AuthInteraction): Promise<OAuthCredential>;\n\n\t/**\n\t * Exchange the refresh token. Network call; throws on failure\n\t * (invalid_grant etc.). `Models` runs this under the store lock.\n\t */\n\trefresh(credential: OAuthCredential, signal?: AbortSignal): Promise<OAuthCredential>;\n\n\t/**\n\t * Side-effect-free derivation of request auth from a valid credential.\n\t * Covers per-credential baseUrl (GitHub Copilot). Async so lazy wrappers\n\t * can load the implementation on first use.\n\t */\n\ttoAuth(credential: OAuthCredential): Promise<ModelAuth>;\n}\n\n/**\n * Provider auth. At least one of `apiKey`/`oauth` must be present: even\n * ambient-credential providers and keyless local servers provide `apiKey`\n * auth whose `resolve()` reports whether the provider is configured.\n */\nexport interface ProviderAuth {\n\tapiKey?: ApiKeyAuth;\n\toauth?: OAuthAuth;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ProviderEnv, ProviderHeaders } from \"../types.ts\";\n\n/**\n * Request auth for a single model request. If a value cannot be expressed as\n * `apiKey`, `headers`, or `baseUrl`, it is provider config, not auth.\n */\nexport interface ModelAuth {\n\tapiKey?: string;\n\theaders?: ProviderHeaders;\n\tbaseUrl?: string;\n}\n\n/**\n * Stored api-key credential. `env` holds provider-scoped environment/config\n * values such as Cloudflare account/gateway ids.\n */\nexport interface ApiKeyCredential {\n\ttype: \"api_key\";\n\tkey?: string;\n\tenv?: ProviderEnv;\n}\n\n/** OAuth token data returned by extension compatibility flows. */\nexport interface OAuthCredentials {\n\trefresh: string;\n\taccess: string;\n\texpires: number;\n\t[key: string]: unknown;\n}\n\n/** Stored canonical OAuth credential. */\nexport interface OAuthCredential extends OAuthCredentials {\n\ttype: \"oauth\";\n}\n\n/** One type-tagged credential per provider — the shape of today's auth.json. */\nexport type Credential = ApiKeyCredential | OAuthCredential;\n\n/** Non-secret credential metadata for account/status enumeration. */\nexport interface CredentialInfo {\n\tproviderId: string;\n\ttype: Credential[\"type\"];\n}\n\n/**\n * App-owned credential storage, keyed by `Provider.id`, one credential per\n * provider. `modify` is the only write path, so every mutation is a\n * serialized read-modify-write; `Models.getAuth()` runs OAuth refresh inside\n * `modify` so concurrent requests cannot double-refresh a rotated token. The\n * app persists a credential after login via\n * `modify(provider.id, async () => credential)`. Login/logout orchestration\n * is app-owned.\n *\n * Error semantics: `read` resolves `undefined` for missing entries. Methods\n * reject only on storage failure; `Models` wraps such rejections in\n * `ModelsError` with code \"auth\". Best-effort stores that serve an in-memory\n * view and record persistence errors internally (like coding-agent's\n * AuthStorage) are valid implementations.\n */\nexport interface CredentialStore {\n\t/**\n\t * Read the stored credential, possibly expired. Display/status use;\n\t * resolved request auth comes from `Models.getAuth()`.\n\t */\n\tread(providerId: string): Promise<Credential | undefined>;\n\n\t/**\n\t * List stored credential metadata without resolving or exposing secrets.\n\t * Implementations must not execute configured API-key commands while listing.\n\t */\n\tlist(): Promise<readonly CredentialInfo[]>;\n\n\t/**\n\t * Serialized write — the only write path. `fn` sees the current credential\n\t * because correct writes (refresh, login-during-refresh) depend on it;\n\t * return the new credential, or undefined to leave the entry unchanged.\n\t * Mutual exclusion per provider id, cross-process too where the backing\n\t * store supports it (e.g. a file lock). Resolves with the post-write\n\t * credential. Rejections from `fn` propagate.\n\t */\n\tmodify(\n\t\tproviderId: string,\n\t\tfn: (current: Credential | undefined) => Promise<Credential | undefined>,\n\t): Promise<Credential | undefined>;\n\n\t/** Remove a credential (logout). Implementations serialize this against `modify`. */\n\tdelete(providerId: string): Promise<void>;\n}\n\n/** Environment access for auth resolution. Injectable for tests and browsers. */\nexport interface AuthContext {\n\tenv(name: string): Promise<string | undefined>;\n\t/** Check whether a file exists. Supports a leading `~`. Always false in browsers. */\n\tfileExists(path: string): Promise<boolean>;\n}\n\n/** Result of resolving auth for a model. */\nexport interface AuthResult {\n\tauth: ModelAuth;\n\t/** Provider-scoped environment/config values resolved from credentials and ambient context. */\n\tenv?: ProviderEnv;\n\t/** Human-readable label for status UI: \"ANTHROPIC_API_KEY\", \"OAuth\", \"~/.aws/credentials\". */\n\tsource?: string;\n}\n\nexport interface AuthCheck {\n\tsource?: string;\n\ttype: \"api_key\" | \"oauth\";\n}\n\nexport type AuthType = \"api_key\" | \"oauth\";\n\n/**\n * Prompt shown to the user during login. `signal` lets the flow cancel a\n * pending prompt when an out-of-band event resolves the step, e.g. a\n * `manual_code` prompt raced against a callback server, aborted when the\n * callback wins.\n */\nexport type AuthPrompt = { signal?: AbortSignal } & (\n\t| { type: \"text\"; message: string; placeholder?: string }\n\t| { type: \"secret\"; message: string; placeholder?: string }\n\t| { type: \"select\"; message: string; options: readonly { id: string; label: string; description?: string }[] }\n\t| { type: \"manual_code\"; message: string; placeholder?: string }\n);\n\nexport interface AuthInfoLink {\n\turl: string;\n\tlabel?: string;\n}\n\nexport type AuthEvent =\n\t| { type: \"info\"; message: string; links?: readonly AuthInfoLink[] }\n\t| { type: \"auth_url\"; url: string; instructions?: string }\n\t| {\n\t\t\ttype: \"device_code\";\n\t\t\tuserCode: string;\n\t\t\tverificationUri: string;\n\t\t\tintervalSeconds?: number;\n\t\t\texpiresInSeconds?: number;\n\t }\n\t| { type: \"progress\"; message: string };\n\n/**\n * Login interaction callbacks serving both api-key and OAuth flows.\n *\n * `prompt()` returns the entered/selected string (`select` returns the option\n * id). Rejects on cancel/abort. `signal` aborts the whole login flow;\n * per-prompt cancellation uses `AuthPrompt.signal`.\n */\nexport interface AuthInteraction {\n\tsignal?: AbortSignal;\n\n\tprompt(prompt: AuthPrompt): Promise<string>;\n\tnotify(event: AuthEvent): void;\n}\n\n/**\n * Api-key auth: stored key/provider env plus ambient sources (env vars, AWS\n * profiles, ADC files). Ambient-only providers omit `login`.\n */\nexport interface ApiKeyAuth {\n\t/** Display name, e.g. \"Anthropic API key\". */\n\tname: string;\n\n\t/** Interactive setup (prompt for key/provider env). Absent = ambient-only. */\n\tlogin?(interaction: AuthInteraction): Promise<ApiKeyCredential>;\n\n\t/**\n\t * Optional side-effect-free availability check. Use this when `resolve()` may\n\t * execute commands or perform other request-time work. Missing means Models\n\t * checks availability by resolving auth.\n\t */\n\tcheck?(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthCheck | undefined>;\n\n\t/**\n\t * Resolve auth from the stored credential and/or ambient sources, merging\n\t * per field (`credential.key ?? env(\"...\")`, `credential.env?.NAME ?? env(\"...\")`).\n\t * undefined = not configured. Resolution is provider-scoped; model-specific\n\t * endpoint preparation happens after auth has been resolved.\n\t */\n\tresolve(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthResult | undefined>;\n}\n\n/**\n * OAuth auth. The `refresh`/`toAuth` split lets `Models` own the locked\n * refresh pattern: `refresh` produces a credential, `toAuth` derives request\n * auth from whatever credential ends up stored.\n */\nexport interface OAuthAuth {\n\t/** Display name, e.g. \"Anthropic (Claude Pro/Max)\". */\n\tname: string;\n\n\tlogin(interaction: AuthInteraction): Promise<OAuthCredential>;\n\n\t/**\n\t * Exchange the refresh token. Network call; throws on failure\n\t * (invalid_grant etc.). `Models` runs this under the store lock.\n\t */\n\trefresh(credential: OAuthCredential, signal?: AbortSignal): Promise<OAuthCredential>;\n\n\t/**\n\t * Side-effect-free derivation of request auth from a valid credential.\n\t * Covers per-credential baseUrl (GitHub Copilot). Async so lazy wrappers\n\t * can load the implementation on first use.\n\t */\n\ttoAuth(credential: OAuthCredential): Promise<ModelAuth>;\n}\n\n/**\n * Provider auth. At least one of `apiKey`/`oauth` must be present: even\n * ambient-credential providers and keyless local servers provide `apiKey`\n * auth whose `resolve()` reports whether the provider is configured.\n */\nexport interface ProviderAuth {\n\tapiKey?: ApiKeyAuth;\n\toauth?: OAuthAuth;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ProviderEnv, ProviderHeaders } from \"../types.ts\";\n\n/**\n * Request auth for a single model request. If a value cannot be expressed as\n * `apiKey`, `headers`, or `baseUrl`, it is provider config, not auth.\n */\nexport interface ModelAuth {\n\tapiKey?: string;\n\theaders?: ProviderHeaders;\n\tbaseUrl?: string;\n}\n\n/**\n * Stored api-key credential. `env` holds provider-scoped environment/config\n * values such as Cloudflare account/gateway ids.\n */\nexport interface ApiKeyCredential {\n\ttype: \"api_key\";\n\tkey?: string;\n\tenv?: ProviderEnv;\n}\n\n/** OAuth token data returned by extension compatibility flows. */\nexport interface OAuthCredentials {\n\trefresh: string;\n\taccess: string;\n\texpires: number;\n\t[key: string]: unknown;\n}\n\n/** Stored canonical OAuth credential. */\nexport interface OAuthCredential extends OAuthCredentials {\n\ttype: \"oauth\";\n}\n\n/** One type-tagged credential per provider — the shape of today's auth.json. */\nexport type Credential = ApiKeyCredential | OAuthCredential;\n\n/** Non-secret credential metadata for account/status enumeration. */\nexport interface CredentialInfo {\n\tproviderId: string;\n\ttype: Credential[\"type\"];\n}\n\n/**\n * App-owned credential storage, keyed by `Provider.id`, one credential per\n * provider. `modify` is the only write path, so every mutation is a\n * serialized read-modify-write; `Models.getAuth()` runs OAuth refresh inside\n * `modify` so concurrent requests cannot double-refresh a rotated token. The\n * app persists a credential after login via\n * `modify(provider.id, async () => credential)`. Login/logout orchestration\n * is app-owned.\n *\n * Error semantics: `read` resolves `undefined` for missing entries. Methods\n * reject only on storage failure; `Models` wraps such rejections in\n * `ModelsError` with code \"auth\". Best-effort stores that serve an in-memory\n * view and record persistence errors internally (like coding-agent's\n * AuthStorage) are valid implementations.\n */\nexport interface CredentialStore {\n\t/**\n\t * Read the stored credential, possibly expired. Display/status use;\n\t * resolved request auth comes from `Models.getAuth()`.\n\t */\n\tread(providerId: string): Promise<Credential | undefined>;\n\n\t/**\n\t * List stored credential metadata without resolving or exposing secrets.\n\t * Implementations must not execute configured API-key commands while listing.\n\t */\n\tlist(): Promise<readonly CredentialInfo[]>;\n\n\t/**\n\t * Serialized write — the only write path. `fn` sees the current credential\n\t * because correct writes (refresh, login-during-refresh) depend on it;\n\t * return the new credential, or undefined to leave the entry unchanged.\n\t * Mutual exclusion per provider id, cross-process too where the backing\n\t * store supports it (e.g. a file lock). Resolves with the post-write\n\t * credential. Rejections from `fn` propagate.\n\t */\n\tmodify(\n\t\tproviderId: string,\n\t\tfn: (current: Credential | undefined) => Promise<Credential | undefined>,\n\t): Promise<Credential | undefined>;\n\n\t/** Remove a credential (logout). Implementations serialize this against `modify`. */\n\tdelete(providerId: string): Promise<void>;\n}\n\n/** Environment access for auth resolution. Injectable for tests and browsers. */\nexport interface AuthContext {\n\tenv(name: string): Promise<string | undefined>;\n\t/** Check whether a file exists. Supports a leading `~`. Always false in browsers. */\n\tfileExists(path: string): Promise<boolean>;\n}\n\n/** Result of resolving auth for a model. */\nexport interface AuthResult {\n\tauth: ModelAuth;\n\t/** Provider-scoped environment/config values resolved from credentials and ambient context. */\n\tenv?: ProviderEnv;\n\t/** Human-readable label for status UI: \"ANTHROPIC_API_KEY\", \"OAuth\", \"~/.aws/credentials\". */\n\tsource?: string;\n}\n\nexport interface AuthCheck {\n\tsource?: string;\n\ttype: \"api_key\" | \"oauth\";\n}\n\nexport type AuthType = \"api_key\" | \"oauth\";\n\n/**\n * Prompt shown to the user during login. `signal` lets the flow cancel a\n * pending prompt when an out-of-band event resolves the step, e.g. a\n * `manual_code` prompt raced against a callback server, aborted when the\n * callback wins.\n */\nexport type AuthPrompt = { signal?: AbortSignal } & (\n\t| { type: \"text\"; message: string; placeholder?: string }\n\t| { type: \"secret\"; message: string; placeholder?: string }\n\t| { type: \"select\"; message: string; options: readonly { id: string; label: string; description?: string }[] }\n\t| { type: \"manual_code\"; message: string; placeholder?: string }\n);\n\nexport interface AuthInfoLink {\n\turl: string;\n\tlabel?: string;\n}\n\nexport type AuthEvent =\n\t| { type: \"info\"; message: string; links?: readonly AuthInfoLink[] }\n\t| { type: \"auth_url\"; url: string; instructions?: string }\n\t| {\n\t\t\ttype: \"device_code\";\n\t\t\tuserCode: string;\n\t\t\tverificationUri: string;\n\t\t\tintervalSeconds?: number;\n\t\t\texpiresInSeconds?: number;\n\t }\n\t| { type: \"progress\"; message: string };\n\n/**\n * Login interaction callbacks serving both api-key and OAuth flows.\n *\n * `prompt()` returns the entered/selected string (`select` returns the option\n * id). Rejects on cancel/abort. `signal` aborts the whole login flow;\n * per-prompt cancellation uses `AuthPrompt.signal`.\n */\nexport interface AuthInteraction {\n\tsignal?: AbortSignal;\n\n\tprompt(prompt: AuthPrompt): Promise<string>;\n\tnotify(event: AuthEvent): void;\n}\n\n/**\n * Api-key auth: stored key/provider env plus ambient sources (env vars, AWS\n * profiles, ADC files). Ambient-only providers omit `login`.\n */\nexport interface ApiKeyAuth {\n\t/** Display name, e.g. \"Anthropic API key\". */\n\tname: string;\n\n\t/** Interactive setup (prompt for key/provider env). Absent = ambient-only. */\n\tlogin?(interaction: AuthInteraction): Promise<ApiKeyCredential>;\n\n\t/**\n\t * Optional side-effect-free availability check. Use this when `resolve()` may\n\t * execute commands or perform other request-time work. Missing means Models\n\t * checks availability by resolving auth.\n\t */\n\tcheck?(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthCheck | undefined>;\n\n\t/**\n\t * Resolve auth from the stored credential and/or ambient sources, merging\n\t * per field (`credential.key ?? env(\"...\")`, `credential.env?.NAME ?? env(\"...\")`).\n\t * undefined = not configured. Resolution is provider-scoped; model-specific\n\t * endpoint preparation happens after auth has been resolved.\n\t */\n\tresolve(input: { ctx: AuthContext; credential?: ApiKeyCredential }): Promise<AuthResult | undefined>;\n}\n\n/**\n * OAuth auth. The `refresh`/`toAuth` split lets `Models` own the locked\n * refresh pattern: `refresh` produces a credential, `toAuth` derives request\n * auth from whatever credential ends up stored.\n */\nexport interface OAuthAuth {\n\t/** Display name, e.g. \"Anthropic (Claude Pro/Max)\". */\n\tname: string;\n\n\t/** Selector label for the subscription login option, e.g. \"Sign in with SuperGrok or X Premium\". */\n\tloginLabel?: string;\n\n\tlogin(interaction: AuthInteraction): Promise<OAuthCredential>;\n\n\t/**\n\t * Exchange the refresh token. Network call; throws on failure\n\t * (invalid_grant etc.). `Models` runs this under the store lock.\n\t */\n\trefresh(credential: OAuthCredential, signal?: AbortSignal): Promise<OAuthCredential>;\n\n\t/**\n\t * Side-effect-free derivation of request auth from a valid credential.\n\t * Covers per-credential baseUrl (GitHub Copilot). Async so lazy wrappers\n\t * can load the implementation on first use.\n\t */\n\ttoAuth(credential: OAuthCredential): Promise<ModelAuth>;\n}\n\n/**\n * Provider auth. At least one of `apiKey`/`oauth` must be present: even\n * ambient-credential providers and keyless local servers provide `apiKey`\n * auth whose `resolve()` reports whether the provider is configured.\n */\nexport interface ProviderAuth {\n\tapiKey?: ApiKeyAuth;\n\toauth?: OAuthAuth;\n}\n"]}
@@ -7387,6 +7387,26 @@ export declare const MODELS: {
7387
7387
  contextWindow: number;
7388
7388
  maxTokens: number;
7389
7389
  };
7390
+ readonly k3: {
7391
+ id: string;
7392
+ name: string;
7393
+ api: "anthropic-messages";
7394
+ provider: string;
7395
+ baseUrl: string;
7396
+ headers: {
7397
+ "User-Agent": string;
7398
+ };
7399
+ reasoning: true;
7400
+ input: ("image" | "text")[];
7401
+ cost: {
7402
+ input: number;
7403
+ output: number;
7404
+ cacheRead: number;
7405
+ cacheWrite: number;
7406
+ };
7407
+ contextWindow: number;
7408
+ maxTokens: number;
7409
+ };
7390
7410
  readonly "kimi-for-coding": {
7391
7411
  id: string;
7392
7412
  name: string;
@@ -8298,6 +8318,42 @@ export declare const MODELS: {
8298
8318
  contextWindow: number;
8299
8319
  maxTokens: number;
8300
8320
  };
8321
+ readonly "kimi-k3": {
8322
+ id: string;
8323
+ name: string;
8324
+ api: "openai-completions";
8325
+ provider: string;
8326
+ baseUrl: string;
8327
+ compat: {
8328
+ supportsStore: false;
8329
+ supportsDeveloperRole: false;
8330
+ supportsReasoningEffort: false;
8331
+ maxTokensField: "max_tokens";
8332
+ supportsStrictMode: false;
8333
+ thinkingFormat: "deepseek";
8334
+ requiresReasoningContentOnAssistantMessages: true;
8335
+ deferredToolsMode: "kimi";
8336
+ };
8337
+ reasoning: true;
8338
+ thinkingLevelMap: {
8339
+ off: null;
8340
+ minimal: null;
8341
+ low: null;
8342
+ medium: null;
8343
+ high: null;
8344
+ xhigh: null;
8345
+ max: string;
8346
+ };
8347
+ input: ("image" | "text")[];
8348
+ cost: {
8349
+ input: number;
8350
+ output: number;
8351
+ cacheRead: number;
8352
+ cacheWrite: number;
8353
+ };
8354
+ contextWindow: number;
8355
+ maxTokens: number;
8356
+ };
8301
8357
  };
8302
8358
  readonly "moonshotai-cn": {
8303
8359
  readonly "kimi-k2-0711-preview": {
@@ -8531,6 +8587,42 @@ export declare const MODELS: {
8531
8587
  contextWindow: number;
8532
8588
  maxTokens: number;
8533
8589
  };
8590
+ readonly "kimi-k3": {
8591
+ id: string;
8592
+ name: string;
8593
+ api: "openai-completions";
8594
+ provider: string;
8595
+ baseUrl: string;
8596
+ compat: {
8597
+ supportsStore: false;
8598
+ supportsDeveloperRole: false;
8599
+ supportsReasoningEffort: false;
8600
+ maxTokensField: "max_tokens";
8601
+ supportsStrictMode: false;
8602
+ thinkingFormat: "deepseek";
8603
+ requiresReasoningContentOnAssistantMessages: true;
8604
+ deferredToolsMode: "kimi";
8605
+ };
8606
+ reasoning: true;
8607
+ thinkingLevelMap: {
8608
+ off: null;
8609
+ minimal: null;
8610
+ low: null;
8611
+ medium: null;
8612
+ high: null;
8613
+ xhigh: null;
8614
+ max: string;
8615
+ };
8616
+ input: ("image" | "text")[];
8617
+ cost: {
8618
+ input: number;
8619
+ output: number;
8620
+ cacheRead: number;
8621
+ cacheWrite: number;
8622
+ };
8623
+ contextWindow: number;
8624
+ maxTokens: number;
8625
+ };
8534
8626
  };
8535
8627
  readonly nvidia: {
8536
8628
  readonly "meta/llama-3.1-70b-instruct": {
@@ -13453,6 +13545,27 @@ export declare const MODELS: {
13453
13545
  contextWindow: number;
13454
13546
  maxTokens: number;
13455
13547
  };
13548
+ readonly "meta/muse-spark-1.1": {
13549
+ id: string;
13550
+ name: string;
13551
+ api: "openai-completions";
13552
+ provider: string;
13553
+ baseUrl: string;
13554
+ compat: {
13555
+ supportsDeveloperRole: false;
13556
+ thinkingFormat: "openrouter";
13557
+ };
13558
+ reasoning: true;
13559
+ input: ("image" | "text")[];
13560
+ cost: {
13561
+ input: number;
13562
+ output: number;
13563
+ cacheRead: number;
13564
+ cacheWrite: number;
13565
+ };
13566
+ contextWindow: number;
13567
+ maxTokens: number;
13568
+ };
13456
13569
  readonly "minimax/minimax-m1": {
13457
13570
  id: string;
13458
13571
  name: string;
@@ -14063,6 +14176,27 @@ export declare const MODELS: {
14063
14176
  contextWindow: number;
14064
14177
  maxTokens: number;
14065
14178
  };
14179
+ readonly "moonshotai/kimi-k3": {
14180
+ id: string;
14181
+ name: string;
14182
+ api: "openai-completions";
14183
+ provider: string;
14184
+ baseUrl: string;
14185
+ compat: {
14186
+ supportsDeveloperRole: false;
14187
+ thinkingFormat: "openrouter";
14188
+ };
14189
+ reasoning: true;
14190
+ input: ("image" | "text")[];
14191
+ cost: {
14192
+ input: number;
14193
+ output: number;
14194
+ cacheRead: number;
14195
+ cacheWrite: number;
14196
+ };
14197
+ contextWindow: number;
14198
+ maxTokens: number;
14199
+ };
14066
14200
  readonly "nex-agi/nex-n2-mini": {
14067
14201
  id: string;
14068
14202
  name: string;
@@ -20042,6 +20176,23 @@ export declare const MODELS: {
20042
20176
  contextWindow: number;
20043
20177
  maxTokens: number;
20044
20178
  };
20179
+ readonly "moonshotai/kimi-k3": {
20180
+ id: string;
20181
+ name: string;
20182
+ api: "anthropic-messages";
20183
+ provider: string;
20184
+ baseUrl: string;
20185
+ reasoning: true;
20186
+ input: ("image" | "text")[];
20187
+ cost: {
20188
+ input: number;
20189
+ output: number;
20190
+ cacheRead: number;
20191
+ cacheWrite: number;
20192
+ };
20193
+ contextWindow: number;
20194
+ maxTokens: number;
20195
+ };
20045
20196
  readonly "nvidia/nemotron-3-nano-30b-a3b": {
20046
20197
  id: string;
20047
20198
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"models.generated.d.ts","sourceRoot":"","sources":["../src/models.generated.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCT,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport { AMAZON_BEDROCK_MODELS } from \"./providers/amazon-bedrock.models.ts\";\nimport { ANT_LING_MODELS } from \"./providers/ant-ling.models.ts\";\nimport { ANTHROPIC_MODELS } from \"./providers/anthropic.models.ts\";\nimport { AZURE_OPENAI_RESPONSES_MODELS } from \"./providers/azure-openai-responses.models.ts\";\nimport { CEREBRAS_MODELS } from \"./providers/cerebras.models.ts\";\nimport { CLOUDFLARE_AI_GATEWAY_MODELS } from \"./providers/cloudflare-ai-gateway.models.ts\";\nimport { CLOUDFLARE_WORKERS_AI_MODELS } from \"./providers/cloudflare-workers-ai.models.ts\";\nimport { DEEPSEEK_MODELS } from \"./providers/deepseek.models.ts\";\nimport { FIREWORKS_MODELS } from \"./providers/fireworks.models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./providers/github-copilot.models.ts\";\nimport { GOOGLE_MODELS } from \"./providers/google.models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./providers/google-vertex.models.ts\";\nimport { GROQ_MODELS } from \"./providers/groq.models.ts\";\nimport { HUGGINGFACE_MODELS } from \"./providers/huggingface.models.ts\";\nimport { KIMI_CODING_MODELS } from \"./providers/kimi-coding.models.ts\";\nimport { MINIMAX_MODELS } from \"./providers/minimax.models.ts\";\nimport { MINIMAX_CN_MODELS } from \"./providers/minimax-cn.models.ts\";\nimport { MISTRAL_MODELS } from \"./providers/mistral.models.ts\";\nimport { MOONSHOTAI_MODELS } from \"./providers/moonshotai.models.ts\";\nimport { MOONSHOTAI_CN_MODELS } from \"./providers/moonshotai-cn.models.ts\";\nimport { NVIDIA_MODELS } from \"./providers/nvidia.models.ts\";\nimport { OPENAI_MODELS } from \"./providers/openai.models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./providers/openai-codex.models.ts\";\nimport { OPENCODE_MODELS } from \"./providers/opencode.models.ts\";\nimport { OPENCODE_GO_MODELS } from \"./providers/opencode-go.models.ts\";\nimport { OPENROUTER_MODELS } from \"./providers/openrouter.models.ts\";\nimport { TOGETHER_MODELS } from \"./providers/together.models.ts\";\nimport { VERCEL_AI_GATEWAY_MODELS } from \"./providers/vercel-ai-gateway.models.ts\";\nimport { XAI_MODELS } from \"./providers/xai.models.ts\";\nimport { XIAOMI_MODELS } from \"./providers/xiaomi.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_AMS_MODELS } from \"./providers/xiaomi-token-plan-ams.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_CN_MODELS } from \"./providers/xiaomi-token-plan-cn.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_SGP_MODELS } from \"./providers/xiaomi-token-plan-sgp.models.ts\";\nimport { ZAI_MODELS } from \"./providers/zai.models.ts\";\nimport { ZAI_CODING_CN_MODELS } from \"./providers/zai-coding-cn.models.ts\";\n\nexport const MODELS = {\n\t\"amazon-bedrock\": AMAZON_BEDROCK_MODELS,\n\t\"ant-ling\": ANT_LING_MODELS,\n\t\"anthropic\": ANTHROPIC_MODELS,\n\t\"azure-openai-responses\": AZURE_OPENAI_RESPONSES_MODELS,\n\t\"cerebras\": CEREBRAS_MODELS,\n\t\"cloudflare-ai-gateway\": CLOUDFLARE_AI_GATEWAY_MODELS,\n\t\"cloudflare-workers-ai\": CLOUDFLARE_WORKERS_AI_MODELS,\n\t\"deepseek\": DEEPSEEK_MODELS,\n\t\"fireworks\": FIREWORKS_MODELS,\n\t\"github-copilot\": GITHUB_COPILOT_MODELS,\n\t\"google\": GOOGLE_MODELS,\n\t\"google-vertex\": GOOGLE_VERTEX_MODELS,\n\t\"groq\": GROQ_MODELS,\n\t\"huggingface\": HUGGINGFACE_MODELS,\n\t\"kimi-coding\": KIMI_CODING_MODELS,\n\t\"minimax\": MINIMAX_MODELS,\n\t\"minimax-cn\": MINIMAX_CN_MODELS,\n\t\"mistral\": MISTRAL_MODELS,\n\t\"moonshotai\": MOONSHOTAI_MODELS,\n\t\"moonshotai-cn\": MOONSHOTAI_CN_MODELS,\n\t\"nvidia\": NVIDIA_MODELS,\n\t\"openai\": OPENAI_MODELS,\n\t\"openai-codex\": OPENAI_CODEX_MODELS,\n\t\"opencode\": OPENCODE_MODELS,\n\t\"opencode-go\": OPENCODE_GO_MODELS,\n\t\"openrouter\": OPENROUTER_MODELS,\n\t\"together\": TOGETHER_MODELS,\n\t\"vercel-ai-gateway\": VERCEL_AI_GATEWAY_MODELS,\n\t\"xai\": XAI_MODELS,\n\t\"xiaomi\": XIAOMI_MODELS,\n\t\"xiaomi-token-plan-ams\": XIAOMI_TOKEN_PLAN_AMS_MODELS,\n\t\"xiaomi-token-plan-cn\": XIAOMI_TOKEN_PLAN_CN_MODELS,\n\t\"xiaomi-token-plan-sgp\": XIAOMI_TOKEN_PLAN_SGP_MODELS,\n\t\"zai\": ZAI_MODELS,\n\t\"zai-coding-cn\": ZAI_CODING_CN_MODELS,\n} as const;\n"]}
1
+ {"version":3,"file":"models.generated.d.ts","sourceRoot":"","sources":["../src/models.generated.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCT,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport { AMAZON_BEDROCK_MODELS } from \"./providers/amazon-bedrock.models.ts\";\nimport { ANT_LING_MODELS } from \"./providers/ant-ling.models.ts\";\nimport { ANTHROPIC_MODELS } from \"./providers/anthropic.models.ts\";\nimport { AZURE_OPENAI_RESPONSES_MODELS } from \"./providers/azure-openai-responses.models.ts\";\nimport { CEREBRAS_MODELS } from \"./providers/cerebras.models.ts\";\nimport { CLOUDFLARE_AI_GATEWAY_MODELS } from \"./providers/cloudflare-ai-gateway.models.ts\";\nimport { CLOUDFLARE_WORKERS_AI_MODELS } from \"./providers/cloudflare-workers-ai.models.ts\";\nimport { DEEPSEEK_MODELS } from \"./providers/deepseek.models.ts\";\nimport { FIREWORKS_MODELS } from \"./providers/fireworks.models.ts\";\nimport { GITHUB_COPILOT_MODELS } from \"./providers/github-copilot.models.ts\";\nimport { GOOGLE_MODELS } from \"./providers/google.models.ts\";\nimport { GOOGLE_VERTEX_MODELS } from \"./providers/google-vertex.models.ts\";\nimport { GROQ_MODELS } from \"./providers/groq.models.ts\";\nimport { HUGGINGFACE_MODELS } from \"./providers/huggingface.models.ts\";\nimport { KIMI_CODING_MODELS } from \"./providers/kimi-coding.models.ts\";\nimport { MINIMAX_MODELS } from \"./providers/minimax.models.ts\";\nimport { MINIMAX_CN_MODELS } from \"./providers/minimax-cn.models.ts\";\nimport { MISTRAL_MODELS } from \"./providers/mistral.models.ts\";\nimport { MOONSHOTAI_MODELS } from \"./providers/moonshotai.models.ts\";\nimport { MOONSHOTAI_CN_MODELS } from \"./providers/moonshotai-cn.models.ts\";\nimport { NVIDIA_MODELS } from \"./providers/nvidia.models.ts\";\nimport { OPENAI_MODELS } from \"./providers/openai.models.ts\";\nimport { OPENAI_CODEX_MODELS } from \"./providers/openai-codex.models.ts\";\nimport { OPENCODE_MODELS } from \"./providers/opencode.models.ts\";\nimport { OPENCODE_GO_MODELS } from \"./providers/opencode-go.models.ts\";\nimport { OPENROUTER_MODELS } from \"./providers/openrouter.models.ts\";\nimport { TOGETHER_MODELS } from \"./providers/together.models.ts\";\nimport { VERCEL_AI_GATEWAY_MODELS } from \"./providers/vercel-ai-gateway.models.ts\";\nimport { XAI_MODELS } from \"./providers/xai.models.ts\";\nimport { XIAOMI_MODELS } from \"./providers/xiaomi.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_AMS_MODELS } from \"./providers/xiaomi-token-plan-ams.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_CN_MODELS } from \"./providers/xiaomi-token-plan-cn.models.ts\";\nimport { XIAOMI_TOKEN_PLAN_SGP_MODELS } from \"./providers/xiaomi-token-plan-sgp.models.ts\";\nimport { ZAI_MODELS } from \"./providers/zai.models.ts\";\nimport { ZAI_CODING_CN_MODELS } from \"./providers/zai-coding-cn.models.ts\";\n\nexport const MODELS = {\n\t\"amazon-bedrock\": AMAZON_BEDROCK_MODELS,\n\t\"ant-ling\": ANT_LING_MODELS,\n\t\"anthropic\": ANTHROPIC_MODELS,\n\t\"azure-openai-responses\": AZURE_OPENAI_RESPONSES_MODELS,\n\t\"cerebras\": CEREBRAS_MODELS,\n\t\"cloudflare-ai-gateway\": CLOUDFLARE_AI_GATEWAY_MODELS,\n\t\"cloudflare-workers-ai\": CLOUDFLARE_WORKERS_AI_MODELS,\n\t\"deepseek\": DEEPSEEK_MODELS,\n\t\"fireworks\": FIREWORKS_MODELS,\n\t\"github-copilot\": GITHUB_COPILOT_MODELS,\n\t\"google\": GOOGLE_MODELS,\n\t\"google-vertex\": GOOGLE_VERTEX_MODELS,\n\t\"groq\": GROQ_MODELS,\n\t\"huggingface\": HUGGINGFACE_MODELS,\n\t\"kimi-coding\": KIMI_CODING_MODELS,\n\t\"minimax\": MINIMAX_MODELS,\n\t\"minimax-cn\": MINIMAX_CN_MODELS,\n\t\"mistral\": MISTRAL_MODELS,\n\t\"moonshotai\": MOONSHOTAI_MODELS,\n\t\"moonshotai-cn\": MOONSHOTAI_CN_MODELS,\n\t\"nvidia\": NVIDIA_MODELS,\n\t\"openai\": OPENAI_MODELS,\n\t\"openai-codex\": OPENAI_CODEX_MODELS,\n\t\"opencode\": OPENCODE_MODELS,\n\t\"opencode-go\": OPENCODE_GO_MODELS,\n\t\"openrouter\": OPENROUTER_MODELS,\n\t\"together\": TOGETHER_MODELS,\n\t\"vercel-ai-gateway\": VERCEL_AI_GATEWAY_MODELS,\n\t\"xai\": XAI_MODELS,\n\t\"xiaomi\": XIAOMI_MODELS,\n\t\"xiaomi-token-plan-ams\": XIAOMI_TOKEN_PLAN_AMS_MODELS,\n\t\"xiaomi-token-plan-cn\": XIAOMI_TOKEN_PLAN_CN_MODELS,\n\t\"xiaomi-token-plan-sgp\": XIAOMI_TOKEN_PLAN_SGP_MODELS,\n\t\"zai\": ZAI_MODELS,\n\t\"zai-coding-cn\": ZAI_CODING_CN_MODELS,\n} as const;\n"]}
@@ -19,6 +19,26 @@ export declare const KIMI_CODING_MODELS: {
19
19
  contextWindow: number;
20
20
  maxTokens: number;
21
21
  };
22
+ readonly k3: {
23
+ id: string;
24
+ name: string;
25
+ api: "anthropic-messages";
26
+ provider: string;
27
+ baseUrl: string;
28
+ headers: {
29
+ "User-Agent": string;
30
+ };
31
+ reasoning: true;
32
+ input: ("image" | "text")[];
33
+ cost: {
34
+ input: number;
35
+ output: number;
36
+ cacheRead: number;
37
+ cacheWrite: number;
38
+ };
39
+ contextWindow: number;
40
+ maxTokens: number;
41
+ };
22
42
  readonly "kimi-for-coding": {
23
43
  id: string;
24
44
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-coding.models.d.ts","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyErB,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding-highspeed\": {\n\t\tid: \"kimi-for-coding-highspeed\",\n\t\tname: \"Kimi For Coding HighSpeed\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}
1
+ {"version":3,"file":"kimi-coding.models.d.ts","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FrB,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"k3\": {\n\t\tid: \"k3\",\n\t\tname: \"Kimi K3\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 1048576,\n\t\tmaxTokens: 131072,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding-highspeed\": {\n\t\tid: \"kimi-for-coding-highspeed\",\n\t\tname: \"Kimi For Coding HighSpeed\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}
@@ -19,6 +19,24 @@ export const KIMI_CODING_MODELS = {
19
19
  contextWindow: 262144,
20
20
  maxTokens: 32768,
21
21
  },
22
+ "k3": {
23
+ id: "k3",
24
+ name: "Kimi K3",
25
+ api: "anthropic-messages",
26
+ provider: "kimi-coding",
27
+ baseUrl: "https://api.kimi.com/coding",
28
+ headers: { "User-Agent": "KimiCLI/1.5" },
29
+ reasoning: true,
30
+ input: ["text", "image"],
31
+ cost: {
32
+ input: 0,
33
+ output: 0,
34
+ cacheRead: 0,
35
+ cacheWrite: 0,
36
+ },
37
+ contextWindow: 1048576,
38
+ maxTokens: 131072,
39
+ },
22
40
  "kimi-for-coding": {
23
41
  id: "kimi-for-coding",
24
42
  name: "Kimi For Coding",
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-coding.models.js","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAIjE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE;QACP,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACxB,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;IACvC,iBAAi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AAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;CAC9B,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding-highspeed\": {\n\t\tid: \"kimi-for-coding-highspeed\",\n\t\tname: \"Kimi For Coding HighSpeed\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}
1
+ {"version":3,"file":"kimi-coding.models.js","sourceRoot":"","sources":["../../src/providers/kimi-coding.models.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAIjE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE;QACP,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACxB,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;IACvC,IAAI,EAAE;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,SAAS;Q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KAAK;KACsB;IACvC,kBAAkB,EAAE;QACnB,EAAE,EAAE,kBAAkB;QACtB,IAAI,EAAE,kBAAkB;QACxB,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,EAAC,YAAY,EAAC,aAAa,EAAC;QACrC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,CAAC,MAAM,CAAC;QACf,IAAI,EAAE;YACL,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACb;QACD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACsB;CAC9B,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport type { Model } from \"../types.ts\";\n\nexport const KIMI_CODING_MODELS = {\n\t\"k2p7\": {\n\t\tid: \"k2p7\",\n\t\tname: \"Kimi K2.7 Code\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"k3\": {\n\t\tid: \"k3\",\n\t\tname: \"Kimi K3\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 1048576,\n\t\tmaxTokens: 131072,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding\": {\n\t\tid: \"kimi-for-coding\",\n\t\tname: \"Kimi For Coding\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-for-coding-highspeed\": {\n\t\tid: \"kimi-for-coding-highspeed\",\n\t\tname: \"Kimi For Coding HighSpeed\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\", \"image\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n\t\"kimi-k2-thinking\": {\n\t\tid: \"kimi-k2-thinking\",\n\t\tname: \"Kimi K2 Thinking\",\n\t\tapi: \"anthropic-messages\",\n\t\tprovider: \"kimi-coding\",\n\t\tbaseUrl: \"https://api.kimi.com/coding\",\n\t\theaders: {\"User-Agent\":\"KimiCLI/1.5\"},\n\t\treasoning: true,\n\t\tinput: [\"text\"],\n\t\tcost: {\n\t\t\tinput: 0,\n\t\t\toutput: 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t\tcontextWindow: 262144,\n\t\tmaxTokens: 32768,\n\t} satisfies Model<\"anthropic-messages\">,\n} as const;\n"]}