@code-yeongyu/senpi 2026.8.3 → 2026.8.4
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.
- package/CHANGELOG.md +68 -0
- package/README.md +9 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/client/remote-session.d.ts +2 -2
- package/dist/client/transcript.d.ts +1 -1
- package/dist/core/agent-session.d.ts +6 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +174 -39
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +2 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +126 -26
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +12 -7
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/per-turn-cap.js +4 -1
- package/dist/core/extensions/builtin/compaction/per-turn-cap.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/retained-message-safety.d.ts +4 -0
- package/dist/core/extensions/builtin/compaction/retained-message-safety.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/retained-message-safety.js +155 -0
- package/dist/core/extensions/builtin/compaction/retained-message-safety.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +21 -13
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/goal/cache-warm-renderer.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/cache-warm-renderer.js +9 -14
- package/dist/core/extensions/builtin/goal/cache-warm-renderer.js.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation-recovery.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/continuation-recovery.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation-recovery.js +7 -0
- package/dist/core/extensions/builtin/goal/continuation-recovery.js.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation.d.ts +2 -1
- package/dist/core/extensions/builtin/goal/continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation.js +2 -1
- package/dist/core/extensions/builtin/goal/continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +26 -11
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts +7 -1
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +14 -2
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts +3 -2
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.js +89 -46
- package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/wait-progress.d.ts +11 -0
- package/dist/core/extensions/builtin/goal/wait-progress.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/wait-progress.js +30 -0
- package/dist/core/extensions/builtin/goal/wait-progress.js.map +1 -0
- package/dist/core/extensions/builtin/goal/wait-ticker.d.ts +38 -0
- package/dist/core/extensions/builtin/goal/wait-ticker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/wait-ticker.js +71 -0
- package/dist/core/extensions/builtin/goal/wait-ticker.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +14 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/types.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/renderer.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/renderer.js +4 -12
- package/dist/core/extensions/builtin/loop-guard/renderer.js.map +1 -1
- package/dist/core/extensions/builtin/rule-activation/index.d.ts +6 -0
- package/dist/core/extensions/builtin/rule-activation/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/rule-activation/index.js +10 -0
- package/dist/core/extensions/builtin/rule-activation/index.js.map +1 -0
- package/dist/core/extensions/builtin/rule-activation/renderer.d.ts +3 -0
- package/dist/core/extensions/builtin/rule-activation/renderer.d.ts.map +1 -0
- package/dist/core/extensions/builtin/rule-activation/renderer.js +37 -0
- package/dist/core/extensions/builtin/rule-activation/renderer.js.map +1 -0
- package/dist/core/extensions/builtin/rule-activation/types.d.ts +15 -0
- package/dist/core/extensions/builtin/rule-activation/types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/rule-activation/types.js +45 -0
- package/dist/core/extensions/builtin/rule-activation/types.js.map +1 -0
- package/dist/core/extensions/builtin/rules/config.d.ts +3 -0
- package/dist/core/extensions/builtin/rules/config.d.ts.map +1 -0
- package/dist/core/extensions/builtin/rules/config.js +24 -0
- package/dist/core/extensions/builtin/rules/config.js.map +1 -0
- package/dist/core/extensions/builtin/rules/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rules/index.js +14 -4
- package/dist/core/extensions/builtin/rules/index.js.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/formatter.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/formatter.js +21 -5
- package/dist/core/extensions/builtin/rules/rules/formatter.js.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/types.d.ts +1 -1
- package/dist/core/extensions/builtin/rules/rules/types.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +2 -3
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/detectors/repetitive-turns.d.ts +22 -0
- package/dist/core/extensions/builtin/ttsr/detectors/repetitive-turns.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/repetitive-turns.js +93 -0
- package/dist/core/extensions/builtin/ttsr/detectors/repetitive-turns.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/index.js +60 -21
- package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/prompts.d.ts +1 -0
- package/dist/core/extensions/builtin/ttsr/prompts.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/prompts.js +5 -0
- package/dist/core/extensions/builtin/ttsr/prompts.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/repetitive-turns-lane.d.ts +23 -0
- package/dist/core/extensions/builtin/ttsr/repetitive-turns-lane.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/repetitive-turns-lane.js +101 -0
- package/dist/core/extensions/builtin/ttsr/repetitive-turns-lane.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts +15 -0
- package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/stream-remediation.js +22 -0
- package/dist/core/extensions/builtin/ttsr/stream-remediation.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/types.d.ts +1 -1
- package/dist/core/extensions/builtin/ttsr/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/types.js.map +1 -1
- package/dist/core/extensions/notice/adapters.d.ts +15 -0
- package/dist/core/extensions/notice/adapters.d.ts.map +1 -0
- package/dist/core/extensions/notice/adapters.js +22 -0
- package/dist/core/extensions/notice/adapters.js.map +1 -0
- package/dist/core/extensions/notice/box.d.ts +8 -0
- package/dist/core/extensions/notice/box.d.ts.map +1 -0
- package/dist/core/extensions/notice/box.js +17 -0
- package/dist/core/extensions/notice/box.js.map +1 -0
- package/dist/core/extensions/notice/index.d.ts +4 -0
- package/dist/core/extensions/notice/index.d.ts.map +1 -0
- package/dist/core/extensions/notice/index.js +3 -0
- package/dist/core/extensions/notice/index.js.map +1 -0
- package/dist/core/extensions/notice/spec.d.ts +23 -0
- package/dist/core/extensions/notice/spec.d.ts.map +1 -0
- package/dist/core/extensions/notice/spec.js +2 -0
- package/dist/core/extensions/notice/spec.js.map +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +2 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +8 -3
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +16 -1
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/retry-fallback/validate.d.ts.map +1 -1
- package/dist/core/retry-fallback/validate.js +15 -2
- package/dist/core/retry-fallback/validate.js.map +1 -1
- package/dist/core/session-log.js +1 -1
- package/dist/core/session-log.js.map +1 -1
- package/dist/core/settings-manager.d.ts +7 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +13 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +5 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +22 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +42 -7
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-stderr-guard.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-stderr-guard.js +37 -0
- package/dist/modes/interactive/interactive-stderr-guard.js.map +1 -1
- package/docs/providers.md +19 -0
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +40 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +13 -3
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-status.ts +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +6 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-snapshot.ts +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-request.ts +20 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +17 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +18 -7
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +19 -5
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/alibaba-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.js +142 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +5 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js +36 -8
- package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +49 -33
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +8 -13
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/client.d.ts +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/client.js +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/connection.d.ts +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/connection.js +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/errors.d.ts +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/session-handle.d.ts +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/state.d.ts +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/types.d.ts +1 -1
- package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/unix.js +1 -1
- package/node_modules/@earendil-works/pi-client/CHANGELOG.md +0 -7
- package/node_modules/@earendil-works/pi-client/README.md +0 -64
- package/node_modules/@earendil-works/pi-client/package.json +0 -56
- package/node_modules/@earendil-works/pi-protocol/README.md +0 -68
- package/node_modules/@earendil-works/pi-protocol/package.json +0 -48
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/client.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/client.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/connection.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/connection.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/errors.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/errors.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/errors.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/index.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/index.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/index.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/index.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/promise.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/promise.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/promise.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/promise.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/session-handle.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/session-handle.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/session-handle.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/state.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/state.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/state.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/transport.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/transport.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/transport.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/transport.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/types.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/types.js +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/types.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/unix.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/unix.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-client/dist → vendor/pi-client}/unix.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/decoder.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/decoder.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/decoder.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/decoder.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/encoder.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/encoder.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/encoder.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/encoder.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/index.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/index.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/index.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/index.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/options.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/options.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/options.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/cbor/options.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/codec.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/codec.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/codec.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/codec.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/framing.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/framing.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/framing.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/framing.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/index.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/index.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/index.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/index.js.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/schemas.d.ts +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/schemas.d.ts.map +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/schemas.js +0 -0
- /package/{node_modules/@earendil-works/pi-protocol/dist → vendor/pi-protocol}/schemas.js.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-api-keys.js","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":";;;;;;;;AAAA,kEAAkE;AAClE,IAAI,WAAW,GAA+C,IAAI,CAAC;AACnE,IAAI,QAAQ,GAA4C,IAAI,CAAC;AAC7D,IAAI,KAAK,GAA2C,IAAI,CAAC;AAIzD,MAAM,aAAa,GAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,kCAAC,SAAS,EAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,+CAA+C;AAC/C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACzF,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3C,WAAW,GAAI,CAA8B,CAAC,UAAU,CAAC;IAC1D,CAAC,CAAC,CAAC;IACH,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3C,QAAQ,GAAI,CAA8B,CAAC,OAAO,CAAC;IACpD,CAAC,CAAC,CAAC;IACH,aAAa,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7C,KAAK,GAAI,CAAgC,CAAC,IAAI,CAAC;IAChD,CAAC,CAAC,CAAC;AACJ,CAAC;AAGD,OAAO,EAAE,mB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D,MAAM,UAAU,GAAG,CAAC,CAAC,CACpB,mBAAmB,CAAC,sBAAsB,EAAE,GAAG,CAAC,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAC9F,CAAC;QACF,MAAM,WAAW,GAAG,CAAC,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAExE,IAAI,cAAc,IAAI,UAAU,IAAI,WAAW,EAAE,CAAC;YACjD,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,IAAI,QAAQ,KAAK,gBAAgB,EAAE,CAAC;QACnC,uDAAuD;QACvD,yDAAyD;QACzD,mEAAmE;QACnE,qDAAqD;QACrD,6DAA6D;QAC7D,oEAAoE;QACpE,yEAAyE;QACzE,IACC,mBAAmB,CAAC,aAAa,EAAE,GAAG,CAAC;YACvC,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,GAAG,CAAC,IAAI,mBAAmB,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;YACpG,mBAAmB,CAAC,0BAA0B,EAAE,GAAG,CAAC;YACpD,mBAAmB,CAAC,wCAAwC,EAAE,GAAG,CAAC;YAClE,mBAAmB,CAAC,oCAAoC,EAAE,GAAG,CAAC;YAC9D,mBAAmB,CAAC,6BAA6B,EAAE,GAAG,CAAC,EACtD,CAAC;YACF,OAAO,iBAAiB,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["// NEVER convert to top-level imports - breaks browser/Vite builds\nlet _existsSync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider, ProviderEnv } from \"./types.ts\";\nimport { getProviderEnvValue } from \"./utils/provider-env.ts\";\n\nexport const ANTHROPIC_AUTH_TOKEN_ENV = \"ANTHROPIC_AUTH_TOKEN\";\nexport const ANTHROPIC_OAUTH_TOKEN_ENV = \"ANTHROPIC_OAUTH_TOKEN\";\nexport const ANTHROPIC_API_KEY_ENV = \"ANTHROPIC_API_KEY\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(env?: ProviderEnv): boolean {\n\tconst explicitCredentialsPath = env?.GOOGLE_APPLICATION_CREDENTIALS;\n\tif (explicitCredentialsPath) {\n\t\treturn _existsSync ? _existsSync(explicitCredentialsPath) : false;\n\t}\n\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = getProviderEnvValue(\"GOOGLE_APPLICATION_CREDENTIALS\", env);\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\nfunction getApiKeyEnvVars(provider: string): readonly string[] | undefined {\n\tif (provider === \"github-copilot\") {\n\t\treturn [\"COPILOT_GITHUB_TOKEN\"];\n\t}\n\n\t// ANTHROPIC_AUTH_TOKEN participates in env discovery/status, but\n\t// getEnvApiKey() skips it because requests must pass it as Authorization: Bearer.\n\tif (provider === \"anthropic\") {\n\t\treturn [ANTHROPIC_AUTH_TOKEN_ENV, ANTHROPIC_OAUTH_TOKEN_ENV, ANTHROPIC_API_KEY_ENV];\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\t\"alibaba-token-plan\": \"ALIBABA_TOKEN_PLAN_API_KEY\",\n\t\t\"ant-ling\": \"ANT_LING_API_KEY\",\n\t\t\"qwen-token-plan\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\t\"qwen-token-plan-cn\": \"QWEN_TOKEN_PLAN_CN_API_KEY\",\n\t\topenai: \"OPENAI_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tnvidia: \"NVIDIA_API_KEY\",\n\t\tdeepseek: \"DEEPSEEK_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\t\"google-vertex\": \"GOOGLE_CLOUD_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\tradius: \"RADIUS_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\t\"zai-coding-cn\": \"ZAI_CODING_CN_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\tmoonshotai: \"MOONSHOT_API_KEY\",\n\t\t\"moonshotai-cn\": \"MOONSHOT_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\tfireworks: \"FIREWORKS_API_KEY\",\n\t\ttogether: \"TOGETHER_API_KEY\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t\t\"cloudflare-workers-ai\": \"CLOUDFLARE_API_KEY\",\n\t\t\"cloudflare-ai-gateway\": \"CLOUDFLARE_API_KEY\",\n\t\txiaomi: \"XIAOMI_API_KEY\",\n\t\t\"xiaomi-token-plan-cn\": \"XIAOMI_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"xiaomi-token-plan-ams\": \"XIAOMI_TOKEN_PLAN_AMS_API_KEY\",\n\t\t\"xiaomi-token-plan-sgp\": \"XIAOMI_TOKEN_PLAN_SGP_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? [envVar] : undefined;\n}\n\n/**\n * Find configured environment variables that can provide an API key for a provider.\n *\n * This only reports actual API key variables. It intentionally excludes ambient\n * credential sources such as AWS profiles, AWS IAM credentials, and Google\n * Application Default Credentials.\n */\nexport function findEnvKeys(provider: KnownProvider, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined {\n\tconst envVars = getApiKeyEnvVars(provider);\n\tif (!envVars) return undefined;\n\n\tconst found = envVars.filter((envVar) => !!getProviderEnvValue(envVar, env));\n\treturn found.length > 0 ? found : undefined;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined {\n\tconst envKeys = findEnvKeys(provider, env);\n\tif (envKeys?.[0]) {\n\t\tconst apiKeyEnv = provider === \"anthropic\" ? envKeys.find((key) => key !== ANTHROPIC_AUTH_TOKEN_ENV) : envKeys[0];\n\t\tif (apiKeyEnv) return getProviderEnvValue(apiKeyEnv, env);\n\t}\n\n\t// Vertex AI supports either an explicit API key or Application Default Credentials.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials(env);\n\t\tconst hasProject = !!(\n\t\t\tgetProviderEnvValue(\"GOOGLE_CLOUD_PROJECT\", env) || getProviderEnvValue(\"GCLOUD_PROJECT\", env)\n\t\t);\n\t\tconst hasLocation = !!getProviderEnvValue(\"GOOGLE_CLOUD_LOCATION\", env);\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock bearer token\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tgetProviderEnvValue(\"AWS_PROFILE\", env) ||\n\t\t\t(getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env) && getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env)) ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_WEB_IDENTITY_TOKEN_FILE\", env)\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"env-api-keys.js","sourceRoot":"","sources":["../src/env-api-keys.ts"],"names":[],"mappings":";;;;;;;;AAAA,kEAAkE;AAClE,IAAI,WAAW,GAA+C,IAAI,CAAC;AACnE,IAAI,QAAQ,GAA4C,IAAI,CAAC;AAC7D,IAAI,KAAK,GAA2C,IAAI,CAAC;AAIzD,MAAM,aAAa,GAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,kCAAC,SAAS,EAAC,CAAC;AACtE,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,MAAM,iBAAiB,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,+CAA+C;AAC/C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACzF,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3C,WAAW,GAAI,CAA8B,CAAC,UAAU,CAAC;IAC1D,CAAC,CAAC,CAAC;IACH,aAAa,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;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Sync: typeof import(\"node:fs\").existsSync | null = null;\nlet _homedir: typeof import(\"node:os\").homedir | null = null;\nlet _join: typeof import(\"node:path\").join | null = null;\n\ntype DynamicImport = (specifier: string) => Promise<unknown>;\n\nconst dynamicImport: DynamicImport = (specifier) => import(specifier);\nconst NODE_FS_SPECIFIER = \"node:\" + \"fs\";\nconst NODE_OS_SPECIFIER = \"node:\" + \"os\";\nconst NODE_PATH_SPECIFIER = \"node:\" + \"path\";\n\n// Eagerly load in Node.js/Bun environment only\nif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\tdynamicImport(NODE_FS_SPECIFIER).then((m) => {\n\t\t_existsSync = (m as typeof import(\"node:fs\")).existsSync;\n\t});\n\tdynamicImport(NODE_OS_SPECIFIER).then((m) => {\n\t\t_homedir = (m as typeof import(\"node:os\")).homedir;\n\t});\n\tdynamicImport(NODE_PATH_SPECIFIER).then((m) => {\n\t\t_join = (m as typeof import(\"node:path\")).join;\n\t});\n}\n\nimport type { KnownProvider, ProviderEnv } from \"./types.ts\";\nimport { getProviderEnvValue } from \"./utils/provider-env.ts\";\n\nexport const ANTHROPIC_AUTH_TOKEN_ENV = \"ANTHROPIC_AUTH_TOKEN\";\nexport const ANTHROPIC_OAUTH_TOKEN_ENV = \"ANTHROPIC_OAUTH_TOKEN\";\nexport const ANTHROPIC_API_KEY_ENV = \"ANTHROPIC_API_KEY\";\n\nlet cachedVertexAdcCredentialsExists: boolean | null = null;\n\nfunction hasVertexAdcCredentials(env?: ProviderEnv): boolean {\n\tconst explicitCredentialsPath = env?.GOOGLE_APPLICATION_CREDENTIALS;\n\tif (explicitCredentialsPath) {\n\t\treturn _existsSync ? _existsSync(explicitCredentialsPath) : false;\n\t}\n\n\tif (cachedVertexAdcCredentialsExists === null) {\n\t\t// If node modules haven't loaded yet (async import race at startup),\n\t\t// return false WITHOUT caching so the next call retries once they're ready.\n\t\t// Only cache false permanently in a browser environment where fs is never available.\n\t\tif (!_existsSync || !_homedir || !_join) {\n\t\t\tconst isNode = typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun);\n\t\t\tif (!isNode) {\n\t\t\t\t// Definitively in a browser — safe to cache false permanently\n\t\t\t\tcachedVertexAdcCredentialsExists = false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check GOOGLE_APPLICATION_CREDENTIALS env var first (standard way)\n\t\tconst gacPath = getProviderEnvValue(\"GOOGLE_APPLICATION_CREDENTIALS\", env);\n\t\tif (gacPath) {\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(gacPath);\n\t\t} else {\n\t\t\t// Fall back to default ADC path (lazy evaluation)\n\t\t\tcachedVertexAdcCredentialsExists = _existsSync(\n\t\t\t\t_join(_homedir(), \".config\", \"gcloud\", \"application_default_credentials.json\"),\n\t\t\t);\n\t\t}\n\t}\n\treturn cachedVertexAdcCredentialsExists;\n}\n\nfunction getApiKeyEnvVars(provider: string): readonly string[] | undefined {\n\tif (provider === \"github-copilot\") {\n\t\treturn [\"COPILOT_GITHUB_TOKEN\"];\n\t}\n\n\t// ANTHROPIC_AUTH_TOKEN participates in env discovery/status, but\n\t// getEnvApiKey() skips it because requests must pass it as Authorization: Bearer.\n\tif (provider === \"anthropic\") {\n\t\treturn [ANTHROPIC_AUTH_TOKEN_ENV, ANTHROPIC_OAUTH_TOKEN_ENV, ANTHROPIC_API_KEY_ENV];\n\t}\n\n\tconst envMap: Record<string, string> = {\n\t\t\"alibaba-token-plan\": \"ALIBABA_TOKEN_PLAN_API_KEY\",\n\t\t\"ant-ling\": \"ANT_LING_API_KEY\",\n\t\t\"qwen-token-plan\": \"QWEN_TOKEN_PLAN_API_KEY\",\n\t\t\"qwen-token-plan-cn\": \"QWEN_TOKEN_PLAN_CN_API_KEY\",\n\t\topenai: \"OPENAI_API_KEY\",\n\t\tollama: \"OLLAMA_API_KEY\",\n\t\t\"azure-openai-responses\": \"AZURE_OPENAI_API_KEY\",\n\t\tnvidia: \"NVIDIA_API_KEY\",\n\t\tdeepseek: \"DEEPSEEK_API_KEY\",\n\t\tgoogle: \"GEMINI_API_KEY\",\n\t\t\"google-vertex\": \"GOOGLE_CLOUD_API_KEY\",\n\t\tgroq: \"GROQ_API_KEY\",\n\t\tcerebras: \"CEREBRAS_API_KEY\",\n\t\txai: \"XAI_API_KEY\",\n\t\tradius: \"RADIUS_API_KEY\",\n\t\topenrouter: \"OPENROUTER_API_KEY\",\n\t\t\"vercel-ai-gateway\": \"AI_GATEWAY_API_KEY\",\n\t\tzai: \"ZAI_API_KEY\",\n\t\t\"zai-coding-cn\": \"ZAI_CODING_CN_API_KEY\",\n\t\tmistral: \"MISTRAL_API_KEY\",\n\t\tminimax: \"MINIMAX_API_KEY\",\n\t\t\"minimax-cn\": \"MINIMAX_CN_API_KEY\",\n\t\tmoonshotai: \"MOONSHOT_API_KEY\",\n\t\t\"moonshotai-cn\": \"MOONSHOT_API_KEY\",\n\t\thuggingface: \"HF_TOKEN\",\n\t\tfireworks: \"FIREWORKS_API_KEY\",\n\t\ttogether: \"TOGETHER_API_KEY\",\n\t\topencode: \"OPENCODE_API_KEY\",\n\t\t\"opencode-go\": \"OPENCODE_API_KEY\",\n\t\t\"kimi-coding\": \"KIMI_API_KEY\",\n\t\t\"cloudflare-workers-ai\": \"CLOUDFLARE_API_KEY\",\n\t\t\"cloudflare-ai-gateway\": \"CLOUDFLARE_API_KEY\",\n\t\txiaomi: \"XIAOMI_API_KEY\",\n\t\t\"xiaomi-token-plan-cn\": \"XIAOMI_TOKEN_PLAN_CN_API_KEY\",\n\t\t\"xiaomi-token-plan-ams\": \"XIAOMI_TOKEN_PLAN_AMS_API_KEY\",\n\t\t\"xiaomi-token-plan-sgp\": \"XIAOMI_TOKEN_PLAN_SGP_API_KEY\",\n\t};\n\n\tconst envVar = envMap[provider];\n\treturn envVar ? [envVar] : undefined;\n}\n\n/**\n * Find configured environment variables that can provide an API key for a provider.\n *\n * This only reports actual API key variables. It intentionally excludes ambient\n * credential sources such as AWS profiles, AWS IAM credentials, and Google\n * Application Default Credentials.\n */\nexport function findEnvKeys(provider: KnownProvider, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined;\nexport function findEnvKeys(provider: string, env?: ProviderEnv): string[] | undefined {\n\tconst envVars = getApiKeyEnvVars(provider);\n\tif (!envVars) return undefined;\n\n\tconst found = envVars.filter((envVar) => !!getProviderEnvValue(envVar, env));\n\treturn found.length > 0 ? found : undefined;\n}\n\n/**\n * Get API key for provider from known environment variables, e.g. OPENAI_API_KEY.\n *\n * Will not return API keys for providers that require OAuth tokens.\n */\nexport function getEnvApiKey(provider: KnownProvider, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined;\nexport function getEnvApiKey(provider: string, env?: ProviderEnv): string | undefined {\n\tconst envKeys = findEnvKeys(provider, env);\n\tif (envKeys?.[0]) {\n\t\tconst apiKeyEnv = provider === \"anthropic\" ? envKeys.find((key) => key !== ANTHROPIC_AUTH_TOKEN_ENV) : envKeys[0];\n\t\tif (apiKeyEnv) return getProviderEnvValue(apiKeyEnv, env);\n\t}\n\n\t// Vertex AI supports either an explicit API key or Application Default Credentials.\n\t// Auth is configured via `gcloud auth application-default login`.\n\tif (provider === \"google-vertex\") {\n\t\tconst hasCredentials = hasVertexAdcCredentials(env);\n\t\tconst hasProject = !!(\n\t\t\tgetProviderEnvValue(\"GOOGLE_CLOUD_PROJECT\", env) || getProviderEnvValue(\"GCLOUD_PROJECT\", env)\n\t\t);\n\t\tconst hasLocation = !!getProviderEnvValue(\"GOOGLE_CLOUD_LOCATION\", env);\n\n\t\tif (hasCredentials && hasProject && hasLocation) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\tif (provider === \"amazon-bedrock\") {\n\t\t// Amazon Bedrock supports multiple credential sources:\n\t\t// 1. AWS_PROFILE - named profile from ~/.aws/credentials\n\t\t// 2. AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - standard IAM keys\n\t\t// 3. AWS_BEARER_TOKEN_BEDROCK - Bedrock bearer token\n\t\t// 4. AWS_CONTAINER_CREDENTIALS_RELATIVE_URI - ECS task roles\n\t\t// 5. AWS_CONTAINER_CREDENTIALS_FULL_URI - ECS task roles (full URI)\n\t\t// 6. AWS_WEB_IDENTITY_TOKEN_FILE - IRSA (IAM Roles for Service Accounts)\n\t\tif (\n\t\t\tgetProviderEnvValue(\"AWS_PROFILE\", env) ||\n\t\t\t(getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env) && getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env)) ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_CONTAINER_CREDENTIALS_FULL_URI\", env) ||\n\t\t\tgetProviderEnvValue(\"AWS_WEB_IDENTITY_TOKEN_FILE\", env)\n\t\t) {\n\t\t\treturn \"<authenticated>\";\n\t\t}\n\t}\n\n\treturn undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-models.generated.js","sourceRoot":"","sources":["../src/image-models.generated.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,uEAAuE;AAIvE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,UAAU,EAAE;QACX,+BAA+B,EAAE;YAChC,EAAE,EAAE,+BAA+B;YACnC,IAAI,EAAE,gCAAgC;YACtC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,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AAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;QAC5C,8BAA8B,EAAE;YAC/B,EAAE,EAAE,8BAA8B;YAClC,IAAI,EAAE,+BAA+B;YACrC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;QAC5C,iCAAiC,EAAE;YAClC,EAAE,EAAE,iCAAiC;YACrC,IAAI,EAAE,iCAAiC;YACvC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;KAC5C;CACyE,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-image-models.ts\n// Do not edit manually - run 'npm run generate-image-models' to update\n\nimport type { ImagesApi, ImagesModel } from \"./types.ts\";\n\nexport const IMAGE_MODELS = {\n\topenrouter: {\n\t\t\"black-forest-labs/flux.2-flex\": {\n\t\t\tid: \"black-forest-labs/flux.2-flex\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Flex\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-klein-4b\": {\n\t\t\tid: \"black-forest-labs/flux.2-klein-4b\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Klein 4B\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-max\": {\n\t\t\tid: \"black-forest-labs/flux.2-max\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Max\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-pro\": {\n\t\t\tid: \"black-forest-labs/flux.2-pro\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"bytedance-seed/seedream-4.5\": {\n\t\t\tid: \"bytedance-seed/seedream-4.5\",\n\t\t\tname: \"ByteDance Seed: Seedream 4.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-2.5-flash-image\": {\n\t\t\tid: \"google/gemini-2.5-flash-image\",\n\t\t\tname: \"Google: Nano Banana (Gemini 2.5 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.3,\n\t\t\t\toutput: 2.5,\n\t\t\t\tcacheRead: 0.03,\n\t\t\t\tcacheWrite: 0.08333333333333334,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image\": {\n\t\t\tid: \"google/gemini-3-pro-image\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2,\n\t\t\t\toutput: 12,\n\t\t\t\tcacheRead: 0.19999999999999998,\n\t\t\t\tcacheWrite: 0.375,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image-preview\": {\n\t\t\tid: \"google/gemini-3-pro-image-preview\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2,\n\t\t\t\toutput: 12,\n\t\t\t\tcacheRead: 0.19999999999999998,\n\t\t\t\tcacheWrite: 0.375,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image\": {\n\t\t\tid: \"google/gemini-3.1-flash-image\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.5,\n\t\t\t\toutput: 3,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image-preview\": {\n\t\t\tid: \"google/gemini-3.1-flash-image-preview\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.5,\n\t\t\t\toutput: 3,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-lite-image\": {\n\t\t\tid: \"google/gemini-3.1-flash-lite-image\",\n\t\t\tname: \"Google: Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.25,\n\t\t\t\toutput: 1.5,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"krea/krea-2-large\": {\n\t\t\tid: \"krea/krea-2-large\",\n\t\t\tname: \"Krea: Krea 2 Large\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"krea/krea-2-medium\": {\n\t\t\tid: \"krea/krea-2-medium\",\n\t\t\tname: \"Krea: Krea 2 Medium\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"krea/krea-2-medium-turbo\": {\n\t\t\tid: \"krea/krea-2-medium-turbo\",\n\t\t\tname: \"Krea: Krea 2 Medium Turbo\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"microsoft/mai-image-2.5\": {\n\t\t\tid: \"microsoft/mai-image-2.5\",\n\t\t\tname: \"Microsoft: MAI-Image-2.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 5,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"microsoft/mai-image-2.5-pro\": {\n\t\t\tid: \"microsoft/mai-image-2.5-pro\",\n\t\t\tname: \"Microsoft: MAI-Image-2.5 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 5,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image\": {\n\t\t\tid: \"openai/gpt-5-image\",\n\t\t\tname: \"OpenAI: GPT-5 Image\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 10,\n\t\t\t\toutput: 10,\n\t\t\t\tcacheRead: 1.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image-mini\": {\n\t\t\tid: \"openai/gpt-5-image-mini\",\n\t\t\tname: \"OpenAI: GPT-5 Image Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2.5,\n\t\t\t\toutput: 2,\n\t\t\t\tcacheRead: 0.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5.4-image-2\": {\n\t\t\tid: \"openai/gpt-5.4-image-2\",\n\t\t\tname: \"OpenAI: GPT-5.4 Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 8,\n\t\t\t\toutput: 15,\n\t\t\t\tcacheRead: 2,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-image-1\": {\n\t\t\tid: \"openai/gpt-image-1\",\n\t\t\tname: \"OpenAI: GPT Image 1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 10,\n\t\t\t\toutput: 10,\n\t\t\t\tcacheRead: 1.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-image-1-mini\": {\n\t\t\tid: \"openai/gpt-image-1-mini\",\n\t\t\tname: \"OpenAI: GPT Image 1 Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2.5,\n\t\t\t\toutput: 2.5,\n\t\t\t\tcacheRead: 0.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-image-2\": {\n\t\t\tid: \"openai/gpt-image-2\",\n\t\t\tname: \"OpenAI: GPT Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 8,\n\t\t\t\toutput: 8,\n\t\t\t\tcacheRead: 2,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto\": {\n\t\t\tid: \"openrouter/auto\",\n\t\t\tname: \"Auto Router\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"text\", \"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: -1000000,\n\t\t\t\toutput: -1000000,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto-beta\": {\n\t\t\tid: \"openrouter/auto-beta\",\n\t\t\tname: \"Auto Router (Beta)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"text\", \"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: -1000000,\n\t\t\t\toutput: -1000000,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v3\": {\n\t\t\tid: \"recraft/recraft-v3\",\n\t\t\tname: \"Recraft: Recraft V3\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4\": {\n\t\t\tid: \"recraft/recraft-v4\",\n\t\t\tname: \"Recraft: Recraft V4\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro\": {\n\t\t\tid: \"recraft/recraft-v4-pro\",\n\t\t\tname: \"Recraft: Recraft V4 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-vector\": {\n\t\t\tid: \"recraft/recraft-v4-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1\": {\n\t\t\tid: \"recraft/recraft-v4.1\",\n\t\t\tname: \"Recraft: Recraft V4.1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2.5-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2.5-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2.5 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2.5-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2.5-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2.5 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"x-ai/grok-imagine-image-quality\": {\n\t\t\tid: \"x-ai/grok-imagine-image-quality\",\n\t\t\tname: \"xAI: Grok Imagine Image Quality\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t},\n} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;\n"]}
|
|
1
|
+
{"version":3,"file":"image-models.generated.js","sourceRoot":"","sources":["../src/image-models.generated.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,uEAAuE;AAIvE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,UAAU,EAAE;QACX,+BAA+B,EAAE;YAChC,EAAE,EAAE,+BAA+B;YACnC,IAAI,EAAE,gCAAgC;YACtC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;QAC5C,mCAAmC,EAAE;YACpC,EAAE,EAAE,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;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;QAC5C,8BAA8B,EAAE;YAC/B,EAAE,EAAE,8BAA8B;YAClC,IAAI,EAAE,+BAA+B;YACrC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;QAC5C,iCAAiC,EAAE;YAClC,EAAE,EAAE,iCAAiC;YACrC,IAAI,EAAE,iCAAiC;YACvC,GAAG,EAAE,mBAAmB;YACxB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,8BAA8B;YACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE;gBACL,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,CAAC;gBACZ,UAAU,EAAE,CAAC;aACb;SAC0C;KAC5C;CACyE,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-image-models.ts\n// Do not edit manually - run 'npm run generate-image-models' to update\n\nimport type { ImagesApi, ImagesModel } from \"./types.ts\";\n\nexport const IMAGE_MODELS = {\n\topenrouter: {\n\t\t\"black-forest-labs/flux.2-flex\": {\n\t\t\tid: \"black-forest-labs/flux.2-flex\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Flex\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-klein-4b\": {\n\t\t\tid: \"black-forest-labs/flux.2-klein-4b\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Klein 4B\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-max\": {\n\t\t\tid: \"black-forest-labs/flux.2-max\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Max\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"black-forest-labs/flux.2-pro\": {\n\t\t\tid: \"black-forest-labs/flux.2-pro\",\n\t\t\tname: \"Black Forest Labs: FLUX.2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"bytedance-seed/seedream-4.5\": {\n\t\t\tid: \"bytedance-seed/seedream-4.5\",\n\t\t\tname: \"ByteDance Seed: Seedream 4.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-2.5-flash-image\": {\n\t\t\tid: \"google/gemini-2.5-flash-image\",\n\t\t\tname: \"Google: Nano Banana (Gemini 2.5 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.3,\n\t\t\t\toutput: 2.5,\n\t\t\t\tcacheRead: 0.03,\n\t\t\t\tcacheWrite: 0.0833333333333333,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image\": {\n\t\t\tid: \"google/gemini-3-pro-image\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2,\n\t\t\t\toutput: 12,\n\t\t\t\tcacheRead: 0.19999999999999998,\n\t\t\t\tcacheWrite: 0.375,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3-pro-image-preview\": {\n\t\t\tid: \"google/gemini-3-pro-image-preview\",\n\t\t\tname: \"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2,\n\t\t\t\toutput: 12,\n\t\t\t\tcacheRead: 0.19999999999999998,\n\t\t\t\tcacheWrite: 0.375,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image\": {\n\t\t\tid: \"google/gemini-3.1-flash-image\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.5,\n\t\t\t\toutput: 3,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-image-preview\": {\n\t\t\tid: \"google/gemini-3.1-flash-image-preview\",\n\t\t\tname: \"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.5,\n\t\t\t\toutput: 3,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"google/gemini-3.1-flash-lite-image\": {\n\t\t\tid: \"google/gemini-3.1-flash-lite-image\",\n\t\t\tname: \"Google: Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 0.25,\n\t\t\t\toutput: 1.5,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"krea/krea-2-large\": {\n\t\t\tid: \"krea/krea-2-large\",\n\t\t\tname: \"Krea: Krea 2 Large\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"krea/krea-2-medium\": {\n\t\t\tid: \"krea/krea-2-medium\",\n\t\t\tname: \"Krea: Krea 2 Medium\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"krea/krea-2-medium-turbo\": {\n\t\t\tid: \"krea/krea-2-medium-turbo\",\n\t\t\tname: \"Krea: Krea 2 Medium Turbo\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"microsoft/mai-image-2.5\": {\n\t\t\tid: \"microsoft/mai-image-2.5\",\n\t\t\tname: \"Microsoft: MAI-Image-2.5\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 5,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"microsoft/mai-image-2.5-pro\": {\n\t\t\tid: \"microsoft/mai-image-2.5-pro\",\n\t\t\tname: \"Microsoft: MAI-Image-2.5 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 5,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image\": {\n\t\t\tid: \"openai/gpt-5-image\",\n\t\t\tname: \"OpenAI: GPT-5 Image\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 10,\n\t\t\t\toutput: 10,\n\t\t\t\tcacheRead: 1.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5-image-mini\": {\n\t\t\tid: \"openai/gpt-5-image-mini\",\n\t\t\tname: \"OpenAI: GPT-5 Image Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2.5,\n\t\t\t\toutput: 2,\n\t\t\t\tcacheRead: 0.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-5.4-image-2\": {\n\t\t\tid: \"openai/gpt-5.4-image-2\",\n\t\t\tname: \"OpenAI: GPT-5.4 Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"image\", \"text\"],\n\t\t\toutput: [\"image\", \"text\"],\n\t\t\tcost: {\n\t\t\t\tinput: 8,\n\t\t\t\toutput: 15,\n\t\t\t\tcacheRead: 2,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-image-1\": {\n\t\t\tid: \"openai/gpt-image-1\",\n\t\t\tname: \"OpenAI: GPT Image 1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 10,\n\t\t\t\toutput: 10,\n\t\t\t\tcacheRead: 1.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-image-1-mini\": {\n\t\t\tid: \"openai/gpt-image-1-mini\",\n\t\t\tname: \"OpenAI: GPT Image 1 Mini\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 2.5,\n\t\t\t\toutput: 2.5,\n\t\t\t\tcacheRead: 0.25,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openai/gpt-image-2\": {\n\t\t\tid: \"openai/gpt-image-2\",\n\t\t\tname: \"OpenAI: GPT Image 2\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: 8,\n\t\t\t\toutput: 8,\n\t\t\t\tcacheRead: 2,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto\": {\n\t\t\tid: \"openrouter/auto\",\n\t\t\tname: \"Auto Router\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"text\", \"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: -1000000,\n\t\t\t\toutput: -1000000,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"openrouter/auto-beta\": {\n\t\t\tid: \"openrouter/auto-beta\",\n\t\t\tname: \"Auto Router (Beta)\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"text\", \"image\"],\n\t\t\tcost: {\n\t\t\t\tinput: -1000000,\n\t\t\t\toutput: -1000000,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v3\": {\n\t\t\tid: \"recraft/recraft-v3\",\n\t\t\tname: \"Recraft: Recraft V3\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4\": {\n\t\t\tid: \"recraft/recraft-v4\",\n\t\t\tname: \"Recraft: Recraft V4\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro\": {\n\t\t\tid: \"recraft/recraft-v4-pro\",\n\t\t\tname: \"Recraft: Recraft V4 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4-vector\": {\n\t\t\tid: \"recraft/recraft-v4-vector\",\n\t\t\tname: \"Recraft: Recraft V4 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1\": {\n\t\t\tid: \"recraft/recraft-v4.1\",\n\t\t\tname: \"Recraft: Recraft V4.1\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-pro-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-pro-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Pro Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-utility-pro\": {\n\t\t\tid: \"recraft/recraft-v4.1-utility-pro\",\n\t\t\tname: \"Recraft: Recraft V4.1 Utility Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"recraft/recraft-v4.1-vector\": {\n\t\t\tid: \"recraft/recraft-v4.1-vector\",\n\t\t\tname: \"Recraft: Recraft V4.1 Vector\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2.5-fast\": {\n\t\t\tid: \"sourceful/riverflow-v2.5-fast\",\n\t\t\tname: \"Sourceful: Riverflow V2.5 Fast\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"sourceful/riverflow-v2.5-pro\": {\n\t\t\tid: \"sourceful/riverflow-v2.5-pro\",\n\t\t\tname: \"Sourceful: Riverflow V2.5 Pro\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t\t\"x-ai/grok-imagine-image-quality\": {\n\t\t\tid: \"x-ai/grok-imagine-image-quality\",\n\t\t\tname: \"xAI: Grok Imagine Image Quality\",\n\t\t\tapi: \"openrouter-images\",\n\t\t\tprovider: \"openrouter\",\n\t\t\tbaseUrl: \"https://openrouter.ai/api/v1\",\n\t\t\tinput: [\"text\", \"image\"],\n\t\t\toutput: [\"image\"],\n\t\t\tcost: {\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},\n\t\t} satisfies ImagesModel<\"openrouter-images\">,\n\t},\n} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;\n"]}
|
|
@@ -335,7 +335,7 @@ export function createProvider(input) {
|
|
|
335
335
|
if (!context.allowNetwork || context.signal?.aborted)
|
|
336
336
|
return;
|
|
337
337
|
const refreshed = await fetchModels(context);
|
|
338
|
-
if (context.signal?.aborted)
|
|
338
|
+
if (context.signal?.aborted || refreshed.length === 0)
|
|
339
339
|
return;
|
|
340
340
|
dynamicModels = refreshed;
|
|
341
341
|
await context.store.write({ models: refreshed, checkedAt: Date.now() });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,0BAA0B,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAgC,WAAW,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAWnG,OAAO,EAAE,mBA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KAAK,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,KAAK,CAAC,gBAAgB,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACvD,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,sFAAsF;AACtF,MAAM,eAAe,GAAU;IAC9B,kBAAkB;IAClB,wBAAwB;IACxB,wBAAwB;IACxB,oBAAoB;CACpB,CAAC;AAEF,+EAA+E;AAC/E,MAAM,aAAa,GAAG,aAAa,CAAC;AAEpC,MAAM,aAAa,GAAG;IACrB,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,SAAS;CACT,CAAC;AAEF,SAAS,gBAAgB,CAAmB,KAAkB;IAC7D,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IACpG,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC7B,CAAiC,EACjC,CAAiC;IAEjC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC;AACnD,CAAC","sourcesContent":["import { lazyStream } from \"./api/lazy.ts\";\nimport { defaultProviderAuthContext as defaultAuthContext } from \"./auth/context.ts\";\nimport { InMemoryCredentialStore } from \"./auth/credential-store.ts\";\nimport { type AuthResolutionOverrides, ModelsError, resolveProviderAuth } from \"./auth/resolve.ts\";\nimport type {\n\tAuthCheck,\n\tAuthContext,\n\tAuthInteraction,\n\tAuthResult,\n\tAuthType,\n\tCredential,\n\tCredentialStore,\n\tProviderAuth,\n} from \"./auth/types.ts\";\nimport { InMemoryModelsStore, type ModelsStore, type ProviderModelsStore } from \"./models-store.ts\";\nimport type {\n\tApi,\n\tApiStreamOptions,\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tContext,\n\tModel,\n\tModelCostRates,\n\tModelThinkingLevel,\n\tProviderHeaders,\n\tProviderStreams,\n\tSimpleStreamOptions,\n\tStreamOptions,\n\tUsage,\n} from \"./types.ts\";\n\nexport { ModelsError, type ModelsErrorCode } from \"./auth/resolve.ts\";\n\nexport interface RefreshModelsContext {\n\t/** Effective configured credential. OAuth credentials are refreshed before network access. */\n\tcredential?: Credential;\n\t/** Persistent model storage scoped to this provider ID. */\n\tstore: ProviderModelsStore;\n\t/** False during offline/cache-only initialization. */\n\tallowNetwork: boolean;\n\t/** Bypass provider freshness checks and fetch immediately when network access is allowed. */\n\tforce?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport interface ModelsRefreshOptions {\n\tallowNetwork?: boolean;\n\t/** Bypass provider freshness checks and fetch immediately when network access is allowed. */\n\tforce?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport interface ModelsRefreshResult {\n\taborted: boolean;\n\terrors: ReadonlyMap<string, Error>;\n}\n\nexport interface ModelsStreamTransforms {\n\t/** Transform fully assembled model/auth/request headers before provider dispatch. */\n\ttransformHeaders?: (headers: ProviderHeaders) => ProviderHeaders | Promise<ProviderHeaders>;\n}\n\nexport type ModelsApiStreamOptions<TApi extends Api> = ApiStreamOptions<TApi> & ModelsStreamTransforms;\nexport type ModelsSimpleStreamOptions = SimpleStreamOptions & ModelsStreamTransforms;\n\n/**\n * A provider is the concrete runtime unit. It owns id/name/base metadata,\n * auth methods, model listing, and stream behavior.\n *\n * `TApi` lets concrete provider factories declare which APIs their models\n * use (e.g. `openaiProvider(): Provider<\"openai-responses\" | \"openai-completions\">`),\n * giving typed model lists to direct factory users. Inside a `Models`\n * collection providers are held as `Provider<Api>`.\n */\nexport interface Provider<TApi extends Api = Api> {\n\treadonly id: string;\n\treadonly name: string;\n\n\treadonly baseUrl?: string;\n\treadonly headers?: ProviderHeaders;\n\n\t/**\n\t * Required: at least one of `apiKey`/`oauth`. Every provider has auth\n\t * semantics — even providers with only ambient credentials (env vars, AWS\n\t * profiles, ADC files) and keyless local servers provide `apiKey` auth\n\t * whose `resolve()` reports whether the provider is configured.\n\t * `Models.getAuth()` returns undefined when the provider is unconfigured.\n\t */\n\treadonly auth: ProviderAuth;\n\n\t/**\n\t * Current known models, sync. Static providers return their catalog;\n\t * dynamic providers return the list as of the last `refreshModels()`\n\t * (empty before the first). Must not throw; `Models` treats a throwing\n\t * implementation as having no models.\n\t */\n\tgetModels(): readonly Model<TApi>[];\n\n\t/**\n\t * Dynamic providers only: restore the provider-scoped stored catalog and optionally fetch\n\t * a newer list using the effective credential. Implementations must retain their previous\n\t * list on failure and honor the shared abort signal for network requests.\n\t */\n\trefreshModels?(context: RefreshModelsContext): Promise<void>;\n\n\t/**\n\t * Optional provider policy for credential-specific model availability.\n\t * `getModels()` remains the complete synchronous catalog; `Models.getAvailable()`\n\t * applies this filter after confirming that provider auth is configured.\n\t */\n\tfilterModels?(models: readonly Model<TApi>[], credential: Credential | undefined): readonly Model<TApi>[];\n\n\tstream<T extends TApi>(\n\t\tmodel: Model<T>,\n\t\tcontext: Context,\n\t\toptions?: ApiStreamOptions<T>,\n\t): AssistantMessageEventStream;\n\n\tstreamSimple(model: Model<TApi>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;\n}\n\n/**\n * Runtime collection of providers plus auth application and stream\n * convenience. Providers own stream behavior; `Models` resolves auth and\n * delegates each request to the provider that owns the model.\n */\nexport interface Models {\n\tgetProviders(): readonly Provider[];\n\tgetProvider(id: string): Provider | undefined;\n\n\t/**\n\t * Sync read of last-known models from one provider or all providers.\n\t * Best-effort: a provider whose `getModels()` throws yields no models.\n\t */\n\tgetModels(provider?: string): readonly Model<Api>[];\n\n\t/**\n\t * Sync runtime model lookup against last-known lists. Dynamic model lists\n\t * are typed as `Model<Api>`; narrow with the `hasApi()` type guard.\n\t */\n\tgetModel(provider: string, id: string): Model<Api> | undefined;\n\n\t/**\n\t * Refresh every configured dynamic provider concurrently. Provider errors and cancellation\n\t * are returned without rejecting; static and unconfigured providers are skipped.\n\t */\n\trefresh(options?: ModelsRefreshOptions): Promise<ModelsRefreshResult>;\n\n\t/** Check whether a provider has complete auth configuration without refreshing OAuth. */\n\tcheckAuth(providerId: string): Promise<AuthCheck | undefined>;\n\n\t/** Return models whose providers have complete auth configuration. */\n\tgetAvailable(providerId?: string): Promise<readonly Model<Api>[]>;\n\n\t/**\n\t * Resolve provider-scoped auth by provider id, or provider auth plus static\n\t * model headers when passed a model. Includes a source label for status UI.\n\t * Resolves `undefined` when the provider is unknown or unconfigured.\n\t * Rejects with `ModelsError`: code \"oauth\" when a token refresh fails (the\n\t * stored credential is preserved for retry; re-login fixes it), code \"auth\"\n\t * when api-key resolution or the credential store fails. Request paths\n\t * surface rejections as stream errors.\n\t */\n\tgetAuth(providerId: string, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\n\t/** Run a provider-owned login flow and persist its returned credential. */\n\tlogin(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential>;\n\n\t/** Remove the stored credential for a provider. */\n\tlogout(providerId: string): Promise<void>;\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream;\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage>;\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream;\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage>;\n}\n\nexport interface MutableModels extends Models {\n\t/** Upsert/replace by provider.id. Provider ids are unique. */\n\tsetProvider(provider: Provider): void;\n\tdeleteProvider(id: string): void;\n\tclearProviders(): void;\n}\n\nexport interface CreateModelsOptions {\n\tcredentials?: CredentialStore;\n\tmodelsStore?: ModelsStore;\n\tauthContext?: AuthContext;\n}\n\nfunction mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\nclass ModelsImpl implements MutableModels {\n\tprivate providers = new Map<string, Provider>();\n\tprivate credentials: CredentialStore;\n\tprivate modelsStore: ModelsStore;\n\tprivate authContext: AuthContext;\n\n\tconstructor(options?: CreateModelsOptions) {\n\t\tthis.credentials = options?.credentials ?? new InMemoryCredentialStore();\n\t\tthis.modelsStore = options?.modelsStore ?? new InMemoryModelsStore();\n\t\tthis.authContext = options?.authContext ?? defaultAuthContext();\n\t}\n\n\tsetProvider(provider: Provider): void {\n\t\tthis.providers.set(provider.id, provider);\n\t}\n\n\tdeleteProvider(id: string): void {\n\t\tthis.providers.delete(id);\n\t}\n\n\tclearProviders(): void {\n\t\tthis.providers.clear();\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn Array.from(this.providers.values());\n\t}\n\n\tgetProvider(id: string): Provider | undefined {\n\t\treturn this.providers.get(id);\n\t}\n\n\tgetModels(provider?: string): readonly Model<Api>[] {\n\t\tif (provider !== undefined) {\n\t\t\tconst entry = this.providers.get(provider);\n\t\t\tif (!entry) return [];\n\t\t\ttry {\n\t\t\t\treturn entry.getModels();\n\t\t\t} catch {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\tconst models: Model<Api>[] = [];\n\t\tfor (const entry of this.providers.values()) {\n\t\t\ttry {\n\t\t\t\tmodels.push(...entry.getModels());\n\t\t\t} catch {\n\t\t\t\t// Best-effort: ill-behaved providers yield no models.\n\t\t\t}\n\t\t}\n\t\treturn models;\n\t}\n\n\tgetModel(provider: string, id: string): Model<Api> | undefined {\n\t\treturn this.getModels(provider).find((model) => model.id === id);\n\t}\n\n\tasync refresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\tconst allowNetwork = options.allowNetwork ?? true;\n\t\tconst errors = new Map<string, Error>();\n\t\tconst refreshable = Array.from(this.providers.values()).filter(\n\t\t\t(provider): provider is Provider & Required<Pick<Provider, \"refreshModels\">> =>\n\t\t\t\tprovider.refreshModels !== undefined,\n\t\t);\n\n\t\tawait Promise.all(\n\t\t\trefreshable.map(async (provider) => {\n\t\t\t\tif (options.signal?.aborted) return;\n\t\t\t\tconst store: ProviderModelsStore = {\n\t\t\t\t\tread: () => this.modelsStore.read(provider.id),\n\t\t\t\t\twrite: (entry) => this.modelsStore.write(provider.id, entry),\n\t\t\t\t\tdelete: () => this.modelsStore.delete(provider.id),\n\t\t\t\t};\n\t\t\t\tlet stored: Credential | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tstored = await this.readCredential(provider.id);\n\t\t\t\t\tconst credential = await this.resolveRefreshCredential(provider, stored, allowNetwork, options.signal);\n\t\t\t\t\tif (!credential) return;\n\t\t\t\t\tawait provider.refreshModels({\n\t\t\t\t\t\tcredential,\n\t\t\t\t\t\tstore,\n\t\t\t\t\t\tallowNetwork,\n\t\t\t\t\t\tforce: options.force,\n\t\t\t\t\t\tsignal: options.signal,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!options.signal?.aborted) {\n\t\t\t\t\t\terrors.set(\n\t\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\t\terror instanceof Error\n\t\t\t\t\t\t\t\t? error\n\t\t\t\t\t\t\t\t: new ModelsError(\"model_source\", `Model refresh failed for ${provider.id}`, { cause: error }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait provider.refreshModels({\n\t\t\t\t\t\t\tcredential: stored,\n\t\t\t\t\t\t\tstore,\n\t\t\t\t\t\t\tallowNetwork: false,\n\t\t\t\t\t\t\tsignal: options.signal,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Preserve the original auth/network error; cache restoration is best-effort here.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\treturn { aborted: options.signal?.aborted ?? false, errors };\n\t}\n\n\tprivate async resolveRefreshCredential(\n\t\tprovider: Provider,\n\t\tstored: Credential | undefined,\n\t\tallowNetwork: boolean,\n\t\tsignal?: AbortSignal,\n\t): Promise<Credential | undefined> {\n\t\tif (stored?.type === \"oauth\") {\n\t\t\tconst oauth = provider.auth.oauth;\n\t\t\tif (!oauth) return undefined;\n\t\t\tif (!allowNetwork || Date.now() < stored.expires) return stored;\n\t\t\tif (signal?.aborted) return undefined;\n\t\t\tconst post = await this.credentials.modify(provider.id, async (current) => {\n\t\t\t\tif (current?.type !== \"oauth\" || Date.now() < current.expires) return undefined;\n\t\t\t\treturn oauth.refresh(current, signal);\n\t\t\t});\n\t\t\treturn post?.type === \"oauth\" ? post : undefined;\n\t\t}\n\n\t\tconst apiKey = provider.auth.apiKey;\n\t\tif (!apiKey) return undefined;\n\t\tconst credential = stored?.type === \"api_key\" ? stored : undefined;\n\t\tconst result = await apiKey.resolve({ ctx: this.authContext, credential });\n\t\tif (!result) return undefined;\n\t\treturn { type: \"api_key\", key: result.auth.apiKey, env: result.env };\n\t}\n\n\tprivate async readCredential(providerId: string): Promise<Credential | undefined> {\n\t\ttry {\n\t\t\treturn await this.credentials.read(providerId);\n\t\t} catch (error) {\n\t\t\tthrow new ModelsError(\"auth\", `Credential store read failed for ${providerId}`, { cause: error });\n\t\t}\n\t}\n\n\tprivate async checkProviderAuth(\n\t\tprovider: Provider,\n\t\tcredential: Credential | undefined,\n\t): Promise<AuthCheck | undefined> {\n\t\tif (credential?.type === \"oauth\") {\n\t\t\treturn provider.auth.oauth ? { source: \"OAuth\", type: \"oauth\" } : undefined;\n\t\t}\n\t\tconst apiKey = provider.auth.apiKey;\n\t\tif (!apiKey) return undefined;\n\t\tif (apiKey.check) {\n\t\t\ttry {\n\t\t\t\treturn await apiKey.check({\n\t\t\t\t\tctx: this.authContext,\n\t\t\t\t\tcredential: credential?.type === \"api_key\" ? credential : undefined,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new ModelsError(\"auth\", `API key auth check failed for provider ${provider.id}`, { cause: error });\n\t\t\t}\n\t\t}\n\n\t\tconst resolution = await resolveProviderAuth(provider, this.credentials, this.authContext);\n\t\treturn resolution ? { source: resolution.source, type: \"api_key\" } : undefined;\n\t}\n\n\tasync checkAuth(providerId: string): Promise<AuthCheck | undefined> {\n\t\tconst provider = this.providers.get(providerId);\n\t\tif (!provider) return undefined;\n\t\treturn this.checkProviderAuth(provider, await this.readCredential(providerId));\n\t}\n\n\tasync getAvailable(providerId?: string): Promise<readonly Model<Api>[]> {\n\t\tconst providers = providerId\n\t\t\t? [this.providers.get(providerId)].filter((entry) => entry !== undefined)\n\t\t\t: this.getProviders();\n\t\tconst checks = await Promise.all(\n\t\t\tproviders.map(async (provider) => {\n\t\t\t\tconst credential = await this.readCredential(provider.id);\n\t\t\t\treturn { provider, credential, auth: await this.checkProviderAuth(provider, credential) };\n\t\t\t}),\n\t\t);\n\t\treturn checks.flatMap(({ provider, credential, auth }) => {\n\t\t\tif (!auth) return [];\n\t\t\tconst models = provider.getModels();\n\t\t\treturn provider.filterModels?.(models, credential) ?? models;\n\t\t});\n\t}\n\n\tgetAuth(providerId: string, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | Model<Api>,\n\t\toverrides?: AuthResolutionOverrides,\n\t): Promise<AuthResult | undefined> {\n\t\tconst providerId = typeof providerOrModel === \"string\" ? providerOrModel : providerOrModel.provider;\n\t\tconst provider = this.providers.get(providerId);\n\t\tif (!provider) return undefined;\n\t\tconst result = await resolveProviderAuth(provider, this.credentials, this.authContext, overrides);\n\t\tif (!result || typeof providerOrModel === \"string\" || !providerOrModel.headers) return result;\n\t\treturn {\n\t\t\t...result,\n\t\t\tauth: {\n\t\t\t\t...result.auth,\n\t\t\t\theaders: mergeHeaders(result.auth.headers, providerOrModel.headers),\n\t\t\t},\n\t\t};\n\t}\n\n\tasync login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential> {\n\t\tconst provider = this.providers.get(providerId);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${providerId}`);\n\t\tconst method = type === \"oauth\" ? provider.auth.oauth : provider.auth.apiKey;\n\t\tif (!method?.login) {\n\t\t\tthrow new ModelsError(\"auth\", `${provider.name} does not support ${type} login`);\n\t\t}\n\t\tconst credential = await method.login(interaction);\n\t\ttry {\n\t\t\tawait this.credentials.modify(providerId, async () => credential);\n\t\t} catch (error) {\n\t\t\tthrow new ModelsError(\"auth\", `Credential store modify failed for ${providerId}`, { cause: error });\n\t\t}\n\t\treturn credential;\n\t}\n\n\tasync logout(providerId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.credentials.delete(providerId);\n\t\t} catch (error) {\n\t\t\tthrow new ModelsError(\"auth\", `Credential store delete failed for ${providerId}`, { cause: error });\n\t\t}\n\t}\n\n\tprivate requireProvider(model: Model<Api>): Provider {\n\t\tconst provider = this.providers.get(model.provider);\n\t\tif (!provider) {\n\t\t\tthrow new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\t}\n\t\treturn provider;\n\t}\n\n\tprivate async applyAuth<TOptions extends StreamOptions & ModelsStreamTransforms>(\n\t\tmodel: Model<Api>,\n\t\toptions: TOptions | undefined,\n\t): Promise<{ requestModel: Model<Api>; requestOptions: StreamOptions | undefined }> {\n\t\tthis.requireProvider(model);\n\t\tconst resolution = await this.getAuth(model, {\n\t\t\tapiKey: options?.apiKey,\n\t\t\tenv: options?.env,\n\t\t});\n\t\tif (!resolution) {\n\t\t\tthrow new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\t\t}\n\t\tconst auth = resolution.auth;\n\n\t\t// Explicit request options win per-field; the Models-only transform runs last.\n\t\tconst apiKey = options?.apiKey ?? auth.apiKey;\n\t\tlet headers = mergeHeaders(auth.headers, options?.headers);\n\t\tif (options?.transformHeaders) headers = await options.transformHeaders(headers ?? {});\n\t\tconst env = resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;\n\t\tconst requestModel = auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model;\n\t\tconst { transformHeaders: _transformHeaders, ...providerOptions } = options ?? {};\n\t\tconst requestOptions = { ...providerOptions, apiKey, headers, env } as StreamOptions;\n\n\t\treturn { requestModel, requestOptions };\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst provider = this.requireProvider(model);\n\t\t\tconst { requestModel, requestOptions } = await this.applyAuth(\n\t\t\t\tmodel,\n\t\t\t\toptions as ModelsApiStreamOptions<Api> | undefined,\n\t\t\t);\n\t\t\treturn provider.stream(requestModel as Model<TApi>, context, requestOptions as ApiStreamOptions<TApi>);\n\t\t});\n\t}\n\n\tasync complete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst provider = this.requireProvider(model);\n\t\t\tconst { requestModel, requestOptions } = await this.applyAuth(model, options);\n\t\t\treturn provider.streamSimple(requestModel, context, requestOptions as SimpleStreamOptions);\n\t\t});\n\t}\n\n\tasync completeSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: Context,\n\t\toptions?: ModelsSimpleStreamOptions,\n\t): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n}\n\nexport function createModels(options?: CreateModelsOptions): MutableModels {\n\treturn new ModelsImpl(options);\n}\n\nexport interface CreateProviderOptions<TApi extends Api = Api> {\n\tid: string;\n\t/** Display name. Default: `id`. */\n\tname?: string;\n\tbaseUrl?: string;\n\theaders?: ProviderHeaders;\n\t/** Required — every provider has auth semantics, even ambient/keyless ones. */\n\tauth: ProviderAuth;\n\t/** Static baseline model list (empty for purely dynamic providers). */\n\tmodels: readonly Model<TApi>[];\n\t/** Fetch a dynamic model overlay. createProvider restores/persists it through ModelsStore. */\n\tfetchModels?: (context: RefreshModelsContext) => Promise<readonly Model<TApi>[]>;\n\tfilterModels?: (models: readonly Model<TApi>[], credential: Credential | undefined) => readonly Model<TApi>[];\n\t/** Single implementation, or map keyed by `model.api` for mixed-API providers. */\n\tapi: ProviderStreams | Partial<Record<TApi, ProviderStreams>>;\n}\n\n/**\n * Builds a provider from parts. Built-in provider factories and models.json\n * custom providers both go through this. A single `api` streams all models;\n * an `api` map dispatches on `model.api`, and a model whose api has no entry\n * produces a stream error.\n */\nexport function createProvider<TApi extends Api = Api>(input: CreateProviderOptions<TApi>): Provider<TApi> {\n\tconst baselineModels = input.models;\n\tlet dynamicModels: readonly Model<TApi>[] = [];\n\tlet inflightRefresh: Promise<void> | undefined;\n\tconst fetchModels = input.fetchModels;\n\tconst currentModels = (): readonly Model<TApi>[] => {\n\t\tconst merged = [...baselineModels];\n\t\tfor (const model of dynamicModels) {\n\t\t\tconst index = merged.findIndex((entry) => entry.id === model.id);\n\t\t\tif (index >= 0) merged[index] = model;\n\t\t\telse merged.push(model);\n\t\t}\n\t\treturn merged;\n\t};\n\tconst single =\n\t\ttypeof (input.api as ProviderStreams).stream === \"function\" ? (input.api as ProviderStreams) : undefined;\n\tconst byApi = single ? undefined : (input.api as Partial<Record<string, ProviderStreams>>);\n\n\tconst apiFor = (model: Model<Api>): ProviderStreams | undefined => single ?? byApi?.[model.api];\n\n\tconst dispatch = (\n\t\tmodel: Model<Api>,\n\t\trun: (streams: ProviderStreams) => AssistantMessageEventStream,\n\t): AssistantMessageEventStream => {\n\t\tconst streams = apiFor(model);\n\t\tif (!streams) {\n\t\t\treturn lazyStream(model, async () => {\n\t\t\t\tthrow new ModelsError(\"stream\", `Provider ${input.id} has no API implementation for \"${model.api}\"`);\n\t\t\t});\n\t\t}\n\t\treturn run(streams);\n\t};\n\n\treturn {\n\t\tid: input.id,\n\t\tname: input.name ?? input.id,\n\t\tbaseUrl: input.baseUrl,\n\t\theaders: input.headers,\n\t\tauth: input.auth,\n\t\tgetModels: currentModels,\n\t\trefreshModels: fetchModels\n\t\t\t? (context) => {\n\t\t\t\t\tinflightRefresh ??= (async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst stored = await context.store.read();\n\t\t\t\t\t\t\tif (stored) {\n\t\t\t\t\t\t\t\tdynamicModels = stored.models\n\t\t\t\t\t\t\t\t\t.filter((model) => model.provider === input.id)\n\t\t\t\t\t\t\t\t\t.map((model) => model as Model<TApi>);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!context.allowNetwork || context.signal?.aborted) return;\n\t\t\t\t\t\t\tconst refreshed = await fetchModels(context);\n\t\t\t\t\t\t\tif (context.signal?.aborted) return;\n\t\t\t\t\t\t\tdynamicModels = refreshed;\n\t\t\t\t\t\t\tawait context.store.write({ models: refreshed, checkedAt: Date.now() });\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tinflightRefresh = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t\t\treturn inflightRefresh;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tfilterModels: input.filterModels,\n\t\tstream: (model, context, options) => dispatch(model, (streams) => streams.stream(model, context, options)),\n\t\tstreamSimple: (model, context, options) =>\n\t\t\tdispatch(model, (streams) => streams.streamSimple(model, context, options)),\n\t};\n}\n\n/**\n * Runtime-checked narrowing for dynamically looked-up models:\n *\n * ```ts\n * const model = models.getModel(\"anthropic\", \"claude-opus-4-7\");\n * if (model && hasApi(model, \"anthropic-messages\")) {\n * // model: Model<\"anthropic-messages\">, stream options fully typed\n * }\n * ```\n */\nexport function hasApi<TApi extends Api>(model: Model<Api>, api: TApi): model is Model<TApi> {\n\treturn model.api === api;\n}\n\nexport function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage[\"cost\"] {\n\tconst inputTokens = usage.input + usage.cacheRead + usage.cacheWrite;\n\tlet rates: ModelCostRates = model.cost;\n\tlet matchedThreshold = -1;\n\tfor (const tier of model.cost.tiers ?? []) {\n\t\tif (inputTokens > tier.inputTokensAbove && tier.inputTokensAbove > matchedThreshold) {\n\t\t\trates = tier;\n\t\t\tmatchedThreshold = tier.inputTokensAbove;\n\t\t}\n\t}\n\n\t// Anthropic charges 2x base input for 1h cache writes.\n\tconst longWrite = usage.cacheWrite1h ?? 0;\n\tconst shortWrite = usage.cacheWrite - longWrite;\n\tusage.cost.input = (rates.input / 1000000) * usage.input;\n\tusage.cost.output = (rates.output / 1000000) * usage.output;\n\tusage.cost.cacheRead = (rates.cacheRead / 1000000) * usage.cacheRead;\n\tusage.cost.cacheWrite = (rates.cacheWrite * shortWrite + rates.input * 2 * longWrite) / 1000000;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n\treturn usage.cost;\n}\n\nconst EXTENDED_THINKING_LEVELS: ModelThinkingLevel[] = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"];\n\nexport function getSupportedThinkingLevels<TApi extends Api>(model: Model<TApi>): ModelThinkingLevel[] {\n\tif (!model.reasoning) return [\"off\"];\n\n\treturn EXTENDED_THINKING_LEVELS.filter((level) => {\n\t\tconst mapped = model.thinkingLevelMap?.[level];\n\t\tif (mapped === null) return false;\n\t\tif (level === \"xhigh\") return supportsXhigh(model);\n\t\tif (level === \"max\") return supportsMax(model);\n\t\treturn true;\n\t});\n}\n\nexport function clampThinkingLevel<TApi extends Api>(\n\tmodel: Model<TApi>,\n\tlevel: ModelThinkingLevel,\n): ModelThinkingLevel {\n\tconst availableLevels = getSupportedThinkingLevels(model);\n\tif (availableLevels.includes(level)) return level;\n\n\tconst requestedIndex = EXTENDED_THINKING_LEVELS.indexOf(level);\n\tif (requestedIndex === -1) return availableLevels[0] ?? \"off\";\n\n\tfor (let i = requestedIndex; i < EXTENDED_THINKING_LEVELS.length; i++) {\n\t\tconst candidate = EXTENDED_THINKING_LEVELS[i];\n\t\tif (availableLevels.includes(candidate)) return candidate;\n\t}\n\tfor (let i = requestedIndex - 1; i >= 0; i--) {\n\t\tconst candidate = EXTENDED_THINKING_LEVELS[i];\n\t\tif (availableLevels.includes(candidate)) return candidate;\n\t}\n\treturn availableLevels[0] ?? \"off\";\n}\n\n/**\n * Whether the model exposes the `xhigh` tier.\n *\n * An explicit `thinkingLevelMap` is authoritative: `null` vetoes the tier and a map that omits\n * `xhigh` disables it. Only map-less models fall back to id-based inference, so custom providers\n * that ship a reasoning model without generated catalog metadata still surface the tier.\n */\nexport function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst mapped = model.thinkingLevelMap?.xhigh;\n\tif (mapped === null) return false;\n\tif (mapped !== undefined) return true;\n\tif (model.thinkingLevelMap !== undefined) return false;\n\treturn model.reasoning && supportsXhighModelId(model.id);\n}\n\nconst XHIGH_MODEL_IDS = [\n\t\"gpt-5.2\",\n\t\"gpt-5.3\",\n\t\"gpt-5.4\",\n\t\"gpt-5.5\",\n\t\"gpt-5.6-luna\",\n\t\"gpt-5.6-sol\",\n\t\"gpt-5.6-terra\",\n\t\"deepseek-v4-pro\",\n\t\"deepseek-v4-flash\",\n\t\"opus-4-6\",\n\t\"opus-4.6\",\n\t\"opus-4-7\",\n\t\"opus-4.7\",\n\t\"opus-4-8\",\n\t\"opus-4.8\",\n\t\"opus-5\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n];\n\nfunction escapeRegex(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Match a complete model family marker, not an alphanumeric substring of another id. */\nfunction matchesModelFamily(modelId: string, family: string): boolean {\n\tconst normalizedId = modelId.toLowerCase();\n\tconst escapedFamily = escapeRegex(family.toLowerCase());\n\t// GPT aliases use a complete id or provider namespace; a hyphenated word prefix is not a provider namespace.\n\tconst leadingBoundary = family.startsWith(\"gpt-\") ? \"(?:^|[/.:_])\" : \"(?:^|[/.:_-])\";\n\treturn new RegExp(`${leadingBoundary}${escapedFamily}(?=$|[^a-z0-9])`).test(normalizedId);\n}\n\nfunction supportsXhighModelId(modelId: string): boolean {\n\treturn XHIGH_MODEL_IDS.some((id) => matchesModelFamily(modelId, id));\n}\n\n/**\n * Whether the model exposes the `max` tier.\n *\n * Mirrors {@link supportsXhigh}: an explicit `thinkingLevelMap` wins, and only map-less models\n * are inferred from the id.\n */\nexport function supportsMax<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst mapped = model.thinkingLevelMap?.max;\n\tif (mapped === null) return false;\n\tif (mapped !== undefined) return true;\n\tif (model.thinkingLevelMap !== undefined) return false;\n\treturn supportsMaxModel(model);\n}\n\n/** OpenAI-compatible APIs that accept a native `max` reasoning effort on the wire. */\nconst OPENAI_MAX_APIS: Api[] = [\n\t\"openai-responses\",\n\t\"azure-openai-responses\",\n\t\"openai-codex-responses\",\n\t\"openai-completions\",\n];\n\n/** Model family that accepts native `max` effort on OpenAI-compatible APIs. */\nconst GPT_56_SOL_ID = \"gpt-5.6-sol\";\n\nconst MAX_MODEL_IDS = [\n\t\"opus-4-6\",\n\t\"opus-4.6\",\n\t\"opus-4-7\",\n\t\"opus-4.7\",\n\t\"opus-4-8\",\n\t\"opus-4.8\",\n\t\"opus-5\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n];\n\nfunction supportsMaxModel<TApi extends Api>(model: Model<TApi>): boolean {\n\tif (!model.reasoning) return false;\n\tif (OPENAI_MAX_APIS.includes(model.api) && matchesModelFamily(model.id, GPT_56_SOL_ID)) return true;\n\treturn MAX_MODEL_IDS.some((id) => matchesModelFamily(model.id, id));\n}\n\n/**\n * Check if two models are equal by comparing both their id and provider.\n * Returns false if either model is null or undefined.\n */\nexport function modelsAreEqual<TApi extends Api>(\n\ta: Model<TApi> | null | undefined,\n\tb: Model<TApi> | null | undefined,\n): boolean {\n\tif (!a || !b) return false;\n\treturn a.id === b.id && a.provider === b.provider;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,0BAA0B,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAgC,WAAW,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAWnG,OAAO,EAAE,mBAAmB,EAA8C,MAAM,mBAAmB,CAAC;AAiBpG,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AA0KtE,SAAS,YAAY,CACpB,IAAi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AK,CAAC,gBAAgB,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACvD,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,sFAAsF;AACtF,MAAM,eAAe,GAAU;IAC9B,kBAAkB;IAClB,wBAAwB;IACxB,wBAAwB;IACxB,oBAAoB;CACpB,CAAC;AAEF,+EAA+E;AAC/E,MAAM,aAAa,GAAG,aAAa,CAAC;AAEpC,MAAM,aAAa,GAAG;IACrB,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,SAAS;CACT,CAAC;AAEF,SAAS,gBAAgB,CAAmB,KAAkB;IAC7D,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IACpG,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC7B,CAAiC,EACjC,CAAiC;IAEjC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC;AACnD,CAAC","sourcesContent":["import { lazyStream } from \"./api/lazy.ts\";\nimport { defaultProviderAuthContext as defaultAuthContext } from \"./auth/context.ts\";\nimport { InMemoryCredentialStore } from \"./auth/credential-store.ts\";\nimport { type AuthResolutionOverrides, ModelsError, resolveProviderAuth } from \"./auth/resolve.ts\";\nimport type {\n\tAuthCheck,\n\tAuthContext,\n\tAuthInteraction,\n\tAuthResult,\n\tAuthType,\n\tCredential,\n\tCredentialStore,\n\tProviderAuth,\n} from \"./auth/types.ts\";\nimport { InMemoryModelsStore, type ModelsStore, type ProviderModelsStore } from \"./models-store.ts\";\nimport type {\n\tApi,\n\tApiStreamOptions,\n\tAssistantMessage,\n\tAssistantMessageEventStream,\n\tContext,\n\tModel,\n\tModelCostRates,\n\tModelThinkingLevel,\n\tProviderHeaders,\n\tProviderStreams,\n\tSimpleStreamOptions,\n\tStreamOptions,\n\tUsage,\n} from \"./types.ts\";\n\nexport { ModelsError, type ModelsErrorCode } from \"./auth/resolve.ts\";\n\nexport interface RefreshModelsContext {\n\t/** Effective configured credential. OAuth credentials are refreshed before network access. */\n\tcredential?: Credential;\n\t/** Persistent model storage scoped to this provider ID. */\n\tstore: ProviderModelsStore;\n\t/** False during offline/cache-only initialization. */\n\tallowNetwork: boolean;\n\t/** Bypass provider freshness checks and fetch immediately when network access is allowed. */\n\tforce?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport interface ModelsRefreshOptions {\n\tallowNetwork?: boolean;\n\t/** Bypass provider freshness checks and fetch immediately when network access is allowed. */\n\tforce?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport interface ModelsRefreshResult {\n\taborted: boolean;\n\terrors: ReadonlyMap<string, Error>;\n}\n\nexport interface ModelsStreamTransforms {\n\t/** Transform fully assembled model/auth/request headers before provider dispatch. */\n\ttransformHeaders?: (headers: ProviderHeaders) => ProviderHeaders | Promise<ProviderHeaders>;\n}\n\nexport type ModelsApiStreamOptions<TApi extends Api> = ApiStreamOptions<TApi> & ModelsStreamTransforms;\nexport type ModelsSimpleStreamOptions = SimpleStreamOptions & ModelsStreamTransforms;\n\n/**\n * A provider is the concrete runtime unit. It owns id/name/base metadata,\n * auth methods, model listing, and stream behavior.\n *\n * `TApi` lets concrete provider factories declare which APIs their models\n * use (e.g. `openaiProvider(): Provider<\"openai-responses\" | \"openai-completions\">`),\n * giving typed model lists to direct factory users. Inside a `Models`\n * collection providers are held as `Provider<Api>`.\n */\nexport interface Provider<TApi extends Api = Api> {\n\treadonly id: string;\n\treadonly name: string;\n\n\treadonly baseUrl?: string;\n\treadonly headers?: ProviderHeaders;\n\n\t/**\n\t * Required: at least one of `apiKey`/`oauth`. Every provider has auth\n\t * semantics — even providers with only ambient credentials (env vars, AWS\n\t * profiles, ADC files) and keyless local servers provide `apiKey` auth\n\t * whose `resolve()` reports whether the provider is configured.\n\t * `Models.getAuth()` returns undefined when the provider is unconfigured.\n\t */\n\treadonly auth: ProviderAuth;\n\n\t/**\n\t * Current known models, sync. Static providers return their catalog;\n\t * dynamic providers return the list as of the last `refreshModels()`\n\t * (empty before the first). Must not throw; `Models` treats a throwing\n\t * implementation as having no models.\n\t */\n\tgetModels(): readonly Model<TApi>[];\n\n\t/**\n\t * Dynamic providers only: restore the provider-scoped stored catalog and optionally fetch\n\t * a newer list using the effective credential. Implementations must retain their previous\n\t * list on failure and honor the shared abort signal for network requests.\n\t */\n\trefreshModels?(context: RefreshModelsContext): Promise<void>;\n\n\t/**\n\t * Optional provider policy for credential-specific model availability.\n\t * `getModels()` remains the complete synchronous catalog; `Models.getAvailable()`\n\t * applies this filter after confirming that provider auth is configured.\n\t */\n\tfilterModels?(models: readonly Model<TApi>[], credential: Credential | undefined): readonly Model<TApi>[];\n\n\tstream<T extends TApi>(\n\t\tmodel: Model<T>,\n\t\tcontext: Context,\n\t\toptions?: ApiStreamOptions<T>,\n\t): AssistantMessageEventStream;\n\n\tstreamSimple(model: Model<TApi>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;\n}\n\n/**\n * Runtime collection of providers plus auth application and stream\n * convenience. Providers own stream behavior; `Models` resolves auth and\n * delegates each request to the provider that owns the model.\n */\nexport interface Models {\n\tgetProviders(): readonly Provider[];\n\tgetProvider(id: string): Provider | undefined;\n\n\t/**\n\t * Sync read of last-known models from one provider or all providers.\n\t * Best-effort: a provider whose `getModels()` throws yields no models.\n\t */\n\tgetModels(provider?: string): readonly Model<Api>[];\n\n\t/**\n\t * Sync runtime model lookup against last-known lists. Dynamic model lists\n\t * are typed as `Model<Api>`; narrow with the `hasApi()` type guard.\n\t */\n\tgetModel(provider: string, id: string): Model<Api> | undefined;\n\n\t/**\n\t * Refresh every configured dynamic provider concurrently. Provider errors and cancellation\n\t * are returned without rejecting; static and unconfigured providers are skipped.\n\t */\n\trefresh(options?: ModelsRefreshOptions): Promise<ModelsRefreshResult>;\n\n\t/** Check whether a provider has complete auth configuration without refreshing OAuth. */\n\tcheckAuth(providerId: string): Promise<AuthCheck | undefined>;\n\n\t/** Return models whose providers have complete auth configuration. */\n\tgetAvailable(providerId?: string): Promise<readonly Model<Api>[]>;\n\n\t/**\n\t * Resolve provider-scoped auth by provider id, or provider auth plus static\n\t * model headers when passed a model. Includes a source label for status UI.\n\t * Resolves `undefined` when the provider is unknown or unconfigured.\n\t * Rejects with `ModelsError`: code \"oauth\" when a token refresh fails (the\n\t * stored credential is preserved for retry; re-login fixes it), code \"auth\"\n\t * when api-key resolution or the credential store fails. Request paths\n\t * surface rejections as stream errors.\n\t */\n\tgetAuth(providerId: string, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\n\t/** Run a provider-owned login flow and persist its returned credential. */\n\tlogin(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential>;\n\n\t/** Remove the stored credential for a provider. */\n\tlogout(providerId: string): Promise<void>;\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream;\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage>;\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream;\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage>;\n}\n\nexport interface MutableModels extends Models {\n\t/** Upsert/replace by provider.id. Provider ids are unique. */\n\tsetProvider(provider: Provider): void;\n\tdeleteProvider(id: string): void;\n\tclearProviders(): void;\n}\n\nexport interface CreateModelsOptions {\n\tcredentials?: CredentialStore;\n\tmodelsStore?: ModelsStore;\n\tauthContext?: AuthContext;\n}\n\nfunction mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\nclass ModelsImpl implements MutableModels {\n\tprivate providers = new Map<string, Provider>();\n\tprivate credentials: CredentialStore;\n\tprivate modelsStore: ModelsStore;\n\tprivate authContext: AuthContext;\n\n\tconstructor(options?: CreateModelsOptions) {\n\t\tthis.credentials = options?.credentials ?? new InMemoryCredentialStore();\n\t\tthis.modelsStore = options?.modelsStore ?? new InMemoryModelsStore();\n\t\tthis.authContext = options?.authContext ?? defaultAuthContext();\n\t}\n\n\tsetProvider(provider: Provider): void {\n\t\tthis.providers.set(provider.id, provider);\n\t}\n\n\tdeleteProvider(id: string): void {\n\t\tthis.providers.delete(id);\n\t}\n\n\tclearProviders(): void {\n\t\tthis.providers.clear();\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn Array.from(this.providers.values());\n\t}\n\n\tgetProvider(id: string): Provider | undefined {\n\t\treturn this.providers.get(id);\n\t}\n\n\tgetModels(provider?: string): readonly Model<Api>[] {\n\t\tif (provider !== undefined) {\n\t\t\tconst entry = this.providers.get(provider);\n\t\t\tif (!entry) return [];\n\t\t\ttry {\n\t\t\t\treturn entry.getModels();\n\t\t\t} catch {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\tconst models: Model<Api>[] = [];\n\t\tfor (const entry of this.providers.values()) {\n\t\t\ttry {\n\t\t\t\tmodels.push(...entry.getModels());\n\t\t\t} catch {\n\t\t\t\t// Best-effort: ill-behaved providers yield no models.\n\t\t\t}\n\t\t}\n\t\treturn models;\n\t}\n\n\tgetModel(provider: string, id: string): Model<Api> | undefined {\n\t\treturn this.getModels(provider).find((model) => model.id === id);\n\t}\n\n\tasync refresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\tconst allowNetwork = options.allowNetwork ?? true;\n\t\tconst errors = new Map<string, Error>();\n\t\tconst refreshable = Array.from(this.providers.values()).filter(\n\t\t\t(provider): provider is Provider & Required<Pick<Provider, \"refreshModels\">> =>\n\t\t\t\tprovider.refreshModels !== undefined,\n\t\t);\n\n\t\tawait Promise.all(\n\t\t\trefreshable.map(async (provider) => {\n\t\t\t\tif (options.signal?.aborted) return;\n\t\t\t\tconst store: ProviderModelsStore = {\n\t\t\t\t\tread: () => this.modelsStore.read(provider.id),\n\t\t\t\t\twrite: (entry) => this.modelsStore.write(provider.id, entry),\n\t\t\t\t\tdelete: () => this.modelsStore.delete(provider.id),\n\t\t\t\t};\n\t\t\t\tlet stored: Credential | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tstored = await this.readCredential(provider.id);\n\t\t\t\t\tconst credential = await this.resolveRefreshCredential(provider, stored, allowNetwork, options.signal);\n\t\t\t\t\tif (!credential) return;\n\t\t\t\t\tawait provider.refreshModels({\n\t\t\t\t\t\tcredential,\n\t\t\t\t\t\tstore,\n\t\t\t\t\t\tallowNetwork,\n\t\t\t\t\t\tforce: options.force,\n\t\t\t\t\t\tsignal: options.signal,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!options.signal?.aborted) {\n\t\t\t\t\t\terrors.set(\n\t\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\t\terror instanceof Error\n\t\t\t\t\t\t\t\t? error\n\t\t\t\t\t\t\t\t: new ModelsError(\"model_source\", `Model refresh failed for ${provider.id}`, { cause: error }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait provider.refreshModels({\n\t\t\t\t\t\t\tcredential: stored,\n\t\t\t\t\t\t\tstore,\n\t\t\t\t\t\t\tallowNetwork: false,\n\t\t\t\t\t\t\tsignal: options.signal,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Preserve the original auth/network error; cache restoration is best-effort here.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\treturn { aborted: options.signal?.aborted ?? false, errors };\n\t}\n\n\tprivate async resolveRefreshCredential(\n\t\tprovider: Provider,\n\t\tstored: Credential | undefined,\n\t\tallowNetwork: boolean,\n\t\tsignal?: AbortSignal,\n\t): Promise<Credential | undefined> {\n\t\tif (stored?.type === \"oauth\") {\n\t\t\tconst oauth = provider.auth.oauth;\n\t\t\tif (!oauth) return undefined;\n\t\t\tif (!allowNetwork || Date.now() < stored.expires) return stored;\n\t\t\tif (signal?.aborted) return undefined;\n\t\t\tconst post = await this.credentials.modify(provider.id, async (current) => {\n\t\t\t\tif (current?.type !== \"oauth\" || Date.now() < current.expires) return undefined;\n\t\t\t\treturn oauth.refresh(current, signal);\n\t\t\t});\n\t\t\treturn post?.type === \"oauth\" ? post : undefined;\n\t\t}\n\n\t\tconst apiKey = provider.auth.apiKey;\n\t\tif (!apiKey) return undefined;\n\t\tconst credential = stored?.type === \"api_key\" ? stored : undefined;\n\t\tconst result = await apiKey.resolve({ ctx: this.authContext, credential });\n\t\tif (!result) return undefined;\n\t\treturn { type: \"api_key\", key: result.auth.apiKey, env: result.env };\n\t}\n\n\tprivate async readCredential(providerId: string): Promise<Credential | undefined> {\n\t\ttry {\n\t\t\treturn await this.credentials.read(providerId);\n\t\t} catch (error) {\n\t\t\tthrow new ModelsError(\"auth\", `Credential store read failed for ${providerId}`, { cause: error });\n\t\t}\n\t}\n\n\tprivate async checkProviderAuth(\n\t\tprovider: Provider,\n\t\tcredential: Credential | undefined,\n\t): Promise<AuthCheck | undefined> {\n\t\tif (credential?.type === \"oauth\") {\n\t\t\treturn provider.auth.oauth ? { source: \"OAuth\", type: \"oauth\" } : undefined;\n\t\t}\n\t\tconst apiKey = provider.auth.apiKey;\n\t\tif (!apiKey) return undefined;\n\t\tif (apiKey.check) {\n\t\t\ttry {\n\t\t\t\treturn await apiKey.check({\n\t\t\t\t\tctx: this.authContext,\n\t\t\t\t\tcredential: credential?.type === \"api_key\" ? credential : undefined,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new ModelsError(\"auth\", `API key auth check failed for provider ${provider.id}`, { cause: error });\n\t\t\t}\n\t\t}\n\n\t\tconst resolution = await resolveProviderAuth(provider, this.credentials, this.authContext);\n\t\treturn resolution ? { source: resolution.source, type: \"api_key\" } : undefined;\n\t}\n\n\tasync checkAuth(providerId: string): Promise<AuthCheck | undefined> {\n\t\tconst provider = this.providers.get(providerId);\n\t\tif (!provider) return undefined;\n\t\treturn this.checkProviderAuth(provider, await this.readCredential(providerId));\n\t}\n\n\tasync getAvailable(providerId?: string): Promise<readonly Model<Api>[]> {\n\t\tconst providers = providerId\n\t\t\t? [this.providers.get(providerId)].filter((entry) => entry !== undefined)\n\t\t\t: this.getProviders();\n\t\tconst checks = await Promise.all(\n\t\t\tproviders.map(async (provider) => {\n\t\t\t\tconst credential = await this.readCredential(provider.id);\n\t\t\t\treturn { provider, credential, auth: await this.checkProviderAuth(provider, credential) };\n\t\t\t}),\n\t\t);\n\t\treturn checks.flatMap(({ provider, credential, auth }) => {\n\t\t\tif (!auth) return [];\n\t\t\tconst models = provider.getModels();\n\t\t\treturn provider.filterModels?.(models, credential) ?? models;\n\t\t});\n\t}\n\n\tgetAuth(providerId: string, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: AuthResolutionOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | Model<Api>,\n\t\toverrides?: AuthResolutionOverrides,\n\t): Promise<AuthResult | undefined> {\n\t\tconst providerId = typeof providerOrModel === \"string\" ? providerOrModel : providerOrModel.provider;\n\t\tconst provider = this.providers.get(providerId);\n\t\tif (!provider) return undefined;\n\t\tconst result = await resolveProviderAuth(provider, this.credentials, this.authContext, overrides);\n\t\tif (!result || typeof providerOrModel === \"string\" || !providerOrModel.headers) return result;\n\t\treturn {\n\t\t\t...result,\n\t\t\tauth: {\n\t\t\t\t...result.auth,\n\t\t\t\theaders: mergeHeaders(result.auth.headers, providerOrModel.headers),\n\t\t\t},\n\t\t};\n\t}\n\n\tasync login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential> {\n\t\tconst provider = this.providers.get(providerId);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${providerId}`);\n\t\tconst method = type === \"oauth\" ? provider.auth.oauth : provider.auth.apiKey;\n\t\tif (!method?.login) {\n\t\t\tthrow new ModelsError(\"auth\", `${provider.name} does not support ${type} login`);\n\t\t}\n\t\tconst credential = await method.login(interaction);\n\t\ttry {\n\t\t\tawait this.credentials.modify(providerId, async () => credential);\n\t\t} catch (error) {\n\t\t\tthrow new ModelsError(\"auth\", `Credential store modify failed for ${providerId}`, { cause: error });\n\t\t}\n\t\treturn credential;\n\t}\n\n\tasync logout(providerId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.credentials.delete(providerId);\n\t\t} catch (error) {\n\t\t\tthrow new ModelsError(\"auth\", `Credential store delete failed for ${providerId}`, { cause: error });\n\t\t}\n\t}\n\n\tprivate requireProvider(model: Model<Api>): Provider {\n\t\tconst provider = this.providers.get(model.provider);\n\t\tif (!provider) {\n\t\t\tthrow new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\t}\n\t\treturn provider;\n\t}\n\n\tprivate async applyAuth<TOptions extends StreamOptions & ModelsStreamTransforms>(\n\t\tmodel: Model<Api>,\n\t\toptions: TOptions | undefined,\n\t): Promise<{ requestModel: Model<Api>; requestOptions: StreamOptions | undefined }> {\n\t\tthis.requireProvider(model);\n\t\tconst resolution = await this.getAuth(model, {\n\t\t\tapiKey: options?.apiKey,\n\t\t\tenv: options?.env,\n\t\t});\n\t\tif (!resolution) {\n\t\t\tthrow new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\t\t}\n\t\tconst auth = resolution.auth;\n\n\t\t// Explicit request options win per-field; the Models-only transform runs last.\n\t\tconst apiKey = options?.apiKey ?? auth.apiKey;\n\t\tlet headers = mergeHeaders(auth.headers, options?.headers);\n\t\tif (options?.transformHeaders) headers = await options.transformHeaders(headers ?? {});\n\t\tconst env = resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;\n\t\tconst requestModel = auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model;\n\t\tconst { transformHeaders: _transformHeaders, ...providerOptions } = options ?? {};\n\t\tconst requestOptions = { ...providerOptions, apiKey, headers, env } as StreamOptions;\n\n\t\treturn { requestModel, requestOptions };\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst provider = this.requireProvider(model);\n\t\t\tconst { requestModel, requestOptions } = await this.applyAuth(\n\t\t\t\tmodel,\n\t\t\t\toptions as ModelsApiStreamOptions<Api> | undefined,\n\t\t\t);\n\t\t\treturn provider.stream(requestModel as Model<TApi>, context, requestOptions as ApiStreamOptions<TApi>);\n\t\t});\n\t}\n\n\tasync complete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst provider = this.requireProvider(model);\n\t\t\tconst { requestModel, requestOptions } = await this.applyAuth(model, options);\n\t\t\treturn provider.streamSimple(requestModel, context, requestOptions as SimpleStreamOptions);\n\t\t});\n\t}\n\n\tasync completeSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: Context,\n\t\toptions?: ModelsSimpleStreamOptions,\n\t): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n}\n\nexport function createModels(options?: CreateModelsOptions): MutableModels {\n\treturn new ModelsImpl(options);\n}\n\nexport interface CreateProviderOptions<TApi extends Api = Api> {\n\tid: string;\n\t/** Display name. Default: `id`. */\n\tname?: string;\n\tbaseUrl?: string;\n\theaders?: ProviderHeaders;\n\t/** Required — every provider has auth semantics, even ambient/keyless ones. */\n\tauth: ProviderAuth;\n\t/** Static baseline model list (empty for purely dynamic providers). */\n\tmodels: readonly Model<TApi>[];\n\t/** Fetch a dynamic model overlay. createProvider restores/persists it through ModelsStore. */\n\tfetchModels?: (context: RefreshModelsContext) => Promise<readonly Model<TApi>[]>;\n\tfilterModels?: (models: readonly Model<TApi>[], credential: Credential | undefined) => readonly Model<TApi>[];\n\t/** Single implementation, or map keyed by `model.api` for mixed-API providers. */\n\tapi: ProviderStreams | Partial<Record<TApi, ProviderStreams>>;\n}\n\n/**\n * Builds a provider from parts. Built-in provider factories and models.json\n * custom providers both go through this. A single `api` streams all models;\n * an `api` map dispatches on `model.api`, and a model whose api has no entry\n * produces a stream error.\n */\nexport function createProvider<TApi extends Api = Api>(input: CreateProviderOptions<TApi>): Provider<TApi> {\n\tconst baselineModels = input.models;\n\tlet dynamicModels: readonly Model<TApi>[] = [];\n\tlet inflightRefresh: Promise<void> | undefined;\n\tconst fetchModels = input.fetchModels;\n\tconst currentModels = (): readonly Model<TApi>[] => {\n\t\tconst merged = [...baselineModels];\n\t\tfor (const model of dynamicModels) {\n\t\t\tconst index = merged.findIndex((entry) => entry.id === model.id);\n\t\t\tif (index >= 0) merged[index] = model;\n\t\t\telse merged.push(model);\n\t\t}\n\t\treturn merged;\n\t};\n\tconst single =\n\t\ttypeof (input.api as ProviderStreams).stream === \"function\" ? (input.api as ProviderStreams) : undefined;\n\tconst byApi = single ? undefined : (input.api as Partial<Record<string, ProviderStreams>>);\n\n\tconst apiFor = (model: Model<Api>): ProviderStreams | undefined => single ?? byApi?.[model.api];\n\n\tconst dispatch = (\n\t\tmodel: Model<Api>,\n\t\trun: (streams: ProviderStreams) => AssistantMessageEventStream,\n\t): AssistantMessageEventStream => {\n\t\tconst streams = apiFor(model);\n\t\tif (!streams) {\n\t\t\treturn lazyStream(model, async () => {\n\t\t\t\tthrow new ModelsError(\"stream\", `Provider ${input.id} has no API implementation for \"${model.api}\"`);\n\t\t\t});\n\t\t}\n\t\treturn run(streams);\n\t};\n\n\treturn {\n\t\tid: input.id,\n\t\tname: input.name ?? input.id,\n\t\tbaseUrl: input.baseUrl,\n\t\theaders: input.headers,\n\t\tauth: input.auth,\n\t\tgetModels: currentModels,\n\t\trefreshModels: fetchModels\n\t\t\t? (context) => {\n\t\t\t\t\tinflightRefresh ??= (async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst stored = await context.store.read();\n\t\t\t\t\t\t\tif (stored) {\n\t\t\t\t\t\t\t\tdynamicModels = stored.models\n\t\t\t\t\t\t\t\t\t.filter((model) => model.provider === input.id)\n\t\t\t\t\t\t\t\t\t.map((model) => model as Model<TApi>);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!context.allowNetwork || context.signal?.aborted) return;\n\t\t\t\t\t\t\tconst refreshed = await fetchModels(context);\n\t\t\t\t\t\t\tif (context.signal?.aborted || refreshed.length === 0) return;\n\t\t\t\t\t\t\tdynamicModels = refreshed;\n\t\t\t\t\t\t\tawait context.store.write({ models: refreshed, checkedAt: Date.now() });\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tinflightRefresh = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t})();\n\t\t\t\t\treturn inflightRefresh;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tfilterModels: input.filterModels,\n\t\tstream: (model, context, options) => dispatch(model, (streams) => streams.stream(model, context, options)),\n\t\tstreamSimple: (model, context, options) =>\n\t\t\tdispatch(model, (streams) => streams.streamSimple(model, context, options)),\n\t};\n}\n\n/**\n * Runtime-checked narrowing for dynamically looked-up models:\n *\n * ```ts\n * const model = models.getModel(\"anthropic\", \"claude-opus-4-7\");\n * if (model && hasApi(model, \"anthropic-messages\")) {\n * // model: Model<\"anthropic-messages\">, stream options fully typed\n * }\n * ```\n */\nexport function hasApi<TApi extends Api>(model: Model<Api>, api: TApi): model is Model<TApi> {\n\treturn model.api === api;\n}\n\nexport function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage[\"cost\"] {\n\tconst inputTokens = usage.input + usage.cacheRead + usage.cacheWrite;\n\tlet rates: ModelCostRates = model.cost;\n\tlet matchedThreshold = -1;\n\tfor (const tier of model.cost.tiers ?? []) {\n\t\tif (inputTokens > tier.inputTokensAbove && tier.inputTokensAbove > matchedThreshold) {\n\t\t\trates = tier;\n\t\t\tmatchedThreshold = tier.inputTokensAbove;\n\t\t}\n\t}\n\n\t// Anthropic charges 2x base input for 1h cache writes.\n\tconst longWrite = usage.cacheWrite1h ?? 0;\n\tconst shortWrite = usage.cacheWrite - longWrite;\n\tusage.cost.input = (rates.input / 1000000) * usage.input;\n\tusage.cost.output = (rates.output / 1000000) * usage.output;\n\tusage.cost.cacheRead = (rates.cacheRead / 1000000) * usage.cacheRead;\n\tusage.cost.cacheWrite = (rates.cacheWrite * shortWrite + rates.input * 2 * longWrite) / 1000000;\n\tusage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;\n\treturn usage.cost;\n}\n\nconst EXTENDED_THINKING_LEVELS: ModelThinkingLevel[] = [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"];\n\nexport function getSupportedThinkingLevels<TApi extends Api>(model: Model<TApi>): ModelThinkingLevel[] {\n\tif (!model.reasoning) return [\"off\"];\n\n\treturn EXTENDED_THINKING_LEVELS.filter((level) => {\n\t\tconst mapped = model.thinkingLevelMap?.[level];\n\t\tif (mapped === null) return false;\n\t\tif (level === \"xhigh\") return supportsXhigh(model);\n\t\tif (level === \"max\") return supportsMax(model);\n\t\treturn true;\n\t});\n}\n\nexport function clampThinkingLevel<TApi extends Api>(\n\tmodel: Model<TApi>,\n\tlevel: ModelThinkingLevel,\n): ModelThinkingLevel {\n\tconst availableLevels = getSupportedThinkingLevels(model);\n\tif (availableLevels.includes(level)) return level;\n\n\tconst requestedIndex = EXTENDED_THINKING_LEVELS.indexOf(level);\n\tif (requestedIndex === -1) return availableLevels[0] ?? \"off\";\n\n\tfor (let i = requestedIndex; i < EXTENDED_THINKING_LEVELS.length; i++) {\n\t\tconst candidate = EXTENDED_THINKING_LEVELS[i];\n\t\tif (availableLevels.includes(candidate)) return candidate;\n\t}\n\tfor (let i = requestedIndex - 1; i >= 0; i--) {\n\t\tconst candidate = EXTENDED_THINKING_LEVELS[i];\n\t\tif (availableLevels.includes(candidate)) return candidate;\n\t}\n\treturn availableLevels[0] ?? \"off\";\n}\n\n/**\n * Whether the model exposes the `xhigh` tier.\n *\n * An explicit `thinkingLevelMap` is authoritative: `null` vetoes the tier and a map that omits\n * `xhigh` disables it. Only map-less models fall back to id-based inference, so custom providers\n * that ship a reasoning model without generated catalog metadata still surface the tier.\n */\nexport function supportsXhigh<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst mapped = model.thinkingLevelMap?.xhigh;\n\tif (mapped === null) return false;\n\tif (mapped !== undefined) return true;\n\tif (model.thinkingLevelMap !== undefined) return false;\n\treturn model.reasoning && supportsXhighModelId(model.id);\n}\n\nconst XHIGH_MODEL_IDS = [\n\t\"gpt-5.2\",\n\t\"gpt-5.3\",\n\t\"gpt-5.4\",\n\t\"gpt-5.5\",\n\t\"gpt-5.6-luna\",\n\t\"gpt-5.6-sol\",\n\t\"gpt-5.6-terra\",\n\t\"deepseek-v4-pro\",\n\t\"deepseek-v4-flash\",\n\t\"opus-4-6\",\n\t\"opus-4.6\",\n\t\"opus-4-7\",\n\t\"opus-4.7\",\n\t\"opus-4-8\",\n\t\"opus-4.8\",\n\t\"opus-5\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n];\n\nfunction escapeRegex(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Match a complete model family marker, not an alphanumeric substring of another id. */\nfunction matchesModelFamily(modelId: string, family: string): boolean {\n\tconst normalizedId = modelId.toLowerCase();\n\tconst escapedFamily = escapeRegex(family.toLowerCase());\n\t// GPT aliases use a complete id or provider namespace; a hyphenated word prefix is not a provider namespace.\n\tconst leadingBoundary = family.startsWith(\"gpt-\") ? \"(?:^|[/.:_])\" : \"(?:^|[/.:_-])\";\n\treturn new RegExp(`${leadingBoundary}${escapedFamily}(?=$|[^a-z0-9])`).test(normalizedId);\n}\n\nfunction supportsXhighModelId(modelId: string): boolean {\n\treturn XHIGH_MODEL_IDS.some((id) => matchesModelFamily(modelId, id));\n}\n\n/**\n * Whether the model exposes the `max` tier.\n *\n * Mirrors {@link supportsXhigh}: an explicit `thinkingLevelMap` wins, and only map-less models\n * are inferred from the id.\n */\nexport function supportsMax<TApi extends Api>(model: Model<TApi>): boolean {\n\tconst mapped = model.thinkingLevelMap?.max;\n\tif (mapped === null) return false;\n\tif (mapped !== undefined) return true;\n\tif (model.thinkingLevelMap !== undefined) return false;\n\treturn supportsMaxModel(model);\n}\n\n/** OpenAI-compatible APIs that accept a native `max` reasoning effort on the wire. */\nconst OPENAI_MAX_APIS: Api[] = [\n\t\"openai-responses\",\n\t\"azure-openai-responses\",\n\t\"openai-codex-responses\",\n\t\"openai-completions\",\n];\n\n/** Model family that accepts native `max` effort on OpenAI-compatible APIs. */\nconst GPT_56_SOL_ID = \"gpt-5.6-sol\";\n\nconst MAX_MODEL_IDS = [\n\t\"opus-4-6\",\n\t\"opus-4.6\",\n\t\"opus-4-7\",\n\t\"opus-4.7\",\n\t\"opus-4-8\",\n\t\"opus-4.8\",\n\t\"opus-5\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n];\n\nfunction supportsMaxModel<TApi extends Api>(model: Model<TApi>): boolean {\n\tif (!model.reasoning) return false;\n\tif (OPENAI_MAX_APIS.includes(model.api) && matchesModelFamily(model.id, GPT_56_SOL_ID)) return true;\n\treturn MAX_MODEL_IDS.some((id) => matchesModelFamily(model.id, id));\n}\n\n/**\n * Check if two models are equal by comparing both their id and provider.\n * Returns false if either model is null or undefined.\n */\nexport function modelsAreEqual<TApi extends Api>(\n\ta: Model<TApi> | null | undefined,\n\tb: Model<TApi> | null | undefined,\n): boolean {\n\tif (!a || !b) return false;\n\treturn a.id === b.id && a.provider === b.provider;\n}\n"]}
|
|
@@ -2,8 +2,9 @@ import { type ImagesProvider, type MutableImagesModels } from "../images-models.
|
|
|
2
2
|
import { MODELS } from "../models.generated.ts";
|
|
3
3
|
import { type CreateModelsOptions, type MutableModels, type Provider } from "../models.ts";
|
|
4
4
|
import type { Api, Model } from "../types.ts";
|
|
5
|
+
import { ollamaProvider } from "./ollama.ts";
|
|
5
6
|
import { radiusProvider } from "./radius.ts";
|
|
6
|
-
export { radiusProvider };
|
|
7
|
+
export { ollamaProvider, radiusProvider };
|
|
7
8
|
/** Providers present in the generated catalog. `KnownProvider` additionally
|
|
8
9
|
* includes purely dynamic providers (e.g. "radius") that have no static
|
|
9
10
|
* catalog entry. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../src/providers/all.ts"],"names":[],"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SAAS,SAAS,eAAe,EAAE,QAAQ,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EACnH,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,GACf,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAG7C;AAED,wBAAgB,mBAAmB,IAAI,eAAe,EAAE,CAEvD;AAED,qEAAqE;AACrE,wBAAgB,8BAA8B,IAAI,MAAM,GAAG,SAAS,CAGnE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,eAAe,EACjE,QAAQ,EAAE,SAAS,GACjB,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CASvE;AAED,mDAAmD;AACnD,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,CA2C7C;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAM1E;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAEzD;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAMtF"}
|
|
@@ -24,6 +24,7 @@ import { mistralProvider } from "./mistral.js";
|
|
|
24
24
|
import { moonshotaiProvider } from "./moonshotai.js";
|
|
25
25
|
import { moonshotaiCnProvider } from "./moonshotai-cn.js";
|
|
26
26
|
import { nvidiaProvider } from "./nvidia.js";
|
|
27
|
+
import { ollamaProvider } from "./ollama.js";
|
|
27
28
|
import { openaiProvider } from "./openai.js";
|
|
28
29
|
import { openaiCodexProvider } from "./openai-codex.js";
|
|
29
30
|
import { opencodeProvider } from "./opencode.js";
|
|
@@ -42,7 +43,7 @@ import { xiaomiTokenPlanCnProvider } from "./xiaomi-token-plan-cn.js";
|
|
|
42
43
|
import { xiaomiTokenPlanSgpProvider } from "./xiaomi-token-plan-sgp.js";
|
|
43
44
|
import { zaiProvider } from "./zai.js";
|
|
44
45
|
import { zaiCodingCnProvider } from "./zai-coding-cn.js";
|
|
45
|
-
export { radiusProvider };
|
|
46
|
+
export { ollamaProvider, radiusProvider };
|
|
46
47
|
const XIAOMI_MIMO_PROVIDERS = new Set([
|
|
47
48
|
"xiaomi",
|
|
48
49
|
"xiaomi-token-plan-cn",
|
|
@@ -122,6 +123,7 @@ export function builtinProviders() {
|
|
|
122
123
|
nvidiaProvider(),
|
|
123
124
|
openaiProvider(),
|
|
124
125
|
openaiCodexProvider(),
|
|
126
|
+
ollamaProvider(),
|
|
125
127
|
opencodeProvider(),
|
|
126
128
|
opencodeGoProvider(),
|
|
127
129
|
openrouterProvider(),
|