@bastani/pi-ai 0.9.41 → 0.9.42-alpha.1

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 (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -0
  3. package/dist/api/anthropic-messages.d.ts.map +1 -1
  4. package/dist/api/anthropic-messages.js +37 -3
  5. package/dist/api/anthropic-messages.js.map +1 -1
  6. package/dist/api/azure-openai-responses.d.ts.map +1 -1
  7. package/dist/api/azure-openai-responses.js +12 -4
  8. package/dist/api/azure-openai-responses.js.map +1 -1
  9. package/dist/api/mistral-conversations.d.ts.map +1 -1
  10. package/dist/api/mistral-conversations.js +3 -1
  11. package/dist/api/mistral-conversations.js.map +1 -1
  12. package/dist/api/openai-codex-responses.d.ts.map +1 -1
  13. package/dist/api/openai-codex-responses.js +3 -1
  14. package/dist/api/openai-codex-responses.js.map +1 -1
  15. package/dist/api/openai-completions.d.ts.map +1 -1
  16. package/dist/api/openai-completions.js +12 -4
  17. package/dist/api/openai-completions.js.map +1 -1
  18. package/dist/api/openai-responses.d.ts.map +1 -1
  19. package/dist/api/openai-responses.js +4 -3
  20. package/dist/api/openai-responses.js.map +1 -1
  21. package/dist/auth/types.d.ts +4 -0
  22. package/dist/auth/types.d.ts.map +1 -1
  23. package/dist/auth/types.js.map +1 -1
  24. package/dist/compat/extension-oauth-types.d.ts +4 -0
  25. package/dist/compat/extension-oauth-types.d.ts.map +1 -1
  26. package/dist/compat/extension-oauth-types.js.map +1 -1
  27. package/dist/providers/data/.manifest.json +1 -1
  28. package/dist/providers/data/fireworks.json +1 -1
  29. package/dist/providers/data/huggingface.json +1 -1
  30. package/dist/providers/data/mistral.json +1 -1
  31. package/dist/providers/data/nvidia.json +1 -1
  32. package/dist/providers/data/opencode-go.json +1 -1
  33. package/dist/providers/data/opencode.json +1 -1
  34. package/dist/providers/data/openrouter.json +1 -1
  35. package/dist/providers/data/vercel-ai-gateway.json +1 -1
  36. package/dist/types.d.ts +5 -0
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js.map +1 -1
  39. package/dist/utils/openrouter-cost.d.ts +24 -0
  40. package/dist/utils/openrouter-cost.d.ts.map +1 -0
  41. package/dist/utils/openrouter-cost.js +34 -0
  42. package/dist/utils/openrouter-cost.js.map +1 -0
  43. package/dist/utils/request-admission.d.ts +12 -0
  44. package/dist/utils/request-admission.d.ts.map +1 -0
  45. package/dist/utils/request-admission.js +37 -0
  46. package/dist/utils/request-admission.js.map +1 -0
  47. package/dist/utils/version.d.ts +1 -1
  48. package/dist/utils/version.d.ts.map +1 -1
  49. package/dist/utils/version.js +1 -1
  50. package/dist/utils/version.js.map +1 -1
  51. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"openai-responses.d.ts","sourceRoot":"","sources":["../../src/api/openai-responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AAE7F,OAAO,KAAK,EAQX,mBAAmB,EACnB,cAAc,EACd,aAAa,EAEb,MAAM,aAAa,CAAC;AAiBrB,OAAO,EAWN,KAAK,oBAAoB,EAGzB,MAAM,8BAA8B,CAAC;AAoHtC,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC5D,eAAe,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1D,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,UAAU,CAAC,EAAE,6BAA6B,CAAC,aAAa,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,kBAAkB,EAAE,sBAAsB,CA2J7E,CAAC;AAuDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,kBAAkB,EAAE,mBAAmB,CAkBhF,CAAC"}
1
+ {"version":3,"file":"openai-responses.d.ts","sourceRoot":"","sources":["../../src/api/openai-responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AAE7F,OAAO,KAAK,EAQX,mBAAmB,EACnB,cAAc,EACd,aAAa,EAEb,MAAM,aAAa,CAAC;AAkBrB,OAAO,EAWN,KAAK,oBAAoB,EAGzB,MAAM,8BAA8B,CAAC;AAoHtC,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC5D,eAAe,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1D,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,UAAU,CAAC,EAAE,6BAA6B,CAAC,aAAa,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,kBAAkB,EAAE,sBAAsB,CA2J7E,CAAC;AAuDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,kBAAkB,EAAE,mBAAmB,CAkBhF,CAAC"}
@@ -5,6 +5,7 @@ import { headersToRecord } from "../utils/headers.js";
5
5
  import { getIdentityHeaders } from "../utils/identity.js";
6
6
  import { getProviderEnvValue } from "../utils/provider-env.js";
7
7
  import { retryProviderRequest } from "../utils/provider-retry.js";
8
+ import { admitOpenAIRequests, getFetchAdmission } from "../utils/request-admission.js";
8
9
  import { getProviderRetryAfterMs } from "../utils/retry-hints.js";
9
10
  import { createStreamDeadline, withStreamDeadline } from "../utils/stream-deadline.js";
10
11
  import { getDeclaredTools, resolveTranscript, resolveTranscriptTools } from "../utils/transcript.js";
@@ -332,13 +333,13 @@ function createClient(model, context, apiKey, optionsHeaders, identity, fetch, s
332
333
  if (optionsHeaders) {
333
334
  Object.assign(headers, optionsHeaders);
334
335
  }
335
- return new RetryHintOpenAI({
336
+ return admitOpenAIRequests(new RetryHintOpenAI({
336
337
  apiKey,
337
338
  baseURL: model.baseUrl,
338
339
  dangerouslyAllowBrowser: true,
339
- fetch,
340
+ fetch: getFetchAdmission(fetch)?.fetch ?? fetch,
340
341
  defaultHeaders: headers,
341
- });
342
+ }), fetch);
342
343
  }
343
344
  function buildParams(model, context, options, compat, grammarToolInputProperties, configurationUpdateEffort) {
344
345
  const transcriptTools = resolveTranscriptTools(context.messages, getResponsesToolSupport(compat));
@@ -1 +1 @@
1
- {"version":3,"file":"openai-responses.js","sourceRoot":"","sources":["../../src/api/openai-responses.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAclD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAuB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACN,0BAA0B,EAC1B,qBAAqB,EACrB,gCAAgC,GAChC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACN,gCAAgC,EAChC,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CAAC;YACnB,MAAM,MAAM,GAAG,yBAAyB,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mCAAmC,CAAC;YAC/G,MAAM,CAAC,SAAS,GAAG;gBAClB,MAAM,EAAE,MAAwD;gBAChE,OAAO,EAAE,OAAO,EAAE,gBAAgB,IAAI,MAAM;aAC5C,CAAC;YACF,MAAM,CAAC,OAAO,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAClD,CAAC;aAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,gBAAgB,IAAI,KAAK,CAAC,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;YACxF,MAAM,CAAC,SAAS,GAAG;gBAClB,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,GAAG,IAAI,MAAM,CAAmD;aACjG,CAAC;QACH,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK;YAAE,MAAM,CAAC,OAAO,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAChF,CAAC;IAED,+EAA+E;IAC/E,MAAM,cAAc,GAAG,qBAAqB,CAAC,KAAK,EAAE,eAAe,IAAI,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IACvG,IAAI,cAAc,EAAE,CAAC;QACpB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,+BAA+B,CACvC,KAAgC,EAChC,kBAAoD;IAEpD,OAAO,2BAA2B,CAAC,KAAK,EAAE,2BAA2B,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC;AACnG,CAAC","sourcesContent":["import type { ResponseCreateParamsStreaming } from \"openai/resources/responses/responses.js\";\nimport { clampThinkingLevel } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tModel,\n\tOpenAIResponsesCompat,\n\tProviderEnv,\n\tProviderHeaders,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTranscriptContext,\n} from \"../types.ts\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { headersToRecord } from \"../utils/headers.ts\";\nimport { type ClientIdentity, getIdentityHeaders } from \"../utils/identity.ts\";\nimport { getProviderEnvValue } from \"../utils/provider-env.ts\";\nimport { retryProviderRequest } from \"../utils/provider-retry.ts\";\nimport { getProviderRetryAfterMs } from \"../utils/retry-hints.ts\";\nimport { createStreamDeadline, withStreamDeadline } from \"../utils/stream-deadline.ts\";\nimport { getDeclaredTools, resolveTranscript, resolveTranscriptTools } from \"../utils/transcript.ts\";\nimport { createGrammarToolInputProperties } from \"./constrained-sampling.ts\";\nimport {\n\tbuildCopilotDynamicHeaders,\n\thasCopilotVisionInput,\n\tpreserveCopilotIntegrationHeader,\n} from \"./github-copilot-headers.ts\";\nimport { clampOpenAIPromptCacheKey } from \"./openai-prompt-cache.ts\";\nimport {\n\tappendServiceTierRejectedWarning,\n\tapplyServiceTierPricing,\n\tassertPayloadPreservesFastRoute,\n\tconvertResponsesMessages,\n\tconvertResponsesTools,\n\tgetResponsesToolSupport,\n\tisChatGPTSubscriptionToken,\n\tisServiceTierRejection,\n\topenAIServiceTierForRequest,\n\tprocessResponsesStream,\n\ttype ResponsesServiceTier,\n\tresolveChatGPTBackendServiceTier,\n\tresolveRequestedServiceTier,\n} from \"./openai-responses-shared.ts\";\nimport { RetryHintOpenAI } from \"./openai-retry-hint-client.ts\";\nimport { buildBaseOptions, resolveSamplingParams } from \"./simple-options.ts\";\n\nconst OPENAI_TOOL_CALL_PROVIDERS = new Set([\"openai\", \"openai-api\", \"openai-codex\", \"opencode\"]);\n// OpenAI Responses rejects max_output_tokens below 16: https://github.com/earendil-works/pi/issues/6265\nconst OPENAI_RESPONSES_MIN_OUTPUT_TOKENS = 16;\nconst CHATGPT_USAGE_URL = \"https://chatgpt.com/settings/usage\";\nconst CHATGPT_WORKSPACE_LIMIT_HINT =\n\t\"You've reached your ChatGPT workspace's usage limit. Ask your workspace admin to increase it at admin.openai.com → Workspace → Usage limits.\";\nconst CONFIGURATION_UPDATE_REQUEST_EFFORT = \"medium\";\n\nfunction isChatGPTSignIn(model: Model<\"openai-responses\">, apiKey: string | undefined): boolean {\n\treturn (\n\t\tmodel.provider === \"openai\" &&\n\t\tmodel.baseUrl === \"https://api.openai.com/v1\" &&\n\t\tapiKey !== undefined &&\n\t\t!apiKey.startsWith(\"sk-\")\n\t);\n}\n\nfunction headerValue(headers: ProviderHeaders | undefined, name: string): string | undefined {\n\tif (!headers) return undefined;\n\tconst expected = name.toLowerCase();\n\tfor (const [key, value] of Object.entries(headers)) {\n\t\tif (key.toLowerCase() === expected && value !== null && value.trim().length > 0) return value.trim();\n\t}\n\treturn undefined;\n}\n\nfunction hasHeader(headers: ProviderHeaders | undefined, name: string): boolean {\n\treturn headerValue(headers, name) !== undefined;\n}\n\nfunction bearerToken(apiKey: string | undefined, headers: ProviderHeaders | undefined): string | undefined {\n\treturn apiKey ?? headerValue(headers, \"authorization\")?.replace(/^Bearer\\s+/i, \"\");\n}\n\nfunction getClientApiKey(provider: string, apiKey: string | undefined, headers: ProviderHeaders | undefined): string {\n\tif (apiKey) return apiKey;\n\tif (hasHeader(headers, \"authorization\") || hasHeader(headers, \"cf-aig-authorization\")) return \"unused\";\n\tthrow new Error(`No API key for provider: ${provider}`);\n}\n\nfunction detectSessionAffinityFormat(model: Pick<Model<\"openai-responses\">, \"provider\" | \"baseUrl\">) {\n\treturn model.provider === \"openrouter\" || model.baseUrl.includes(\"openrouter.ai\") ? \"openrouter\" : \"openai\";\n}\n\n/**\n * Resolve cache retention preference.\n * Defaults to \"short\" and uses PI_CACHE_RETENTION for backward compatibility.\n */\nfunction resolveCacheRetention(cacheRetention?: CacheRetention, env?: ProviderEnv): CacheRetention {\n\tif (cacheRetention) {\n\t\treturn cacheRetention;\n\t}\n\tif (getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\") {\n\t\treturn \"long\";\n\t}\n\treturn \"short\";\n}\n\nfunction getCompat(model: Model<\"openai-responses\">): Required<OpenAIResponsesCompat> {\n\treturn {\n\t\tsupportsDeveloperRole: model.compat?.supportsDeveloperRole ?? true,\n\t\tsupportsMidConvoSystemMessages: model.compat?.supportsMidConvoSystemMessages ?? false,\n\t\tsessionAffinityFormat: model.compat?.sessionAffinityFormat ?? detectSessionAffinityFormat(model),\n\t\tsupportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,\n\t\tsupportsStrictMode: model.compat?.supportsStrictMode ?? false,\n\t\tsupportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,\n\t\tsupportsAdditionalTools: model.compat?.supportsAdditionalTools ?? false,\n\t\tsupportsToolSearch: model.compat?.supportsToolSearch ?? false,\n\t\tsupportsExplicitPromptCacheMode: model.compat?.supportsExplicitPromptCacheMode ?? false,\n\t\tsupportsMaxOutputTokens: model.compat?.supportsMaxOutputTokens ?? true,\n\t\tsupportsMidConvoEffort: model.compat?.supportsMidConvoEffort ?? false,\n\t};\n}\n\n/** Effort to send in configuration_update items, or undefined to send it as reasoning.effort. */\nfunction getConfigurationUpdateEffort(\n\tmodel: Model<\"openai-responses\">,\n\toptions: OpenAIResponsesOptions | undefined,\n\tcompat: Required<OpenAIResponsesCompat>,\n): string | undefined {\n\tif (\n\t\t!compat.supportsMidConvoEffort ||\n\t\t!options?.reasoningEffort ||\n\t\t// Sign in with ChatGPT rejects configuration_update items.\n\t\tisChatGPTSignIn(model, options.apiKey) ||\n\t\tisChatGPTSubscriptionToken(bearerToken(options.apiKey, options.headers))\n\t) {\n\t\treturn undefined;\n\t}\n\treturn model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;\n}\n\nfunction getPromptCacheRetention(\n\tcompat: Required<OpenAIResponsesCompat>,\n\tcacheRetention: CacheRetention,\n): \"24h\" | undefined {\n\treturn cacheRetention === \"long\" && compat.supportsLongCacheRetention && !compat.supportsExplicitPromptCacheMode\n\t\t? \"24h\"\n\t\t: undefined;\n}\n\nfunction getPromptCacheOptions(\n\tcompat: Required<OpenAIResponsesCompat>,\n\tcacheRetention: CacheRetention,\n): ResponseCreateParamsStreaming[\"prompt_cache_options\"] {\n\tif (!compat.supportsExplicitPromptCacheMode) return undefined;\n\tif (cacheRetention === \"none\") return { mode: \"explicit\" };\n\tif (cacheRetention === \"long\" && compat.supportsLongCacheRetention) return { ttl: \"30m\" };\n\treturn undefined;\n}\n\n// OpenAI Responses-specific options\nexport interface OpenAIResponsesOptions extends StreamOptions {\n\treasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\treasoningSummary?: \"auto\" | \"detailed\" | \"concise\" | null;\n\tserviceTier?: ResponsesServiceTier;\n\ttoolChoice?: ResponseCreateParamsStreaming[\"tool_choice\"];\n}\n\n/**\n * Generate function for OpenAI Responses API\n */\nexport const stream: StreamFunction<\"openai-responses\", OpenAIResponsesOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\toptions?: OpenAIResponsesOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\tconst normalizedContext = resolveTranscript(context, getCompat(model).supportsMidConvoSystemMessages);\n\n\t// Start async processing\n\t(async () => {\n\t\tconst compat = getCompat(model);\n\t\tconst configurationUpdateEffort = getConfigurationUpdateEffort(model, options, compat);\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: model.api as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\t...(configurationUpdateEffort === undefined ? {} : { providerThinkingLevel: configurationUpdateEffort }),\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"pending\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\tconst streamDeadline = createStreamDeadline(options?.streamDeadlineMs, options?.signal);\n\n\t\ttry {\n\t\t\t// Create OpenAI client\n\t\t\tconst apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);\n\t\t\tconst chatGPTBackend = isChatGPTSubscriptionToken(bearerToken(options?.apiKey, options?.headers));\n\t\t\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);\n\t\t\tconst cacheSessionId = cacheRetention === \"none\" ? undefined : options?.sessionId;\n\t\t\tconst grammarToolInputProperties = createGrammarToolInputProperties(\n\t\t\t\tgetDeclaredTools(normalizedContext.messages),\n\t\t\t\tcompat.supportsOpenAIGrammarTools,\n\t\t\t);\n\t\t\tconst client = createClient(\n\t\t\t\tmodel,\n\t\t\t\tnormalizedContext,\n\t\t\t\tapiKey,\n\t\t\t\toptions?.headers,\n\t\t\t\toptions?.identity,\n\t\t\t\toptions?.fetch,\n\t\t\t\tcacheSessionId,\n\t\t\t\toptions?.apiKey,\n\t\t\t);\n\t\t\tlet params = buildParams(\n\t\t\t\tmodel,\n\t\t\t\tnormalizedContext,\n\t\t\t\toptions,\n\t\t\t\tcompat,\n\t\t\t\tgrammarToolInputProperties,\n\t\t\t\tconfigurationUpdateEffort,\n\t\t\t);\n\t\t\tconst nextParams = await options?.onPayload?.(params, model);\n\t\t\tif (nextParams !== undefined) {\n\t\t\t\tparams = nextParams as ResponseCreateParamsStreaming;\n\t\t\t}\n\t\t\tassertPayloadPreservesFastRoute(model, params);\n\t\t\tconst requestOptions = {\n\t\t\t\t...(streamDeadline.signal ? { signal: streamDeadline.signal } : {}),\n\t\t\t\t...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),\n\t\t\t\tmaxRetries: 0,\n\t\t\t};\n\t\t\tconst sendRequest = (requestParams: ResponseCreateParamsStreaming) =>\n\t\t\t\tretryProviderRequest(() => client.responses.create(requestParams, requestOptions).withResponse(), {\n\t\t\t\t\tmaxRetries: options?.maxRetries,\n\t\t\t\t\tmaxRetryDelayMs: options?.maxRetryDelayMs,\n\t\t\t\t\tsignal: streamDeadline.signal,\n\t\t\t\t});\n\t\t\tlet startEmitted = false;\n\t\t\t// Every attempt reports its HTTP response before its body is consumed, and the message stream starts\n\t\t\t// once. A streamed request reports a rejected service_tier as an `error` event after HTTP 200, so the\n\t\t\t// response preamble is read before the request counts as accepted.\n\t\t\tconst openStream = async (requestParams: ResponseCreateParamsStreaming) => {\n\t\t\t\tconst { data, response } = await sendRequest(requestParams);\n\t\t\t\tawait options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n\t\t\t\tif (!startEmitted) {\n\t\t\t\t\tstartEmitted = true;\n\t\t\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\t\t}\n\t\t\t\treturn readResponsePreamble(withStreamDeadline(data, streamDeadline.deadlineMs, streamDeadline.abort));\n\t\t\t};\n\t\t\tlet requestedServiceTier = resolveOpenAIRequestServiceTier(model, options?.serviceTier);\n\t\t\tlet openaiStream: Awaited<ReturnType<typeof openStream>>;\n\t\t\ttry {\n\t\t\t\topenaiStream = await openStream(params);\n\t\t\t} catch (error) {\n\t\t\t\tif (params.service_tier == null || !isServiceTierRejection(error)) throw error;\n\t\t\t\tconst rejectedServiceTier = params.service_tier;\n\t\t\t\tconst { service_tier: _rejectedServiceTier, ...defaultTierParams } = params;\n\t\t\t\topenaiStream = await openStream(defaultTierParams);\n\t\t\t\trequestedServiceTier = undefined;\n\t\t\t\tappendServiceTierRejectedWarning(output, model, rejectedServiceTier);\n\t\t\t}\n\n\t\t\tawait processResponsesStream(openaiStream, output, stream, model, {\n\t\t\t\tonProviderStreamEvent: options?.onProviderStreamEvent,\n\t\t\t\tserviceTier: requestedServiceTier,\n\t\t\t\tgrammarToolInputProperties,\n\t\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t\t\t...(chatGPTBackend\n\t\t\t\t\t? { resolveServiceTier: resolveChatGPTBackendServiceTier }\n\t\t\t\t\t: { warnOnServiceTierDowngrade: true }),\n\t\t\t});\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"pending\") {\n\t\t\t\tthrow new Error(\"OpenAI Responses stream ended without a stop reason\");\n\t\t\t}\n\t\t\tif (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n\t\t\t\tthrow new Error(output.errorMessage || \"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\tdelete (block as { index?: number }).index;\n\t\t\t\t// Streaming scratch buffers are only used during parsing; never persist them.\n\t\t\t\tdelete (block as { partialJson?: string }).partialJson;\n\t\t\t\tdelete (block as { customInput?: unknown }).customInput;\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.retryAfterMs = error instanceof Error ? getProviderRetryAfterMs(error) : undefined;\n\t\t\tconst errorMessage = formatProviderError(\n\t\t\t\tnormalizeProviderError(error),\n\t\t\t\t`${model.provider === \"openai\" || model.provider === \"openai-api\" ? \"OpenAI\" : model.provider} API error`,\n\t\t\t);\n\t\t\t// On ChatGPT Business plans, the workspace admin also sets a per-user limit.\n\t\t\tif (errorMessage.includes(\"subscription_sharing_usage_limit_exceeded\")) {\n\t\t\t\toutput.errorMessage = `${errorMessage}\\nCheck your ChatGPT usage: ${CHATGPT_USAGE_URL}`;\n\t\t\t} else if (errorMessage.includes(\"subscription_sharing_workplace_individual_usage_limit_exceeded\")) {\n\t\t\t\toutput.errorMessage = `${errorMessage}\\n${CHATGPT_WORKSPACE_LIMIT_HINT}`;\n\t\t\t} else {\n\t\t\t\toutput.errorMessage = errorMessage;\n\t\t\t}\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t} finally {\n\t\t\tstreamDeadline.cleanup();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nconst RESPONSE_PREAMBLE_EVENT_TYPES = new Set([\"response.created\", \"response.in_progress\", \"response.queued\"]);\n\nfunction failedResponseTierRejection(event: { type: string } | undefined): Error | undefined {\n\tif (event?.type !== \"response.failed\") return undefined;\n\tconst failure = (event as { response?: { error?: { code?: string | null; message?: string } | null } }).response\n\t\t?.error;\n\tif (!failure?.message) return undefined;\n\tconst error = new Error(failure.message);\n\treturn isServiceTierRejection(error) ? error : undefined;\n}\n\n/**\n * Read a stream up to its first event after the response preamble, so an error the server raises\n * before producing output is thrown here. Returns a stream that replays every event read.\n */\nasync function readResponsePreamble<T extends { type: string }>(events: AsyncIterable<T>): Promise<AsyncIterable<T>> {\n\tconst iterator = events[Symbol.asyncIterator]();\n\tconst preamble: T[] = [];\n\tlet done = false;\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst next = await iterator.next();\n\t\t\tif (next.done) {\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpreamble.push(next.value);\n\t\t\tif (!RESPONSE_PREAMBLE_EVENT_TYPES.has(next.value.type)) break;\n\t\t}\n\t} catch (error) {\n\t\tawait iterator.return?.();\n\t\tthrow error;\n\t}\n\tconst tierRejection = failedResponseTierRejection(preamble.at(-1));\n\tif (tierRejection) {\n\t\tawait iterator.return?.();\n\t\tthrow tierRejection;\n\t}\n\treturn (async function* () {\n\t\ttry {\n\t\t\tyield* preamble;\n\t\t\tif (done) return;\n\t\t\tfor (;;) {\n\t\t\t\tconst next = await iterator.next();\n\t\t\t\tif (next.done) return;\n\t\t\t\tyield next.value;\n\t\t\t}\n\t\t} finally {\n\t\t\tawait iterator.return?.();\n\t\t}\n\t})();\n}\n\nexport const streamSimple: StreamFunction<\"openai-responses\", SimpleStreamOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tgetClientApiKey(model.provider, options?.apiKey, options?.headers);\n\n\tconst base = {\n\t\t...buildBaseOptions(model, context, options, options?.apiKey),\n\t\ttoolChoice: options?.toolChoice,\n\t} satisfies OpenAIResponsesOptions;\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort = clampedReasoning === \"off\" ? undefined : clampedReasoning;\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies OpenAIResponsesOptions);\n};\n\nfunction createClient(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\tapiKey: string,\n\toptionsHeaders?: ProviderHeaders,\n\tidentity?: ClientIdentity,\n\tfetch?: typeof globalThis.fetch,\n\tsessionId?: string,\n\tcopilotApiKey?: string,\n) {\n\tconst compat = getCompat(model);\n\tconst headers: ProviderHeaders = { ...getIdentityHeaders(model, identity), ...model.headers };\n\tif (model.provider === \"github-copilot\") {\n\t\tconst hasImages = hasCopilotVisionInput(context.messages);\n\t\tconst copilotHeaders = preserveCopilotIntegrationHeader(\n\t\t\tmodel.headers,\n\t\t\tbuildCopilotDynamicHeaders({\n\t\t\t\tmessages: context.messages,\n\t\t\t\thasImages,\n\t\t\t\tapiKey: copilotApiKey,\n\t\t\t}),\n\t\t);\n\t\tObject.assign(headers, copilotHeaders);\n\t}\n\n\tif (sessionId) {\n\t\tif (compat.sessionAffinityFormat === \"openrouter\") {\n\t\t\theaders[\"x-session-id\"] = sessionId;\n\t\t} else {\n\t\t\tif (compat.sessionAffinityFormat === \"openai\") {\n\t\t\t\theaders.session_id = sessionId;\n\t\t\t}\n\t\t\theaders[\"x-client-request-id\"] = sessionId;\n\t\t}\n\t}\n\n\t// Merge options headers last so they can override defaults\n\tif (optionsHeaders) {\n\t\tObject.assign(headers, optionsHeaders);\n\t}\n\n\treturn new RetryHintOpenAI({\n\t\tapiKey,\n\t\tbaseURL: model.baseUrl,\n\t\tdangerouslyAllowBrowser: true,\n\t\tfetch,\n\t\tdefaultHeaders: headers,\n\t});\n}\n\nfunction buildParams(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\toptions: OpenAIResponsesOptions | undefined,\n\tcompat: Required<OpenAIResponsesCompat>,\n\tgrammarToolInputProperties: ReadonlyMap<string, string>,\n\tconfigurationUpdateEffort: string | undefined,\n) {\n\tconst transcriptTools = resolveTranscriptTools(context.messages, getResponsesToolSupport(compat));\n\tconst messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {\n\t\tgrammarToolInputProperties,\n\t\tsupportsMidConvoSystemMessages: compat.supportsMidConvoSystemMessages,\n\t\tsupportsAdditionalTools: compat.supportsAdditionalTools,\n\t\tsupportsToolSearch: compat.supportsToolSearch,\n\t\ttoolOptions: {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t},\n\t\tconfigurationUpdateEffort,\n\t});\n\n\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);\n\tconst omitUnsupportedFields = isChatGPTSignIn(model, options?.apiKey);\n\tconst params: ResponseCreateParamsStreaming = {\n\t\t// A fast variant keeps its canonical `-fast` id on the model object — that is the identity the\n\t\t// caller selected and records — while routing to the base upstream model plus a service tier.\n\t\tmodel: model.fastRoute?.upstreamModelId ?? model.id,\n\t\tinput: messages,\n\t\tstream: true,\n\t\tprompt_cache_key: cacheRetention === \"none\" ? undefined : clampOpenAIPromptCacheKey(options?.sessionId),\n\t\tprompt_cache_retention: omitUnsupportedFields ? undefined : getPromptCacheRetention(compat, cacheRetention),\n\t\tprompt_cache_options: omitUnsupportedFields ? undefined : getPromptCacheOptions(compat, cacheRetention),\n\t\tstore: false,\n\t};\n\n\tif (options?.maxTokens && compat.supportsMaxOutputTokens && !omitUnsupportedFields) {\n\t\tparams.max_output_tokens = Math.max(options.maxTokens, OPENAI_RESPONSES_MIN_OUTPUT_TOKENS);\n\t}\n\n\tif (options?.temperature !== undefined && !omitUnsupportedFields) {\n\t\tparams.temperature = options?.temperature;\n\t}\n\n\tconst requestedServiceTier = resolveOpenAIRequestServiceTier(model, options?.serviceTier);\n\tif (requestedServiceTier !== undefined) {\n\t\tparams.service_tier = requestedServiceTier;\n\t}\n\n\tif (transcriptTools.requestTools.length > 0) {\n\t\tparams.tools = convertResponsesTools(transcriptTools.requestTools, {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t});\n\t}\n\n\tif (options?.toolChoice !== undefined) {\n\t\tparams.tool_choice = options.toolChoice;\n\t}\n\n\tconst reasoningEffort = options?.reasoningEffort ?? (options?.reasoningSummary ? \"medium\" : undefined);\n\tif (model.reasoning) {\n\t\tif (reasoningEffort) {\n\t\t\tconst requestedEffort = options?.reasoningEffort\n\t\t\t\t? (model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort)\n\t\t\t\t: reasoningEffort;\n\t\t\tconst effort = configurationUpdateEffort === undefined ? requestedEffort : CONFIGURATION_UPDATE_REQUEST_EFFORT;\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: effort as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t\tsummary: options?.reasoningSummary || \"auto\",\n\t\t\t};\n\t\t\tparams.include = [\"reasoning.encrypted_content\"];\n\t\t} else if (model.provider !== \"github-copilot\" && model.thinkingLevelMap?.off !== null) {\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: (model.thinkingLevelMap?.off ?? \"none\") as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t};\n\t\t}\n\t\tif (model.provider === \"xai\") params.include = [\"reasoning.encrypted_content\"];\n\t}\n\n\t// Last so model and request sampling parameters override named request fields.\n\tconst samplingParams = resolveSamplingParams(model, reasoningEffort ?? \"off\", options?.samplingParams);\n\tif (samplingParams) {\n\t\tObject.assign(params, samplingParams);\n\t}\n\n\treturn params;\n}\n\nfunction resolveOpenAIRequestServiceTier(\n\tmodel: Model<\"openai-responses\">,\n\toptionsServiceTier: ResponsesServiceTier | undefined,\n): ResponsesServiceTier | undefined {\n\treturn openAIServiceTierForRequest(model, resolveRequestedServiceTier(model, optionsServiceTier));\n}\n"]}
1
+ {"version":3,"file":"openai-responses.js","sourceRoot":"","sources":["../../src/api/openai-responses.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAclD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAuB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACN,0BAA0B,EAC1B,qBAAqB,EACrB,gCAAgC,GAChC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAA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clampThinkingLevel } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tModel,\n\tOpenAIResponsesCompat,\n\tProviderEnv,\n\tProviderHeaders,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTranscriptContext,\n} from \"../types.ts\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { headersToRecord } from \"../utils/headers.ts\";\nimport { type ClientIdentity, getIdentityHeaders } from \"../utils/identity.ts\";\nimport { getProviderEnvValue } from \"../utils/provider-env.ts\";\nimport { retryProviderRequest } from \"../utils/provider-retry.ts\";\nimport { admitOpenAIRequests, getFetchAdmission } from \"../utils/request-admission.js\";\nimport { getProviderRetryAfterMs } from \"../utils/retry-hints.ts\";\nimport { createStreamDeadline, withStreamDeadline } from \"../utils/stream-deadline.ts\";\nimport { getDeclaredTools, resolveTranscript, resolveTranscriptTools } from \"../utils/transcript.ts\";\nimport { createGrammarToolInputProperties } from \"./constrained-sampling.ts\";\nimport {\n\tbuildCopilotDynamicHeaders,\n\thasCopilotVisionInput,\n\tpreserveCopilotIntegrationHeader,\n} from \"./github-copilot-headers.ts\";\nimport { clampOpenAIPromptCacheKey } from \"./openai-prompt-cache.ts\";\nimport {\n\tappendServiceTierRejectedWarning,\n\tapplyServiceTierPricing,\n\tassertPayloadPreservesFastRoute,\n\tconvertResponsesMessages,\n\tconvertResponsesTools,\n\tgetResponsesToolSupport,\n\tisChatGPTSubscriptionToken,\n\tisServiceTierRejection,\n\topenAIServiceTierForRequest,\n\tprocessResponsesStream,\n\ttype ResponsesServiceTier,\n\tresolveChatGPTBackendServiceTier,\n\tresolveRequestedServiceTier,\n} from \"./openai-responses-shared.ts\";\nimport { RetryHintOpenAI } from \"./openai-retry-hint-client.ts\";\nimport { buildBaseOptions, resolveSamplingParams } from \"./simple-options.ts\";\n\nconst OPENAI_TOOL_CALL_PROVIDERS = new Set([\"openai\", \"openai-api\", \"openai-codex\", \"opencode\"]);\n// OpenAI Responses rejects max_output_tokens below 16: https://github.com/earendil-works/pi/issues/6265\nconst OPENAI_RESPONSES_MIN_OUTPUT_TOKENS = 16;\nconst CHATGPT_USAGE_URL = \"https://chatgpt.com/settings/usage\";\nconst CHATGPT_WORKSPACE_LIMIT_HINT =\n\t\"You've reached your ChatGPT workspace's usage limit. Ask your workspace admin to increase it at admin.openai.com → Workspace → Usage limits.\";\nconst CONFIGURATION_UPDATE_REQUEST_EFFORT = \"medium\";\n\nfunction isChatGPTSignIn(model: Model<\"openai-responses\">, apiKey: string | undefined): boolean {\n\treturn (\n\t\tmodel.provider === \"openai\" &&\n\t\tmodel.baseUrl === \"https://api.openai.com/v1\" &&\n\t\tapiKey !== undefined &&\n\t\t!apiKey.startsWith(\"sk-\")\n\t);\n}\n\nfunction headerValue(headers: ProviderHeaders | undefined, name: string): string | undefined {\n\tif (!headers) return undefined;\n\tconst expected = name.toLowerCase();\n\tfor (const [key, value] of Object.entries(headers)) {\n\t\tif (key.toLowerCase() === expected && value !== null && value.trim().length > 0) return value.trim();\n\t}\n\treturn undefined;\n}\n\nfunction hasHeader(headers: ProviderHeaders | undefined, name: string): boolean {\n\treturn headerValue(headers, name) !== undefined;\n}\n\nfunction bearerToken(apiKey: string | undefined, headers: ProviderHeaders | undefined): string | undefined {\n\treturn apiKey ?? headerValue(headers, \"authorization\")?.replace(/^Bearer\\s+/i, \"\");\n}\n\nfunction getClientApiKey(provider: string, apiKey: string | undefined, headers: ProviderHeaders | undefined): string {\n\tif (apiKey) return apiKey;\n\tif (hasHeader(headers, \"authorization\") || hasHeader(headers, \"cf-aig-authorization\")) return \"unused\";\n\tthrow new Error(`No API key for provider: ${provider}`);\n}\n\nfunction detectSessionAffinityFormat(model: Pick<Model<\"openai-responses\">, \"provider\" | \"baseUrl\">) {\n\treturn model.provider === \"openrouter\" || model.baseUrl.includes(\"openrouter.ai\") ? \"openrouter\" : \"openai\";\n}\n\n/**\n * Resolve cache retention preference.\n * Defaults to \"short\" and uses PI_CACHE_RETENTION for backward compatibility.\n */\nfunction resolveCacheRetention(cacheRetention?: CacheRetention, env?: ProviderEnv): CacheRetention {\n\tif (cacheRetention) {\n\t\treturn cacheRetention;\n\t}\n\tif (getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\") {\n\t\treturn \"long\";\n\t}\n\treturn \"short\";\n}\n\nfunction getCompat(model: Model<\"openai-responses\">): Required<OpenAIResponsesCompat> {\n\treturn {\n\t\tsupportsDeveloperRole: model.compat?.supportsDeveloperRole ?? true,\n\t\tsupportsMidConvoSystemMessages: model.compat?.supportsMidConvoSystemMessages ?? false,\n\t\tsessionAffinityFormat: model.compat?.sessionAffinityFormat ?? detectSessionAffinityFormat(model),\n\t\tsupportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,\n\t\tsupportsStrictMode: model.compat?.supportsStrictMode ?? false,\n\t\tsupportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,\n\t\tsupportsAdditionalTools: model.compat?.supportsAdditionalTools ?? false,\n\t\tsupportsToolSearch: model.compat?.supportsToolSearch ?? false,\n\t\tsupportsExplicitPromptCacheMode: model.compat?.supportsExplicitPromptCacheMode ?? false,\n\t\tsupportsMaxOutputTokens: model.compat?.supportsMaxOutputTokens ?? true,\n\t\tsupportsMidConvoEffort: model.compat?.supportsMidConvoEffort ?? false,\n\t};\n}\n\n/** Effort to send in configuration_update items, or undefined to send it as reasoning.effort. */\nfunction getConfigurationUpdateEffort(\n\tmodel: Model<\"openai-responses\">,\n\toptions: OpenAIResponsesOptions | undefined,\n\tcompat: Required<OpenAIResponsesCompat>,\n): string | undefined {\n\tif (\n\t\t!compat.supportsMidConvoEffort ||\n\t\t!options?.reasoningEffort ||\n\t\t// Sign in with ChatGPT rejects configuration_update items.\n\t\tisChatGPTSignIn(model, options.apiKey) ||\n\t\tisChatGPTSubscriptionToken(bearerToken(options.apiKey, options.headers))\n\t) {\n\t\treturn undefined;\n\t}\n\treturn model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;\n}\n\nfunction getPromptCacheRetention(\n\tcompat: Required<OpenAIResponsesCompat>,\n\tcacheRetention: CacheRetention,\n): \"24h\" | undefined {\n\treturn cacheRetention === \"long\" && compat.supportsLongCacheRetention && !compat.supportsExplicitPromptCacheMode\n\t\t? \"24h\"\n\t\t: undefined;\n}\n\nfunction getPromptCacheOptions(\n\tcompat: Required<OpenAIResponsesCompat>,\n\tcacheRetention: CacheRetention,\n): ResponseCreateParamsStreaming[\"prompt_cache_options\"] {\n\tif (!compat.supportsExplicitPromptCacheMode) return undefined;\n\tif (cacheRetention === \"none\") return { mode: \"explicit\" };\n\tif (cacheRetention === \"long\" && compat.supportsLongCacheRetention) return { ttl: \"30m\" };\n\treturn undefined;\n}\n\n// OpenAI Responses-specific options\nexport interface OpenAIResponsesOptions extends StreamOptions {\n\treasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\treasoningSummary?: \"auto\" | \"detailed\" | \"concise\" | null;\n\tserviceTier?: ResponsesServiceTier;\n\ttoolChoice?: ResponseCreateParamsStreaming[\"tool_choice\"];\n}\n\n/**\n * Generate function for OpenAI Responses API\n */\nexport const stream: StreamFunction<\"openai-responses\", OpenAIResponsesOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\toptions?: OpenAIResponsesOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\tconst normalizedContext = resolveTranscript(context, getCompat(model).supportsMidConvoSystemMessages);\n\n\t// Start async processing\n\t(async () => {\n\t\tconst compat = getCompat(model);\n\t\tconst configurationUpdateEffort = getConfigurationUpdateEffort(model, options, compat);\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: model.api as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\t...(configurationUpdateEffort === undefined ? {} : { providerThinkingLevel: configurationUpdateEffort }),\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"pending\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\tconst streamDeadline = createStreamDeadline(options?.streamDeadlineMs, options?.signal);\n\n\t\ttry {\n\t\t\t// Create OpenAI client\n\t\t\tconst apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);\n\t\t\tconst chatGPTBackend = isChatGPTSubscriptionToken(bearerToken(options?.apiKey, options?.headers));\n\t\t\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);\n\t\t\tconst cacheSessionId = cacheRetention === \"none\" ? undefined : options?.sessionId;\n\t\t\tconst grammarToolInputProperties = createGrammarToolInputProperties(\n\t\t\t\tgetDeclaredTools(normalizedContext.messages),\n\t\t\t\tcompat.supportsOpenAIGrammarTools,\n\t\t\t);\n\t\t\tconst client = createClient(\n\t\t\t\tmodel,\n\t\t\t\tnormalizedContext,\n\t\t\t\tapiKey,\n\t\t\t\toptions?.headers,\n\t\t\t\toptions?.identity,\n\t\t\t\toptions?.fetch,\n\t\t\t\tcacheSessionId,\n\t\t\t\toptions?.apiKey,\n\t\t\t);\n\t\t\tlet params = buildParams(\n\t\t\t\tmodel,\n\t\t\t\tnormalizedContext,\n\t\t\t\toptions,\n\t\t\t\tcompat,\n\t\t\t\tgrammarToolInputProperties,\n\t\t\t\tconfigurationUpdateEffort,\n\t\t\t);\n\t\t\tconst nextParams = await options?.onPayload?.(params, model);\n\t\t\tif (nextParams !== undefined) {\n\t\t\t\tparams = nextParams as ResponseCreateParamsStreaming;\n\t\t\t}\n\t\t\tassertPayloadPreservesFastRoute(model, params);\n\t\t\tconst requestOptions = {\n\t\t\t\t...(streamDeadline.signal ? { signal: streamDeadline.signal } : {}),\n\t\t\t\t...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),\n\t\t\t\tmaxRetries: 0,\n\t\t\t};\n\t\t\tconst sendRequest = (requestParams: ResponseCreateParamsStreaming) =>\n\t\t\t\tretryProviderRequest(() => client.responses.create(requestParams, requestOptions).withResponse(), {\n\t\t\t\t\tmaxRetries: options?.maxRetries,\n\t\t\t\t\tmaxRetryDelayMs: options?.maxRetryDelayMs,\n\t\t\t\t\tsignal: streamDeadline.signal,\n\t\t\t\t});\n\t\t\tlet startEmitted = false;\n\t\t\t// Every attempt reports its HTTP response before its body is consumed, and the message stream starts\n\t\t\t// once. A streamed request reports a rejected service_tier as an `error` event after HTTP 200, so the\n\t\t\t// response preamble is read before the request counts as accepted.\n\t\t\tconst openStream = async (requestParams: ResponseCreateParamsStreaming) => {\n\t\t\t\tconst { data, response } = await sendRequest(requestParams);\n\t\t\t\tawait options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n\t\t\t\tif (!startEmitted) {\n\t\t\t\t\tstartEmitted = true;\n\t\t\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\t\t}\n\t\t\t\treturn readResponsePreamble(withStreamDeadline(data, streamDeadline.deadlineMs, streamDeadline.abort));\n\t\t\t};\n\t\t\tlet requestedServiceTier = resolveOpenAIRequestServiceTier(model, options?.serviceTier);\n\t\t\tlet openaiStream: Awaited<ReturnType<typeof openStream>>;\n\t\t\ttry {\n\t\t\t\topenaiStream = await openStream(params);\n\t\t\t} catch (error) {\n\t\t\t\tif (params.service_tier == null || !isServiceTierRejection(error)) throw error;\n\t\t\t\tconst rejectedServiceTier = params.service_tier;\n\t\t\t\tconst { service_tier: _rejectedServiceTier, ...defaultTierParams } = params;\n\t\t\t\topenaiStream = await openStream(defaultTierParams);\n\t\t\t\trequestedServiceTier = undefined;\n\t\t\t\tappendServiceTierRejectedWarning(output, model, rejectedServiceTier);\n\t\t\t}\n\n\t\t\tawait processResponsesStream(openaiStream, output, stream, model, {\n\t\t\t\tonProviderStreamEvent: options?.onProviderStreamEvent,\n\t\t\t\tserviceTier: requestedServiceTier,\n\t\t\t\tgrammarToolInputProperties,\n\t\t\t\tapplyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),\n\t\t\t\t...(chatGPTBackend\n\t\t\t\t\t? { resolveServiceTier: resolveChatGPTBackendServiceTier }\n\t\t\t\t\t: { warnOnServiceTierDowngrade: true }),\n\t\t\t});\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"pending\") {\n\t\t\t\tthrow new Error(\"OpenAI Responses stream ended without a stop reason\");\n\t\t\t}\n\t\t\tif (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n\t\t\t\tthrow new Error(output.errorMessage || \"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\tdelete (block as { index?: number }).index;\n\t\t\t\t// Streaming scratch buffers are only used during parsing; never persist them.\n\t\t\t\tdelete (block as { partialJson?: string }).partialJson;\n\t\t\t\tdelete (block as { customInput?: unknown }).customInput;\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.retryAfterMs = error instanceof Error ? getProviderRetryAfterMs(error) : undefined;\n\t\t\tconst errorMessage = formatProviderError(\n\t\t\t\tnormalizeProviderError(error),\n\t\t\t\t`${model.provider === \"openai\" || model.provider === \"openai-api\" ? \"OpenAI\" : model.provider} API error`,\n\t\t\t);\n\t\t\t// On ChatGPT Business plans, the workspace admin also sets a per-user limit.\n\t\t\tif (errorMessage.includes(\"subscription_sharing_usage_limit_exceeded\")) {\n\t\t\t\toutput.errorMessage = `${errorMessage}\\nCheck your ChatGPT usage: ${CHATGPT_USAGE_URL}`;\n\t\t\t} else if (errorMessage.includes(\"subscription_sharing_workplace_individual_usage_limit_exceeded\")) {\n\t\t\t\toutput.errorMessage = `${errorMessage}\\n${CHATGPT_WORKSPACE_LIMIT_HINT}`;\n\t\t\t} else {\n\t\t\t\toutput.errorMessage = errorMessage;\n\t\t\t}\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t} finally {\n\t\t\tstreamDeadline.cleanup();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nconst RESPONSE_PREAMBLE_EVENT_TYPES = new Set([\"response.created\", \"response.in_progress\", \"response.queued\"]);\n\nfunction failedResponseTierRejection(event: { type: string } | undefined): Error | undefined {\n\tif (event?.type !== \"response.failed\") return undefined;\n\tconst failure = (event as { response?: { error?: { code?: string | null; message?: string } | null } }).response\n\t\t?.error;\n\tif (!failure?.message) return undefined;\n\tconst error = new Error(failure.message);\n\treturn isServiceTierRejection(error) ? error : undefined;\n}\n\n/**\n * Read a stream up to its first event after the response preamble, so an error the server raises\n * before producing output is thrown here. Returns a stream that replays every event read.\n */\nasync function readResponsePreamble<T extends { type: string }>(events: AsyncIterable<T>): Promise<AsyncIterable<T>> {\n\tconst iterator = events[Symbol.asyncIterator]();\n\tconst preamble: T[] = [];\n\tlet done = false;\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst next = await iterator.next();\n\t\t\tif (next.done) {\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpreamble.push(next.value);\n\t\t\tif (!RESPONSE_PREAMBLE_EVENT_TYPES.has(next.value.type)) break;\n\t\t}\n\t} catch (error) {\n\t\tawait iterator.return?.();\n\t\tthrow error;\n\t}\n\tconst tierRejection = failedResponseTierRejection(preamble.at(-1));\n\tif (tierRejection) {\n\t\tawait iterator.return?.();\n\t\tthrow tierRejection;\n\t}\n\treturn (async function* () {\n\t\ttry {\n\t\t\tyield* preamble;\n\t\t\tif (done) return;\n\t\t\tfor (;;) {\n\t\t\t\tconst next = await iterator.next();\n\t\t\t\tif (next.done) return;\n\t\t\t\tyield next.value;\n\t\t\t}\n\t\t} finally {\n\t\t\tawait iterator.return?.();\n\t\t}\n\t})();\n}\n\nexport const streamSimple: StreamFunction<\"openai-responses\", SimpleStreamOptions> = (\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tgetClientApiKey(model.provider, options?.apiKey, options?.headers);\n\n\tconst base = {\n\t\t...buildBaseOptions(model, context, options, options?.apiKey),\n\t\ttoolChoice: options?.toolChoice,\n\t} satisfies OpenAIResponsesOptions;\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort = clampedReasoning === \"off\" ? undefined : clampedReasoning;\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies OpenAIResponsesOptions);\n};\n\nfunction createClient(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\tapiKey: string,\n\toptionsHeaders?: ProviderHeaders,\n\tidentity?: ClientIdentity,\n\tfetch?: typeof globalThis.fetch,\n\tsessionId?: string,\n\tcopilotApiKey?: string,\n) {\n\tconst compat = getCompat(model);\n\tconst headers: ProviderHeaders = { ...getIdentityHeaders(model, identity), ...model.headers };\n\tif (model.provider === \"github-copilot\") {\n\t\tconst hasImages = hasCopilotVisionInput(context.messages);\n\t\tconst copilotHeaders = preserveCopilotIntegrationHeader(\n\t\t\tmodel.headers,\n\t\t\tbuildCopilotDynamicHeaders({\n\t\t\t\tmessages: context.messages,\n\t\t\t\thasImages,\n\t\t\t\tapiKey: copilotApiKey,\n\t\t\t}),\n\t\t);\n\t\tObject.assign(headers, copilotHeaders);\n\t}\n\n\tif (sessionId) {\n\t\tif (compat.sessionAffinityFormat === \"openrouter\") {\n\t\t\theaders[\"x-session-id\"] = sessionId;\n\t\t} else {\n\t\t\tif (compat.sessionAffinityFormat === \"openai\") {\n\t\t\t\theaders.session_id = sessionId;\n\t\t\t}\n\t\t\theaders[\"x-client-request-id\"] = sessionId;\n\t\t}\n\t}\n\n\t// Merge options headers last so they can override defaults\n\tif (optionsHeaders) {\n\t\tObject.assign(headers, optionsHeaders);\n\t}\n\n\treturn admitOpenAIRequests(\n\t\tnew RetryHintOpenAI({\n\t\t\tapiKey,\n\t\t\tbaseURL: model.baseUrl,\n\t\t\tdangerouslyAllowBrowser: true,\n\t\t\tfetch: getFetchAdmission(fetch)?.fetch ?? fetch,\n\t\t\tdefaultHeaders: headers,\n\t\t}),\n\t\tfetch,\n\t);\n}\n\nfunction buildParams(\n\tmodel: Model<\"openai-responses\">,\n\tcontext: TranscriptContext,\n\toptions: OpenAIResponsesOptions | undefined,\n\tcompat: Required<OpenAIResponsesCompat>,\n\tgrammarToolInputProperties: ReadonlyMap<string, string>,\n\tconfigurationUpdateEffort: string | undefined,\n) {\n\tconst transcriptTools = resolveTranscriptTools(context.messages, getResponsesToolSupport(compat));\n\tconst messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {\n\t\tgrammarToolInputProperties,\n\t\tsupportsMidConvoSystemMessages: compat.supportsMidConvoSystemMessages,\n\t\tsupportsAdditionalTools: compat.supportsAdditionalTools,\n\t\tsupportsToolSearch: compat.supportsToolSearch,\n\t\ttoolOptions: {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t},\n\t\tconfigurationUpdateEffort,\n\t});\n\n\tconst cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);\n\tconst omitUnsupportedFields = isChatGPTSignIn(model, options?.apiKey);\n\tconst params: ResponseCreateParamsStreaming = {\n\t\t// A fast variant keeps its canonical `-fast` id on the model object — that is the identity the\n\t\t// caller selected and records — while routing to the base upstream model plus a service tier.\n\t\tmodel: model.fastRoute?.upstreamModelId ?? model.id,\n\t\tinput: messages,\n\t\tstream: true,\n\t\tprompt_cache_key: cacheRetention === \"none\" ? undefined : clampOpenAIPromptCacheKey(options?.sessionId),\n\t\tprompt_cache_retention: omitUnsupportedFields ? undefined : getPromptCacheRetention(compat, cacheRetention),\n\t\tprompt_cache_options: omitUnsupportedFields ? undefined : getPromptCacheOptions(compat, cacheRetention),\n\t\tstore: false,\n\t};\n\n\tif (options?.maxTokens && compat.supportsMaxOutputTokens && !omitUnsupportedFields) {\n\t\tparams.max_output_tokens = Math.max(options.maxTokens, OPENAI_RESPONSES_MIN_OUTPUT_TOKENS);\n\t}\n\n\tif (options?.temperature !== undefined && !omitUnsupportedFields) {\n\t\tparams.temperature = options?.temperature;\n\t}\n\n\tconst requestedServiceTier = resolveOpenAIRequestServiceTier(model, options?.serviceTier);\n\tif (requestedServiceTier !== undefined) {\n\t\tparams.service_tier = requestedServiceTier;\n\t}\n\n\tif (transcriptTools.requestTools.length > 0) {\n\t\tparams.tools = convertResponsesTools(transcriptTools.requestTools, {\n\t\t\tsupportsStrictMode: compat.supportsStrictMode,\n\t\t\tsupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,\n\t\t});\n\t}\n\n\tif (options?.toolChoice !== undefined) {\n\t\tparams.tool_choice = options.toolChoice;\n\t}\n\n\tconst reasoningEffort = options?.reasoningEffort ?? (options?.reasoningSummary ? \"medium\" : undefined);\n\tif (model.reasoning) {\n\t\tif (reasoningEffort) {\n\t\t\tconst requestedEffort = options?.reasoningEffort\n\t\t\t\t? (model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort)\n\t\t\t\t: reasoningEffort;\n\t\t\tconst effort = configurationUpdateEffort === undefined ? requestedEffort : CONFIGURATION_UPDATE_REQUEST_EFFORT;\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: effort as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t\tsummary: options?.reasoningSummary || \"auto\",\n\t\t\t};\n\t\t\tparams.include = [\"reasoning.encrypted_content\"];\n\t\t} else if (model.provider !== \"github-copilot\" && model.thinkingLevelMap?.off !== null) {\n\t\t\tparams.reasoning = {\n\t\t\t\teffort: (model.thinkingLevelMap?.off ?? \"none\") as NonNullable<typeof params.reasoning>[\"effort\"],\n\t\t\t};\n\t\t}\n\t\tif (model.provider === \"xai\") params.include = [\"reasoning.encrypted_content\"];\n\t}\n\n\t// Last so model and request sampling parameters override named request fields.\n\tconst samplingParams = resolveSamplingParams(model, reasoningEffort ?? \"off\", options?.samplingParams);\n\tif (samplingParams) {\n\t\tObject.assign(params, samplingParams);\n\t}\n\n\treturn params;\n}\n\nfunction resolveOpenAIRequestServiceTier(\n\tmodel: Model<\"openai-responses\">,\n\toptionsServiceTier: ResponsesServiceTier | undefined,\n): ResponsesServiceTier | undefined {\n\treturn openAIServiceTierForRequest(model, resolveRequestedServiceTier(model, optionsServiceTier));\n}\n"]}
@@ -141,6 +141,10 @@ export type AuthEvent = {
141
141
  type: "device_code";
142
142
  userCode: string;
143
143
  verificationUri: string;
144
+ /** Offer best-effort browser opening on user confirmation. Defaults to true; clients may ignore it. */
145
+ openBrowserOnConfirm?: boolean;
146
+ /** Offer copying of userCode on user confirmation, replacing the clipboard. Defaults to true. */
147
+ copyCodeOnConfirm?: boolean;
144
148
  intervalSeconds?: number;
145
149
  expiresInSeconds?: number;
146
150
  } | {
@@ -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,WAAW,SAAS;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB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,CAAC,CAAC;IAE9F;;;OAGG;IACH,OAAO,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEpF;;;;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"}
@@ -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/** Optional cancellation for public auth and credential operations. */\nexport interface AuthOperationOptions {\n\tsignal?: AbortSignal;\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, options?: AuthOperationOptions): 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(options?: AuthOperationOptions): 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\toptions?: AuthOperationOptions,\n\t): Promise<Credential | undefined>;\n\n\t/** Remove a credential (logout). Implementations serialize this against `modify`. */\n\tdelete(providerId: string, options?: AuthOperationOptions): 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/** Normalized interaction passed to provider login implementations. */\nexport type ProviderAuthInteraction = AuthInteraction & { signal: AbortSignal };\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: ProviderAuthInteraction): Promise<ApiKeyCredential>;\n\n\t/**\n\t * Provider ids whose stored api-key credentials this provider reuses, in\n\t * precedence order. A borrowing provider has no stored credential of its\n\t * own; anything stored under its id is ignored. The first\n\t * listed provider with a stored api-key credential that has a key is passed\n\t * to `resolve()` as `credential`; stored OAuth credentials and key-less\n\t * api-key credentials are skipped. When none qualifies, `resolve()` runs\n\t * without a credential, so ambient sources (env vars) still apply. Pair with\n\t * an absent `login`.\n\t */\n\tborrowCredentialsFrom?: readonly string[];\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: {\n\t\tctx: AuthContext;\n\t\tcredential?: ApiKeyCredential;\n\t\tsignal: AbortSignal;\n\t}): 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: {\n\t\tctx: AuthContext;\n\t\tcredential?: ApiKeyCredential;\n\t\tsignal: AbortSignal;\n\t}): Promise<AuthResult | undefined>;\n}\n\n/** App context supplied to provider login flows. */\nexport interface LoginOptions {\n\t/** Stable UUID for this installation, created lazily by the app. */\n\tgetDeviceId?: () => string;\n\t/** App name used for OpenAI's agent name hint and Codex browser login originator. */\n\tagentName?: string;\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/** Whether access through this auth method is backed by a provider subscription. */\n\tisSubscription?: boolean;\n\n\t/** Selector label for the OAuth login option, e.g. \"Sign in with SuperGrok or X Premium\". */\n\tloginLabel?: string;\n\n\tusesCallbackServer?: boolean;\n\n\tlogin(interaction: ProviderAuthInteraction, options?: LoginOptions): 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/** Optional cancellation for public auth and credential operations. */\nexport interface AuthOperationOptions {\n\tsignal?: AbortSignal;\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, options?: AuthOperationOptions): 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(options?: AuthOperationOptions): 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\toptions?: AuthOperationOptions,\n\t): Promise<Credential | undefined>;\n\n\t/** Remove a credential (logout). Implementations serialize this against `modify`. */\n\tdelete(providerId: string, options?: AuthOperationOptions): 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\t/** Offer best-effort browser opening on user confirmation. Defaults to true; clients may ignore it. */\n\t\t\topenBrowserOnConfirm?: boolean;\n\t\t\t/** Offer copying of userCode on user confirmation, replacing the clipboard. Defaults to true. */\n\t\t\tcopyCodeOnConfirm?: boolean;\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/** Normalized interaction passed to provider login implementations. */\nexport type ProviderAuthInteraction = AuthInteraction & { signal: AbortSignal };\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: ProviderAuthInteraction): Promise<ApiKeyCredential>;\n\n\t/**\n\t * Provider ids whose stored api-key credentials this provider reuses, in\n\t * precedence order. A borrowing provider has no stored credential of its\n\t * own; anything stored under its id is ignored. The first\n\t * listed provider with a stored api-key credential that has a key is passed\n\t * to `resolve()` as `credential`; stored OAuth credentials and key-less\n\t * api-key credentials are skipped. When none qualifies, `resolve()` runs\n\t * without a credential, so ambient sources (env vars) still apply. Pair with\n\t * an absent `login`.\n\t */\n\tborrowCredentialsFrom?: readonly string[];\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: {\n\t\tctx: AuthContext;\n\t\tcredential?: ApiKeyCredential;\n\t\tsignal: AbortSignal;\n\t}): 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: {\n\t\tctx: AuthContext;\n\t\tcredential?: ApiKeyCredential;\n\t\tsignal: AbortSignal;\n\t}): Promise<AuthResult | undefined>;\n}\n\n/** App context supplied to provider login flows. */\nexport interface LoginOptions {\n\t/** Stable UUID for this installation, created lazily by the app. */\n\tgetDeviceId?: () => string;\n\t/** App name used for OpenAI's agent name hint and Codex browser login originator. */\n\tagentName?: string;\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/** Whether access through this auth method is backed by a provider subscription. */\n\tisSubscription?: boolean;\n\n\t/** Selector label for the OAuth login option, e.g. \"Sign in with SuperGrok or X Premium\". */\n\tloginLabel?: string;\n\n\tusesCallbackServer?: boolean;\n\n\tlogin(interaction: ProviderAuthInteraction, options?: LoginOptions): 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"]}
@@ -14,6 +14,10 @@ export interface OAuthAuthInfo {
14
14
  export interface OAuthDeviceCodeInfo {
15
15
  userCode: string;
16
16
  verificationUri: string;
17
+ /** Offer best-effort browser opening on user confirmation. Defaults to true; clients may ignore it. */
18
+ openBrowserOnConfirm?: boolean;
19
+ /** Offer copying of userCode on user confirmation, replacing the clipboard. Defaults to true. */
20
+ copyCodeOnConfirm?: boolean;
17
21
  intervalSeconds?: number;
18
22
  expiresInSeconds?: number;
19
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AM,GAAG,IAAI,CAAC;IACnC,iBAAiB,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"extension-oauth-types.js","sourceRoot":"","sources":["../../src/compat/extension-oauth-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { OAuthCredentials } from \"../auth/types.ts\";\n\n/** Legacy extension OAuth prompt. */\nexport interface OAuthPrompt {\n\tmessage: string;\n\tplaceholder?: string;\n\tallowEmpty?: boolean;\n}\n\n/** Legacy extension OAuth authorization link. */\nexport interface OAuthAuthInfo {\n\turl: string;\n\tinstructions?: string;\n}\n\n/** Legacy extension OAuth device-code notification. */\nexport interface OAuthDeviceCodeInfo {\n\tuserCode: string;\n\tverificationUri: string;\n\tintervalSeconds?: number;\n\texpiresInSeconds?: number;\n}\n\nexport interface OAuthSelectOption {\n\tid: string;\n\tlabel: string;\n}\n\nexport interface OAuthSelectPrompt {\n\tmessage: string;\n\toptions: OAuthSelectOption[];\n}\n\n/** Callback surface retained only for coding-agent extension compatibility. */\nexport interface OAuthLoginCallbacks {\n\tonAuth(info: OAuthAuthInfo): void;\n\tonDeviceCode(info: OAuthDeviceCodeInfo): void;\n\tonPrompt(prompt: OAuthPrompt): Promise<string>;\n\tonProgress?(message: string): void;\n\tonManualCodeInput?(): Promise<string>;\n\tonSelect(prompt: OAuthSelectPrompt): Promise<string | undefined>;\n\tsignal?: AbortSignal;\n}\n\nexport type { OAuthCredentials };\n"]}
1
+ {"version":3,"file":"extension-oauth-types.js","sourceRoot":"","sources":["../../src/compat/extension-oauth-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { OAuthCredentials } from \"../auth/types.ts\";\n\n/** Legacy extension OAuth prompt. */\nexport interface OAuthPrompt {\n\tmessage: string;\n\tplaceholder?: string;\n\tallowEmpty?: boolean;\n}\n\n/** Legacy extension OAuth authorization link. */\nexport interface OAuthAuthInfo {\n\turl: string;\n\tinstructions?: string;\n}\n\n/** Legacy extension OAuth device-code notification. */\nexport interface OAuthDeviceCodeInfo {\n\tuserCode: string;\n\tverificationUri: string;\n\t/** Offer best-effort browser opening on user confirmation. Defaults to true; clients may ignore it. */\n\topenBrowserOnConfirm?: boolean;\n\t/** Offer copying of userCode on user confirmation, replacing the clipboard. Defaults to true. */\n\tcopyCodeOnConfirm?: boolean;\n\tintervalSeconds?: number;\n\texpiresInSeconds?: number;\n}\n\nexport interface OAuthSelectOption {\n\tid: string;\n\tlabel: string;\n}\n\nexport interface OAuthSelectPrompt {\n\tmessage: string;\n\toptions: OAuthSelectOption[];\n}\n\n/** Callback surface retained only for coding-agent extension compatibility. */\nexport interface OAuthLoginCallbacks {\n\tonAuth(info: OAuthAuthInfo): void;\n\tonDeviceCode(info: OAuthDeviceCodeInfo): void;\n\tonPrompt(prompt: OAuthPrompt): Promise<string>;\n\tonProgress?(message: string): void;\n\tonManualCodeInput?(): Promise<string>;\n\tonSelect(prompt: OAuthSelectPrompt): Promise<string | undefined>;\n\tsignal?: AbortSignal;\n}\n\nexport type { OAuthCredentials };\n"]}
@@ -1 +1 @@
1
- {"schemaVersion":6,"generatedAt":"2026-10-22T07:55:37.612Z","structureHash":"b17c508fd2681aa5de5b6adb387ab0247b25e931a797cb32b6634e1dc71a3456","files":{"amazon-bedrock.json":"6f3903019d55d747246493bb76b53ad9557ba694b8a53327460b654712baff3a","ant-ling.json":"628feab3ef6c7d80ce96f75999804e1d9f05fec3851e5302e30fff3b69db90f6","anthropic.json":"f797095e492df25157b14e399ff8030b4d0a75e698f415534cc79f606cf99ffb","azure.json":"b5cadb3c4b0a93c8558cf99927e0f00deee5ba0a1b4c8329dc12dc3be99b2b94","baseten.json":"5bd3c98c61769388b3724368ef964d16b7a58e41a6edcf4ebceb9d4ac0a21d3b","cerebras.json":"2eb969b2956844f9a641d3de52c19f1791293c58f607282fb3b0ebfe85ff66f8","cloudflare-ai-gateway.json":"0e06e0b4ad5710a1f4ae3076bea136f0a3bd47e2be35ead8ae714b65d22a936a","cloudflare-workers-ai.json":"36c80c7d7606465001706d5b5d8612d825d8c501d20efb994599960693d37d43","deepseek.json":"10a296fb3e898f7715c80890c8af0af4f5fd58f22dbcd6612fdc5d762157ccdc","fireworks.json":"8e862806b0a69cefc6585c38b103de1baae782c51409748c6d16199daedcf1ca","github-copilot.json":"0073eada8bccd1af1898af5d723de80c1aca056df2e79724bc74165de46ee737","google-vertex.json":"564d692a4292ef12e98c8ec056a39948ea64e10851f5ddaaebcc37b585545231","google.json":"b61fb0e27da5be60e1112e46955c5923656cb4d62bb221f834a9463d764ef5de","groq.json":"087df37206e9eed8b10f1e558e4c496289bef60074b7e8afba4f20fb102b4ec2","huggingface.json":"a76d8fa3043d72c80a11c7ff4bcbba07ecb0c87913d8d38dc3cd1001d44b0706","kimi-coding.json":"728d5ddb63ef52130552022d5ae2fd138fdc131ff854ac8c3b10ccaad355ab39","meta.json":"563f5ec07973f52ab8c3eb26ef91a36ad8a79e950b37174935666cdcb624bf35","minimax-cn.json":"fa15d1f67a07046d38e191af9bd97ed922ba45a99a11af4ad281151cc6b762aa","minimax.json":"1e0459dda3858ea24151182106fc4179b95f43a0a8dffc1c3d2e7db4c2d9206e","mistral.json":"066079b17e077eb793ffa9574acd5f2bbe4d4f9566b12b6207a7c9b19b2db413","moonshotai-cn.json":"0dbd6b063a0abdbe55d5dc59dd4dade566c2ea817ad6184bc8d20655ecba1daf","moonshotai.json":"1da2c4e34f22aef17a07c974d85bdee8e1b68b6dc712e3769c935b3f1e7dadca","nvidia.json":"4a80c26d6ad935eb5954b5be23239c899e231cdf7a49bbe2d2b4130ffc74b15d","openai-codex.json":"d20e2c769968eb4070df70a73cc093aebd741fb734532cbb5b0a8b61b36b61de","openai-decisions.json":"0c7d54fcbac5e7388872a85c0db7f336c5a57c82d403266e9ae04f87561daf4f","openai-images.json":"885b1c5ec4198ebe2b73518e61cbf989a7cad9229d01813635f361b29a909562","openai.json":"6b8461776f8367d160fff29253c0326f74af1fc41258c77e6bf7151a33d20e35","opencode-go.json":"6440508e9aaaf543181b3b8968d796ba851658f650eeb334c761f50291e3521b","opencode.json":"d21b313bbbf2f34007b69770c867d102ef3402fb7837beaa403276ba7e60290b","openrouter.json":"c8089ab0ff184adb8bf12cb89d51011eb9bee96df29fff45ceb9a896374fd1e2","qwen-token-plan-cn.json":"64427a6adeb3e7dd1857d68bef9bb12097632b646ed151b740e209143e31341e","qwen-token-plan-individual.json":"0fb7cf64faf39d1a3b0a884210a86c87084b805eda15644f5f39293287b959dd","qwen-token-plan.json":"37b9a76c54090228d1026a8f0fcb4d304b00d64b1a3a94cb2ae6e677d2c52b13","radius.json":"c1f94d967d3adf99aa3072b869c4c9b836886824f992efeca5889f99c06b0f5f","together.json":"2a28fa1978c996ac0a7f0fc07f0c98a37dbf282afe77c0f141dab0c36791ef83","typesafe.json":"938c89dfb6f636dce1483ec6acc739af4b881f61003d007807a74414eb2bf357","vercel-ai-gateway.json":"b33857545b54c6492675a3eb0656b6aa5d4234b8227c3b5bfd7d1a136156aa16","xai.json":"59f8a7bdf14e79ba1b0d0a37e56251bbf100420bdac7d6af5942508fdb990f11","xiaomi-token-plan-ams.json":"bfd33741da693bdb8e8ebd4e7b90c3e90820aa18432ad081a5a98db13c6bd296","xiaomi-token-plan-cn.json":"4b61d78feae3a926fda918c3fd3a9afaf2ca60c1bba0af8270a5398fb50a983e","xiaomi-token-plan-sgp.json":"b05a197ce24fd69fc9440f4ba929984ac7a0fefbe8083268734b422e721987ec","xiaomi.json":"495b5fddf3c3ec8904fecc15c4c19536f4961dce7b51512b6909d2df2e739824","zai-coding-cn.json":"cc9e0768e726ef55d2b7af853ac5f3585dc72575932cb38840a3877d18736b78","zai.json":"58e6642fdfb736f0b9a4a277c760c536a3cea66a030abbfb2615f7b2851d5c6f"}}
1
+ {"schemaVersion":6,"generatedAt":"2026-10-23T09:06:12.037Z","structureHash":"a49fadb3b72d9400cd5f9c892ca1f2ec869f0dfed92d445202cf1b23b33dea13","files":{"amazon-bedrock.json":"6f3903019d55d747246493bb76b53ad9557ba694b8a53327460b654712baff3a","ant-ling.json":"628feab3ef6c7d80ce96f75999804e1d9f05fec3851e5302e30fff3b69db90f6","anthropic.json":"f797095e492df25157b14e399ff8030b4d0a75e698f415534cc79f606cf99ffb","azure.json":"b5cadb3c4b0a93c8558cf99927e0f00deee5ba0a1b4c8329dc12dc3be99b2b94","baseten.json":"5bd3c98c61769388b3724368ef964d16b7a58e41a6edcf4ebceb9d4ac0a21d3b","cerebras.json":"2eb969b2956844f9a641d3de52c19f1791293c58f607282fb3b0ebfe85ff66f8","cloudflare-ai-gateway.json":"0e06e0b4ad5710a1f4ae3076bea136f0a3bd47e2be35ead8ae714b65d22a936a","cloudflare-workers-ai.json":"36c80c7d7606465001706d5b5d8612d825d8c501d20efb994599960693d37d43","deepseek.json":"10a296fb3e898f7715c80890c8af0af4f5fd58f22dbcd6612fdc5d762157ccdc","fireworks.json":"dae512231a827203db11907889cf235fda8ea4ee10447d6376d83ed712b372a2","github-copilot.json":"0073eada8bccd1af1898af5d723de80c1aca056df2e79724bc74165de46ee737","google-vertex.json":"564d692a4292ef12e98c8ec056a39948ea64e10851f5ddaaebcc37b585545231","google.json":"b61fb0e27da5be60e1112e46955c5923656cb4d62bb221f834a9463d764ef5de","groq.json":"087df37206e9eed8b10f1e558e4c496289bef60074b7e8afba4f20fb102b4ec2","huggingface.json":"2c78f762f4aa8d0e351f53d4c3fa971557175f315f1c6e3c63ddb45dd764151b","kimi-coding.json":"728d5ddb63ef52130552022d5ae2fd138fdc131ff854ac8c3b10ccaad355ab39","meta.json":"563f5ec07973f52ab8c3eb26ef91a36ad8a79e950b37174935666cdcb624bf35","minimax-cn.json":"fa15d1f67a07046d38e191af9bd97ed922ba45a99a11af4ad281151cc6b762aa","minimax.json":"1e0459dda3858ea24151182106fc4179b95f43a0a8dffc1c3d2e7db4c2d9206e","mistral.json":"09ff08882f868976c6e6c84072ccb82cc7b19e1044799e5da451626c963d6396","moonshotai-cn.json":"0dbd6b063a0abdbe55d5dc59dd4dade566c2ea817ad6184bc8d20655ecba1daf","moonshotai.json":"1da2c4e34f22aef17a07c974d85bdee8e1b68b6dc712e3769c935b3f1e7dadca","nvidia.json":"6f66192c21788b4555f7e77bd7c14201172edf355be8d318f96ff8d0d6921054","openai-codex.json":"d20e2c769968eb4070df70a73cc093aebd741fb734532cbb5b0a8b61b36b61de","openai-decisions.json":"0c7d54fcbac5e7388872a85c0db7f336c5a57c82d403266e9ae04f87561daf4f","openai-images.json":"885b1c5ec4198ebe2b73518e61cbf989a7cad9229d01813635f361b29a909562","openai.json":"6b8461776f8367d160fff29253c0326f74af1fc41258c77e6bf7151a33d20e35","opencode-go.json":"9ae3a23a7faf1e57b612cdff98d1533614b63ad3f6f4c88a475e2897c73bdcbe","opencode.json":"fdbb182d25ce8214bf27952a879fbec70f1d0532addb5121a3bb63a37889ff79","openrouter.json":"92a3c1a779b0f66b06376176df2d487c5d806ea13c97914d18d56f6e3c129e5a","qwen-token-plan-cn.json":"64427a6adeb3e7dd1857d68bef9bb12097632b646ed151b740e209143e31341e","qwen-token-plan-individual.json":"0fb7cf64faf39d1a3b0a884210a86c87084b805eda15644f5f39293287b959dd","qwen-token-plan.json":"37b9a76c54090228d1026a8f0fcb4d304b00d64b1a3a94cb2ae6e677d2c52b13","radius.json":"c1f94d967d3adf99aa3072b869c4c9b836886824f992efeca5889f99c06b0f5f","together.json":"2a28fa1978c996ac0a7f0fc07f0c98a37dbf282afe77c0f141dab0c36791ef83","typesafe.json":"938c89dfb6f636dce1483ec6acc739af4b881f61003d007807a74414eb2bf357","vercel-ai-gateway.json":"e703243fd447ba679e0e5ed80d4ab2e99fe935670bb4ef69ffa17ace0bd3c00a","xai.json":"59f8a7bdf14e79ba1b0d0a37e56251bbf100420bdac7d6af5942508fdb990f11","xiaomi-token-plan-ams.json":"bfd33741da693bdb8e8ebd4e7b90c3e90820aa18432ad081a5a98db13c6bd296","xiaomi-token-plan-cn.json":"4b61d78feae3a926fda918c3fd3a9afaf2ca60c1bba0af8270a5398fb50a983e","xiaomi-token-plan-sgp.json":"b05a197ce24fd69fc9440f4ba929984ac7a0fefbe8083268734b422e721987ec","xiaomi.json":"495b5fddf3c3ec8904fecc15c4c19536f4961dce7b51512b6909d2df2e739824","zai-coding-cn.json":"cc9e0768e726ef55d2b7af853ac5f3585dc72575932cb38840a3877d18736b78","zai.json":"58e6642fdfb736f0b9a4a277c760c536a3cea66a030abbfb2615f7b2851d5c6f"}}
@@ -1 +1 @@
1
- {"anthropic-messages":{"chat:accounts/fireworks/models/deepseek-v4p1-flash":{"id":"accounts/fireworks/models/deepseek-v4p1-flash","name":"DeepSeek V4.1 Flash","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/deepseek-v4p1-flash-1017":{"id":"accounts/fireworks/models/deepseek-v4p1-flash-1017","name":"DeepSeek V4.1 Flash 1017","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/ember-1":{"id":"accounts/fireworks/models/ember-1","name":"Ember-1","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/gpt-oss-120b":{"id":"accounts/fireworks/models/gpt-oss-120b","name":"GPT OSS 120B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.015,"cacheWrite":0},"contextWindow":131072,"maxTokens":32768,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:accounts/fireworks/models/inkling":{"id":"accounts/fireworks/models/inkling","name":"Inkling","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":4.05,"cacheRead":0.17,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/minimax-m3":{"id":"accounts/fireworks/models/minimax-m3","name":"MiniMax-M3","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.06,"cacheWrite":0},"contextWindow":512000,"maxTokens":512000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:accounts/fireworks/models/muse-spark-open":{"id":"accounts/fireworks/models/muse-spark-open","name":"Muse Spark Open","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":4.25,"cacheRead":0.15,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/nemotron-3-ultra-nvfp4":{"id":"accounts/fireworks/models/nemotron-3-ultra-nvfp4","name":"Nemotron 3 Ultra 550B A55B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.6,"output":2.4,"cacheRead":0.12,"cacheWrite":0},"contextWindow":262144,"maxTokens":128000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"type":"chat"},"chat:accounts/fireworks/models/nemotron-lightning-3p5-30b-a3b":{"id":"accounts/fireworks/models/nemotron-lightning-3p5-30b-a3b","name":"Nemotron 3.5 Lightning 30B A3B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.05,"output":0.2,"cacheRead":0.01,"cacheWrite":0},"contextWindow":262144,"maxTokens":262144,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"type":"chat"},"chat:accounts/fireworks/models/qwen3p8-2p4t-a95b":{"id":"accounts/fireworks/models/qwen3p8-2p4t-a95b","name":"Qwen3.8 2.4T A95B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":2,"output":6,"cacheRead":0.25,"cacheWrite":0},"contextWindow":262144,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":null,"xhigh":"xhigh","max":null},"type":"chat"},"chat:accounts/fireworks/models/qwen3p8-max":{"id":"accounts/fireworks/models/qwen3p8-max","name":"Qwen3.8 Max","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.25,"cacheWrite":0},"contextWindow":262144,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":null,"xhigh":"xhigh","max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/deepseek-flash-latest":{"id":"accounts/fireworks/routers/deepseek-flash-latest","name":"DeepSeek Flash Latest","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/kimi-fast-latest":{"id":"accounts/fireworks/routers/kimi-fast-latest","name":"Kimi Fast Latest","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":4.5,"output":22.5,"cacheRead":0.45,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/kimi-latest":{"id":"accounts/fireworks/routers/kimi-latest","name":"Kimi Latest","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/minimax-latest":{"id":"accounts/fireworks/routers/minimax-latest","name":"MiniMax Latest","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.06,"cacheWrite":0},"contextWindow":512000,"maxTokens":512000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:accounts/fireworks/routers/qwen-max-latest":{"id":"accounts/fireworks/routers/qwen-max-latest","name":"Qwen Max Latest (Qwen3.8 Max)","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.25,"cacheWrite":0},"contextWindow":262144,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}},"openai-completions":{"chat:accounts/fireworks/models/glm-5p3":{"id":"accounts/fireworks/models/glm-5p3","name":"GLM 5.3","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":1048573,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/models/glm-5p3-flash":{"id":"accounts/fireworks/models/glm-5p3-flash","name":"GLM 5.3 Flash","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048573,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/kimi-k3":{"id":"accounts/fireworks/models/kimi-k3","name":"Kimi K3","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"openai","supportsMidConvoSystemMessages":true,"supportsMidConvoToolAdditions":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/glm-5p3-fast":{"id":"accounts/fireworks/routers/glm-5p3-fast","name":"GLM 5.3 Fast","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":2.1,"output":6.6,"cacheRead":0.39,"cacheWrite":0},"contextWindow":1048572,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/glm-fast-latest":{"id":"accounts/fireworks/routers/glm-fast-latest","name":"GLM 5.3 Fast (Latest)","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":2.1,"output":6.6,"cacheRead":0.39,"cacheWrite":0},"contextWindow":1048572,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/glm-flash-latest":{"id":"accounts/fireworks/routers/glm-flash-latest","name":"GLM Flash Latest (GLM 5.3 Flash)","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048573,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/glm-latest":{"id":"accounts/fireworks/routers/glm-latest","name":"GLM Latest","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":1048573,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/kimi-k3-fast":{"id":"accounts/fireworks/routers/kimi-k3-fast","name":"Kimi K3 Fast","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":4.5,"output":22.5,"cacheRead":0.45,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"openai","supportsMidConvoSystemMessages":true,"supportsMidConvoToolAdditions":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}}
1
+ {"anthropic-messages":{"chat:accounts/fireworks/models/deepseek-v4p1-flash":{"id":"accounts/fireworks/models/deepseek-v4p1-flash","name":"DeepSeek V4.1 Flash","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/deepseek-v4p1-flash-1017":{"id":"accounts/fireworks/models/deepseek-v4p1-flash-1017","name":"DeepSeek V4.1 Flash 1017","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/ember-1":{"id":"accounts/fireworks/models/ember-1","name":"Ember-1","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/gpt-oss-120b":{"id":"accounts/fireworks/models/gpt-oss-120b","name":"GPT OSS 120B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.015,"cacheWrite":0},"contextWindow":131072,"maxTokens":32768,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:accounts/fireworks/models/inkling":{"id":"accounts/fireworks/models/inkling","name":"Inkling","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":4.05,"cacheRead":0.17,"cacheWrite":0},"contextWindow":1048576,"maxTokens":1048576,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/minimax-m3":{"id":"accounts/fireworks/models/minimax-m3","name":"MiniMax-M3","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.06,"cacheWrite":0},"contextWindow":512000,"maxTokens":512000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:accounts/fireworks/models/minimax-m3p1-flash":{"id":"accounts/fireworks/models/minimax-m3p1-flash","name":"MiniMax-M3.1-Flash","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.015,"cacheWrite":0},"contextWindow":1000000,"maxTokens":512000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/muse-spark-open":{"id":"accounts/fireworks/models/muse-spark-open","name":"Muse Spark Open","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":4.25,"cacheRead":0.15,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/nemotron-3-ultra-nvfp4":{"id":"accounts/fireworks/models/nemotron-3-ultra-nvfp4","name":"Nemotron 3 Ultra 550B A55B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.6,"output":2.4,"cacheRead":0.12,"cacheWrite":0},"contextWindow":262144,"maxTokens":128000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"type":"chat"},"chat:accounts/fireworks/models/nemotron-lightning-3p5-30b-a3b":{"id":"accounts/fireworks/models/nemotron-lightning-3p5-30b-a3b","name":"Nemotron 3.5 Lightning 30B A3B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.05,"output":0.2,"cacheRead":0.01,"cacheWrite":0},"contextWindow":262144,"maxTokens":262144,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"type":"chat"},"chat:accounts/fireworks/models/qwen3p8-2p4t-a95b":{"id":"accounts/fireworks/models/qwen3p8-2p4t-a95b","name":"Qwen3.8 2.4T A95B","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":2,"output":6,"cacheRead":0.25,"cacheWrite":0},"contextWindow":262144,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":null,"xhigh":"xhigh","max":null},"type":"chat"},"chat:accounts/fireworks/models/qwen3p8-max":{"id":"accounts/fireworks/models/qwen3p8-max","name":"Qwen3.8 Max","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.25,"cacheWrite":0},"contextWindow":262144,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":null,"xhigh":"xhigh","max":null},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/deepseek-flash-latest":{"id":"accounts/fireworks/routers/deepseek-flash-latest","name":"DeepSeek Flash Latest","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/deepseek-v4p1-flash-1017-spot":{"id":"accounts/fireworks/routers/deepseek-v4p1-flash-1017-spot","name":"DeepSeek V4.1 Flash 1017 Spot","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.21,"output":0.84,"cacheRead":0.0042,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/deepseek-v4p1-flash-spot":{"id":"accounts/fireworks/routers/deepseek-v4p1-flash-spot","name":"DeepSeek V4.1 Flash Spot","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.21,"output":0.84,"cacheRead":0.0042,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/kimi-fast-latest":{"id":"accounts/fireworks/routers/kimi-fast-latest","name":"Kimi Fast Latest","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":4.5,"output":22.5,"cacheRead":0.45,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/kimi-latest":{"id":"accounts/fireworks/routers/kimi-latest","name":"Kimi Latest","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/minimax-latest":{"id":"accounts/fireworks/routers/minimax-latest","name":"MiniMax Latest","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.06,"cacheWrite":0},"contextWindow":512000,"maxTokens":512000,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false,"forceAdaptiveThinking":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"type":"chat"},"chat:accounts/fireworks/routers/qwen-max-latest":{"id":"accounts/fireworks/routers/qwen-max-latest","name":"Qwen Max Latest (Qwen3.8 Max)","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":6,"cacheRead":0.25,"cacheWrite":0},"contextWindow":262144,"maxTokens":131072,"api":"anthropic-messages","baseUrl":"https://api.fireworks.ai/inference","compat":{"allowEmptySignature":true,"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}},"openai-completions":{"chat:accounts/fireworks/models/glm-5p3":{"id":"accounts/fireworks/models/glm-5p3","name":"GLM 5.3","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":1048573,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/models/glm-5p3-flash":{"id":"accounts/fireworks/models/glm-5p3-flash","name":"GLM 5.3 Flash","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048573,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/models/kimi-k3":{"id":"accounts/fireworks/models/kimi-k3","name":"Kimi K3","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"openai","supportsMidConvoSystemMessages":true,"supportsMidConvoToolAdditions":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/glm-5p3-fast":{"id":"accounts/fireworks/routers/glm-5p3-fast","name":"GLM 5.3 Fast","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":2.1,"output":6.6,"cacheRead":0.39,"cacheWrite":0},"contextWindow":1048572,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/glm-5p3-spot":{"id":"accounts/fireworks/routers/glm-5p3-spot","name":"GLM 5.3 Spot","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":0.98,"output":3.08,"cacheRead":0.182,"cacheWrite":0},"contextWindow":1048573,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/glm-fast-latest":{"id":"accounts/fireworks/routers/glm-fast-latest","name":"GLM 5.3 Fast (Latest)","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":2.1,"output":6.6,"cacheRead":0.39,"cacheWrite":0},"contextWindow":1048572,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/glm-flash-latest":{"id":"accounts/fireworks/routers/glm-flash-latest","name":"GLM Flash Latest (GLM 5.3 Flash)","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":0.15,"output":0.5,"cacheRead":0.03,"cacheWrite":0},"contextWindow":1048573,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/glm-latest":{"id":"accounts/fireworks/routers/glm-latest","name":"GLM Latest","provider":"fireworks","reasoning":true,"input":["text"],"cost":{"input":1.4,"output":4.4,"cacheRead":0.26,"cacheWrite":0},"contextWindow":1048573,"maxTokens":262144,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"type":"chat"},"chat:accounts/fireworks/routers/kimi-k3-fast":{"id":"accounts/fireworks/routers/kimi-k3-fast","name":"Kimi K3 Fast","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":4.5,"output":22.5,"cacheRead":0.45,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"openai","supportsMidConvoSystemMessages":true,"supportsMidConvoToolAdditions":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:accounts/fireworks/routers/kimi-k3-spot":{"id":"accounts/fireworks/routers/kimi-k3-spot","name":"Kimi K3 Spot","provider":"fireworks","reasoning":true,"input":["text","image"],"cost":{"input":2.1,"output":10.5,"cacheRead":0.21,"cacheWrite":0},"contextWindow":1048576,"maxTokens":131072,"api":"openai-completions","baseUrl":"https://api.fireworks.ai/inference/v1","compat":{"supportsStrictMode":true,"supportsStore":false,"supportsDeveloperRole":false,"sendSessionAffinityHeaders":true,"supportsLongCacheRetention":false,"requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"openai","supportsMidConvoSystemMessages":true,"supportsMidConvoToolAdditions":true},"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":null,"high":"high","xhigh":null,"max":"max"},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"}}}