@iislee/opencodex 2.11.0
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/LICENSE +21 -0
- package/README.md +225 -0
- package/assets/architecture.png +0 -0
- package/assets/banner.png +0 -0
- package/assets/claude-code-models.gif +0 -0
- package/assets/codex-app-picker.png +0 -0
- package/bin/ocx.mjs +451 -0
- package/bin/package-main.mjs +9 -0
- package/gui/dist/assets/index-DTpMHS4F.js +67 -0
- package/gui/dist/assets/index-ZNVDE3C7.css +1 -0
- package/gui/dist/favicon.png +0 -0
- package/gui/dist/icons.svg +24 -0
- package/gui/dist/index.html +25 -0
- package/gui/dist/logo.png +0 -0
- package/gui/dist/provider-icons/alibaba-color.svg +1 -0
- package/gui/dist/provider-icons/antigravity-color.svg +1 -0
- package/gui/dist/provider-icons/antigravity.svg +1 -0
- package/gui/dist/provider-icons/claude-color.svg +1 -0
- package/gui/dist/provider-icons/claude.svg +1 -0
- package/gui/dist/provider-icons/cloudflare-ai-gateway-color.svg +1 -0
- package/gui/dist/provider-icons/copilot-color.svg +1 -0
- package/gui/dist/provider-icons/copilot.svg +1 -0
- package/gui/dist/provider-icons/cursor-color.svg +2 -0
- package/gui/dist/provider-icons/cursor.svg +2 -0
- package/gui/dist/provider-icons/deepseek-color.svg +1 -0
- package/gui/dist/provider-icons/discord.svg +1 -0
- package/gui/dist/provider-icons/firepass-color.svg +1 -0
- package/gui/dist/provider-icons/fireworks-color.svg +1 -0
- package/gui/dist/provider-icons/gemini-color.svg +1 -0
- package/gui/dist/provider-icons/gemini.svg +1 -0
- package/gui/dist/provider-icons/github-copilot-color.svg +1 -0
- package/gui/dist/provider-icons/gitlab-duo-color.svg +1 -0
- package/gui/dist/provider-icons/grok-color.svg +1 -0
- package/gui/dist/provider-icons/grok.svg +1 -0
- package/gui/dist/provider-icons/groq-color.svg +1 -0
- package/gui/dist/provider-icons/huggingface-color.svg +1 -0
- package/gui/dist/provider-icons/kimi-color.svg +1 -0
- package/gui/dist/provider-icons/kiro-color.svg +15 -0
- package/gui/dist/provider-icons/kiro.svg +14 -0
- package/gui/dist/provider-icons/lm-studio-color.svg +1 -0
- package/gui/dist/provider-icons/mistral-color.svg +1 -0
- package/gui/dist/provider-icons/moonshot-color.svg +1 -0
- package/gui/dist/provider-icons/nvidia-color.svg +1 -0
- package/gui/dist/provider-icons/ollama-color.svg +1 -0
- package/gui/dist/provider-icons/openai.svg +1 -0
- package/gui/dist/provider-icons/opencode.svg +1 -0
- package/gui/dist/provider-icons/openrouter-color.svg +1 -0
- package/gui/dist/provider-icons/pi.svg +21 -0
- package/gui/dist/provider-icons/qianfan-color.svg +1 -0
- package/gui/dist/provider-icons/qwen-portal-color.svg +1 -0
- package/gui/dist/provider-icons/telegram.svg +1 -0
- package/gui/dist/provider-icons/vercel-ai-gateway-color.svg +1 -0
- package/gui/dist/provider-icons/vllm-color.svg +1 -0
- package/gui/dist/provider-icons/xiaomi-color.svg +1 -0
- package/package.json +102 -0
- package/src/AGENTS.md +28 -0
- package/src/adapters/anthropic-image-guard.ts +251 -0
- package/src/adapters/anthropic-image-normalize.ts +518 -0
- package/src/adapters/anthropic.ts +1003 -0
- package/src/adapters/azure.ts +36 -0
- package/src/adapters/base.ts +72 -0
- package/src/adapters/client-fingerprint.ts +59 -0
- package/src/adapters/cursor/arg-codec.ts +38 -0
- package/src/adapters/cursor/arg-normalize.ts +104 -0
- package/src/adapters/cursor/cursor-errors.ts +165 -0
- package/src/adapters/cursor/discovery.ts +276 -0
- package/src/adapters/cursor/effort-map.ts +127 -0
- package/src/adapters/cursor/exec-policy.ts +88 -0
- package/src/adapters/cursor/framing.ts +211 -0
- package/src/adapters/cursor/gen/agent_pb.ts +15274 -0
- package/src/adapters/cursor/kv-store.ts +52 -0
- package/src/adapters/cursor/live-models.ts +153 -0
- package/src/adapters/cursor/live-smoke-gate.ts +41 -0
- package/src/adapters/cursor/live-transport.ts +1214 -0
- package/src/adapters/cursor/mcp-config.ts +42 -0
- package/src/adapters/cursor/mcp-manager.ts +333 -0
- package/src/adapters/cursor/message-mapper.ts +49 -0
- package/src/adapters/cursor/native-exec-common.ts +55 -0
- package/src/adapters/cursor/native-exec-desktop.ts +184 -0
- package/src/adapters/cursor/native-exec-fs.ts +329 -0
- package/src/adapters/cursor/native-exec-mcp.ts +153 -0
- package/src/adapters/cursor/native-exec-network.ts +43 -0
- package/src/adapters/cursor/native-exec-shell.ts +548 -0
- package/src/adapters/cursor/native-exec-tools.ts +118 -0
- package/src/adapters/cursor/native-exec.ts +576 -0
- package/src/adapters/cursor/protobuf-events.ts +563 -0
- package/src/adapters/cursor/protobuf-request.ts +714 -0
- package/src/adapters/cursor/request-builder.ts +255 -0
- package/src/adapters/cursor/thread-continuity.ts +67 -0
- package/src/adapters/cursor/tool-definitions.ts +505 -0
- package/src/adapters/cursor/transport-retry.ts +132 -0
- package/src/adapters/cursor/transport.ts +57 -0
- package/src/adapters/cursor/types.ts +52 -0
- package/src/adapters/cursor.ts +196 -0
- package/src/adapters/google-antigravity-replay.ts +303 -0
- package/src/adapters/google-antigravity-wire.ts +108 -0
- package/src/adapters/google-errors.ts +85 -0
- package/src/adapters/google-http.ts +100 -0
- package/src/adapters/google-tool-schema.ts +173 -0
- package/src/adapters/google-truncation.ts +13 -0
- package/src/adapters/google-wire-compiler.ts +232 -0
- package/src/adapters/google.ts +758 -0
- package/src/adapters/identity.ts +44 -0
- package/src/adapters/image.ts +23 -0
- package/src/adapters/kiro-constants.ts +16 -0
- package/src/adapters/kiro-errors.ts +197 -0
- package/src/adapters/kiro-events.ts +179 -0
- package/src/adapters/kiro-images.ts +129 -0
- package/src/adapters/kiro-retry.ts +312 -0
- package/src/adapters/kiro-thinking.ts +96 -0
- package/src/adapters/kiro-tool-fallback.ts +36 -0
- package/src/adapters/kiro-tools.ts +215 -0
- package/src/adapters/kiro-truncation.ts +33 -0
- package/src/adapters/kiro-wire.ts +129 -0
- package/src/adapters/kiro.ts +1898 -0
- package/src/adapters/mimo-free.ts +263 -0
- package/src/adapters/openai-chat.ts +1005 -0
- package/src/adapters/openai-responses.ts +1137 -0
- package/src/adapters/run-turn-queue.ts +114 -0
- package/src/adapters/tool-catalog-nudge.ts +71 -0
- package/src/adapters/upstream-http-error.ts +48 -0
- package/src/bridge.ts +1619 -0
- package/src/chat/inbound.ts +295 -0
- package/src/chat/outbound.ts +765 -0
- package/src/claude/agents-inject.ts +243 -0
- package/src/claude/alias.ts +149 -0
- package/src/claude/auth-detect.ts +229 -0
- package/src/claude/auth-mode-migration.ts +32 -0
- package/src/claude/auth-mode.ts +62 -0
- package/src/claude/context-windows.ts +189 -0
- package/src/claude/desktop-3p-guard.ts +35 -0
- package/src/claude/desktop-3p-paths.ts +84 -0
- package/src/claude/desktop-3p.ts +381 -0
- package/src/claude/desktop-health.ts +26 -0
- package/src/claude/desktop-profile.ts +263 -0
- package/src/claude/gateway-cache.ts +70 -0
- package/src/claude/inbound-debug.ts +163 -0
- package/src/claude/inbound.ts +509 -0
- package/src/claude/model-info.ts +151 -0
- package/src/claude/outbound.ts +872 -0
- package/src/cli/access.ts +108 -0
- package/src/cli/account-api.ts +268 -0
- package/src/cli/account-auth.ts +223 -0
- package/src/cli/account-extended.ts +350 -0
- package/src/cli/account.ts +275 -0
- package/src/cli/agent-driven.ts +70 -0
- package/src/cli/agent.ts +184 -0
- package/src/cli/catalog-prewarm.ts +27 -0
- package/src/cli/claude-desktop.ts +188 -0
- package/src/cli/claude.ts +286 -0
- package/src/cli/codex-shim-autorestore.ts +45 -0
- package/src/cli/combo.ts +119 -0
- package/src/cli/config-command.ts +145 -0
- package/src/cli/debug.ts +228 -0
- package/src/cli/doctor.ts +930 -0
- package/src/cli/export-command.ts +187 -0
- package/src/cli/help.ts +354 -0
- package/src/cli/index.ts +1113 -0
- package/src/cli/init.ts +224 -0
- package/src/cli/integrations.ts +142 -0
- package/src/cli/interactive-confirm.ts +133 -0
- package/src/cli/internal-dispatch.ts +20 -0
- package/src/cli/models-runtime.ts +212 -0
- package/src/cli/models.ts +336 -0
- package/src/cli/observe.ts +117 -0
- package/src/cli/opencode.ts +586 -0
- package/src/cli/pi.ts +188 -0
- package/src/cli/provider-runtime.ts +162 -0
- package/src/cli/provider.ts +463 -0
- package/src/cli/runtime-api.ts +325 -0
- package/src/cli/star-prompt.ts +155 -0
- package/src/cli/status-oauth.ts +78 -0
- package/src/cli/status.ts +321 -0
- package/src/cli/sync-cloud.ts +283 -0
- package/src/cli/system-command.ts +112 -0
- package/src/cli/tray-proxy.ts +52 -0
- package/src/cli/v2.ts +173 -0
- package/src/cli.ts +10 -0
- package/src/clients/config-export.ts +377 -0
- package/src/clients/effective-status.ts +385 -0
- package/src/clients/probes/agy.ts +55 -0
- package/src/clients/probes/cc-switch.ts +110 -0
- package/src/clients/probes/claude.ts +90 -0
- package/src/clients/probes/codex.ts +125 -0
- package/src/clients/probes/grok.ts +29 -0
- package/src/clients/probes/opencode.ts +109 -0
- package/src/clients/probes/paseo.ts +55 -0
- package/src/clients/probes/pi.ts +55 -0
- package/src/cloud/onedrive-auth.ts +666 -0
- package/src/cloud/onedrive-graph.ts +108 -0
- package/src/cloud/settings.ts +75 -0
- package/src/cloud/sync.ts +212 -0
- package/src/cloud/types.ts +56 -0
- package/src/cloud/vault.ts +89 -0
- package/src/codex/account-id.ts +34 -0
- package/src/codex/account-label.ts +34 -0
- package/src/codex/account-lifecycle.ts +55 -0
- package/src/codex/account-namespace-match.ts +63 -0
- package/src/codex/account-namespaces.ts +149 -0
- package/src/codex/account-pause.ts +20 -0
- package/src/codex/account-runtime-state.ts +31 -0
- package/src/codex/account-store.ts +517 -0
- package/src/codex/account-usability.ts +20 -0
- package/src/codex/app-server-processes.ts +756 -0
- package/src/codex/auth-api.ts +1540 -0
- package/src/codex/auth-collision.ts +107 -0
- package/src/codex/auth-context.ts +352 -0
- package/src/codex/autostart-health.ts +149 -0
- package/src/codex/catalog/aggregation.ts +378 -0
- package/src/codex/catalog/bundled.ts +251 -0
- package/src/codex/catalog/effort.ts +355 -0
- package/src/codex/catalog/metadata.ts +180 -0
- package/src/codex/catalog/parsing.ts +456 -0
- package/src/codex/catalog/provider-fetch.ts +902 -0
- package/src/codex/catalog/sync.ts +620 -0
- package/src/codex/catalog.ts +12 -0
- package/src/codex/data/upstream-models.json +830 -0
- package/src/codex/exec-invocation.ts +22 -0
- package/src/codex/features.ts +969 -0
- package/src/codex/history-migration-guardian.ts +102 -0
- package/src/codex/history-provider.ts +776 -0
- package/src/codex/home.ts +206 -0
- package/src/codex/inject.ts +799 -0
- package/src/codex/injected-marker.ts +72 -0
- package/src/codex/journal.ts +163 -0
- package/src/codex/main-account-cache.ts +32 -0
- package/src/codex/main-account.ts +40 -0
- package/src/codex/model-cache.ts +227 -0
- package/src/codex/paths.ts +65 -0
- package/src/codex/plugins-doctor.ts +242 -0
- package/src/codex/pool-rotation.ts +225 -0
- package/src/codex/project-config-warnings.ts +411 -0
- package/src/codex/quota.ts +411 -0
- package/src/codex/refresh.ts +53 -0
- package/src/codex/routing.ts +1477 -0
- package/src/codex/runtime.ts +538 -0
- package/src/codex/shim.ts +1189 -0
- package/src/codex/subagent-defaults.ts +550 -0
- package/src/codex/subagent-model-fallback.ts +469 -0
- package/src/codex/sync.ts +130 -0
- package/src/codex/warmup.ts +192 -0
- package/src/codex/websocket-registry.ts +100 -0
- package/src/combos/failover.ts +140 -0
- package/src/combos/index.ts +41 -0
- package/src/combos/request.ts +62 -0
- package/src/combos/resolve.ts +232 -0
- package/src/combos/types.ts +326 -0
- package/src/config.ts +2356 -0
- package/src/generated/jawcode-model-metadata.ts +104 -0
- package/src/github/star-state.ts +203 -0
- package/src/grok/inject.ts +545 -0
- package/src/grok/status.ts +121 -0
- package/src/grok/sync.ts +103 -0
- package/src/grok/usage-hook/report.mjs +348 -0
- package/src/grok/usage-hook.ts +278 -0
- package/src/images/artifacts.ts +516 -0
- package/src/images/fulfill-video.ts +163 -0
- package/src/images/fulfill.ts +149 -0
- package/src/images/index.ts +4 -0
- package/src/images/loop.ts +829 -0
- package/src/images/plan.ts +133 -0
- package/src/images/synthetic-tool.ts +133 -0
- package/src/images/types.ts +41 -0
- package/src/images/xai-client.ts +141 -0
- package/src/images/xai-video-client.ts +163 -0
- package/src/index.ts +22 -0
- package/src/lib/abort.ts +146 -0
- package/src/lib/admin-secrets.ts +25 -0
- package/src/lib/admission.ts +83 -0
- package/src/lib/app-owned-memory-stores.ts +173 -0
- package/src/lib/app-owned-memory.ts +265 -0
- package/src/lib/bounded-body.ts +202 -0
- package/src/lib/bun-binary-validator.d.mts +3 -0
- package/src/lib/bun-binary-validator.mjs +18 -0
- package/src/lib/bun-runtime.ts +71 -0
- package/src/lib/bun-stream-caps.ts +126 -0
- package/src/lib/config-ownership.ts +360 -0
- package/src/lib/crash-guard.ts +344 -0
- package/src/lib/debug-log-buffer.ts +83 -0
- package/src/lib/debug-settings.ts +108 -0
- package/src/lib/debug.ts +31 -0
- package/src/lib/destination-policy.ts +316 -0
- package/src/lib/errors.ts +364 -0
- package/src/lib/eventstream-decoder.ts +253 -0
- package/src/lib/gcp-adc.ts +341 -0
- package/src/lib/injection-debug-log.ts +58 -0
- package/src/lib/open-url.ts +25 -0
- package/src/lib/pinned-http.ts +151 -0
- package/src/lib/privacy.ts +20 -0
- package/src/lib/process-control.ts +165 -0
- package/src/lib/provider-outbound.ts +170 -0
- package/src/lib/provider-url.ts +14 -0
- package/src/lib/proxy-env.ts +18 -0
- package/src/lib/redact.ts +105 -0
- package/src/lib/retry-after.ts +55 -0
- package/src/lib/service-secrets.ts +25 -0
- package/src/lib/shadow-call.ts +30 -0
- package/src/lib/sidecar-tracker.ts +52 -0
- package/src/lib/sse-decoder.ts +323 -0
- package/src/lib/state-store-registrations.ts +109 -0
- package/src/lib/state-store-sweeper.ts +184 -0
- package/src/lib/test-home-guard.ts +90 -0
- package/src/lib/token-estimate.ts +69 -0
- package/src/lib/translator-budget.ts +356 -0
- package/src/lib/upstream-retry.ts +239 -0
- package/src/lib/win-exec.ts +115 -0
- package/src/lib/win-paths.ts +68 -0
- package/src/lib/windows-elevation.ts +705 -0
- package/src/lib/windows-secret-acl.ts +514 -0
- package/src/lib/winsw.ts +375 -0
- package/src/oauth/anthropic-routing.ts +594 -0
- package/src/oauth/anthropic.ts +177 -0
- package/src/oauth/callback-server.ts +294 -0
- package/src/oauth/chatgpt.ts +150 -0
- package/src/oauth/cursor.ts +211 -0
- package/src/oauth/github-copilot.ts +428 -0
- package/src/oauth/google-antigravity.ts +230 -0
- package/src/oauth/health.ts +399 -0
- package/src/oauth/index.ts +1174 -0
- package/src/oauth/key-providers.ts +108 -0
- package/src/oauth/kimi.ts +213 -0
- package/src/oauth/kiro-credentials.ts +726 -0
- package/src/oauth/kiro.ts +577 -0
- package/src/oauth/local-token-detect.ts +121 -0
- package/src/oauth/log.ts +48 -0
- package/src/oauth/login-cli.ts +163 -0
- package/src/oauth/pkce.ts +15 -0
- package/src/oauth/store.ts +630 -0
- package/src/oauth/token-guardian.ts +303 -0
- package/src/oauth/types.ts +62 -0
- package/src/oauth/xai.ts +241 -0
- package/src/pi/extensions.ts +72 -0
- package/src/pi/home.ts +42 -0
- package/src/pi/index.ts +40 -0
- package/src/pi/models.ts +278 -0
- package/src/pi/packages.ts +219 -0
- package/src/pi/settings.ts +365 -0
- package/src/pi/status.ts +68 -0
- package/src/pi/sync.ts +75 -0
- package/src/providers/alibaba-region-backup.ts +75 -0
- package/src/providers/alibaba-region-migration.ts +156 -0
- package/src/providers/alibaba-region-startup.ts +36 -0
- package/src/providers/antigravity-models.ts +205 -0
- package/src/providers/api-keys.ts +140 -0
- package/src/providers/base-url-choices.ts +64 -0
- package/src/providers/context-cap.ts +65 -0
- package/src/providers/derive.ts +339 -0
- package/src/providers/free-directory.ts +184 -0
- package/src/providers/github-copilot-transport.ts +56 -0
- package/src/providers/key-failover.ts +203 -0
- package/src/providers/kiro-models.ts +67 -0
- package/src/providers/label.ts +19 -0
- package/src/providers/model-discovery.ts +356 -0
- package/src/providers/openai-sidecar.ts +175 -0
- package/src/providers/openai-tier-startup.ts +27 -0
- package/src/providers/openai-tiers.ts +301 -0
- package/src/providers/openai-virtual-models.ts +82 -0
- package/src/providers/openrouter-routing.ts +102 -0
- package/src/providers/provider-id-rewrite.ts +150 -0
- package/src/providers/quota.ts +1260 -0
- package/src/providers/registry.ts +1600 -0
- package/src/providers/slug-codec.ts +67 -0
- package/src/providers/xai-transport.ts +141 -0
- package/src/reasoning-effort.ts +135 -0
- package/src/responses/compaction.ts +117 -0
- package/src/responses/parser.ts +656 -0
- package/src/responses/reasoning-envelope.ts +52 -0
- package/src/responses/schema.ts +159 -0
- package/src/responses/spill-store.ts +394 -0
- package/src/responses/state.ts +895 -0
- package/src/responses/tool-groups.ts +19 -0
- package/src/router.ts +425 -0
- package/src/server/adapter-resolve.ts +80 -0
- package/src/server/auth-cors.ts +530 -0
- package/src/server/chat-completions.ts +368 -0
- package/src/server/claude-messages.ts +914 -0
- package/src/server/effort-policy.ts +172 -0
- package/src/server/gui-static.ts +123 -0
- package/src/server/image-retry.ts +42 -0
- package/src/server/images.ts +476 -0
- package/src/server/index.ts +1126 -0
- package/src/server/lifecycle.ts +227 -0
- package/src/server/live.ts +598 -0
- package/src/server/management/agent-settings-routes.ts +1169 -0
- package/src/server/management/api-access.ts +141 -0
- package/src/server/management/api-key-usage.ts +167 -0
- package/src/server/management/body.ts +35 -0
- package/src/server/management/clients-routes.ts +63 -0
- package/src/server/management/cloud-sync-routes.ts +266 -0
- package/src/server/management/combo-routes.ts +220 -0
- package/src/server/management/config-routes.ts +422 -0
- package/src/server/management/context.ts +31 -0
- package/src/server/management/logs-usage-routes.ts +707 -0
- package/src/server/management/model-routes.ts +525 -0
- package/src/server/management/oauth-account-routes.ts +563 -0
- package/src/server/management/provider-routes.ts +556 -0
- package/src/server/management/shared.ts +277 -0
- package/src/server/management/sidebar-routes.ts +90 -0
- package/src/server/management/system-restart.ts +179 -0
- package/src/server/management/system-routes.ts +117 -0
- package/src/server/management/usage-summary-cache.ts +86 -0
- package/src/server/management-api.ts +215 -0
- package/src/server/management-auth.ts +267 -0
- package/src/server/memory-watchdog.ts +156 -0
- package/src/server/port-reclaim.ts +307 -0
- package/src/server/ports.ts +116 -0
- package/src/server/proxy-liveness.ts +201 -0
- package/src/server/relay-eager.ts +313 -0
- package/src/server/relay.ts +1049 -0
- package/src/server/request-decompress.ts +132 -0
- package/src/server/request-log-conversation.ts +168 -0
- package/src/server/request-log.ts +1046 -0
- package/src/server/responses/collaboration.ts +354 -0
- package/src/server/responses/compact.ts +384 -0
- package/src/server/responses/core.ts +2758 -0
- package/src/server/responses/encrypted-payload.ts +308 -0
- package/src/server/responses/fetch-helpers.ts +157 -0
- package/src/server/responses/passthrough-error.ts +78 -0
- package/src/server/responses/terminal-guard.ts +230 -0
- package/src/server/responses/upstream-error.ts +48 -0
- package/src/server/responses-image-gen-repair.ts +132 -0
- package/src/server/responses-item-id-repair.ts +224 -0
- package/src/server/responses.ts +9 -0
- package/src/server/search.ts +136 -0
- package/src/server/sse-payload-rewrite.ts +175 -0
- package/src/server/startup-action-control.ts +308 -0
- package/src/server/startup-health-cache.ts +113 -0
- package/src/server/system-env.ts +413 -0
- package/src/server/windows-tcp-drop.ts +184 -0
- package/src/server/windows-tray-control.ts +41 -0
- package/src/server/ws-bridge.ts +471 -0
- package/src/service.ts +2554 -0
- package/src/stall-timeout.ts +20 -0
- package/src/storage/cleanup-job.ts +57 -0
- package/src/storage/cleanup.ts +3085 -0
- package/src/storage/policy-job.ts +457 -0
- package/src/storage/policy-scheduler.ts +40 -0
- package/src/storage/policy-worker.ts +59 -0
- package/src/storage/policy.ts +527 -0
- package/src/storage/restore-job.ts +299 -0
- package/src/storage/restore-worker.ts +58 -0
- package/src/storage/scanner.ts +238 -0
- package/src/storage/storage-mutation-coordinator.ts +139 -0
- package/src/storage/worker-lifecycle.ts +215 -0
- package/src/tray/assets/opencodex-tray-offline.ico +0 -0
- package/src/tray/assets/opencodex-tray-online.ico +0 -0
- package/src/tray/assets/opencodex-tray-warning.ico +0 -0
- package/src/tray/assets/opencodex-tray.png +0 -0
- package/src/tray/windows-tray.ps1 +290 -0
- package/src/tray/windows.ts +730 -0
- package/src/types.ts +1237 -0
- package/src/update/badge.ts +72 -0
- package/src/update/index.ts +407 -0
- package/src/update/job.ts +1520 -0
- package/src/update/notify.ts +257 -0
- package/src/update/npm-invocation.d.mts +23 -0
- package/src/update/npm-invocation.mjs +94 -0
- package/src/update/tray-update-plan.d.mts +18 -0
- package/src/update/tray-update-plan.mjs +38 -0
- package/src/usage/cost.ts +0 -0
- package/src/usage/debug.ts +97 -0
- package/src/usage/expected-prices.ts +164 -0
- package/src/usage/log.ts +658 -0
- package/src/usage/summary.ts +585 -0
- package/src/usage/totals.ts +14 -0
- package/src/vision/anthropic-describe.ts +185 -0
- package/src/vision/describe.ts +125 -0
- package/src/vision/index.ts +467 -0
- package/src/web-search/anthropic-executor.ts +189 -0
- package/src/web-search/executor.ts +105 -0
- package/src/web-search/format-result.ts +89 -0
- package/src/web-search/index.ts +196 -0
- package/src/web-search/loop.ts +664 -0
- package/src/web-search/parse.ts +220 -0
- package/src/web-search/progress-stream.ts +342 -0
- package/src/web-search/synthetic-tool.ts +47 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import type { CodexAccountMode, OcxProviderConfig } from "../types";
|
|
2
|
+
import { PROVIDER_REGISTRY, providerMatchesRegistryTransport, type ProviderRegistryEntry } from "./registry";
|
|
3
|
+
|
|
4
|
+
export interface DerivedKeyLoginProvider {
|
|
5
|
+
label: string;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
responsesPath?: string;
|
|
8
|
+
adapter: string;
|
|
9
|
+
apiKeyTransport?: OcxProviderConfig["apiKeyTransport"];
|
|
10
|
+
dashboardUrl: string;
|
|
11
|
+
models?: string[];
|
|
12
|
+
liveModels?: boolean;
|
|
13
|
+
defaultModel?: string;
|
|
14
|
+
contextWindow?: number;
|
|
15
|
+
modelContextWindows?: Record<string, number>;
|
|
16
|
+
modelInputModalities?: Record<string, string[]>;
|
|
17
|
+
modelMaxInputTokens?: Record<string, number>;
|
|
18
|
+
defaultMaxOutputTokens?: number;
|
|
19
|
+
modelMaxOutputTokens?: Record<string, number>;
|
|
20
|
+
reasoningEfforts?: string[];
|
|
21
|
+
modelReasoningEfforts?: Record<string, string[]>;
|
|
22
|
+
modelDefaultReasoningEfforts?: Record<string, string>;
|
|
23
|
+
reasoningEffortMap?: Record<string, string>;
|
|
24
|
+
modelReasoningEffortMap?: Record<string, Record<string, string>>;
|
|
25
|
+
noVisionModels?: string[];
|
|
26
|
+
noReasoningModels?: string[];
|
|
27
|
+
noTemperatureModels?: string[];
|
|
28
|
+
noTopPModels?: string[];
|
|
29
|
+
noPenaltyModels?: string[];
|
|
30
|
+
autoToolChoiceOnlyModels?: string[];
|
|
31
|
+
preserveReasoningContentModels?: string[];
|
|
32
|
+
reasoningSplitModels?: string[];
|
|
33
|
+
thinkingToggleModels?: string[];
|
|
34
|
+
thinkingBudgetModels?: string[];
|
|
35
|
+
escapeBuiltinToolNames?: boolean;
|
|
36
|
+
googleMode?: "ai-studio" | "vertex" | "cloud-code-assist";
|
|
37
|
+
project?: string;
|
|
38
|
+
location?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface DerivedInitProvider {
|
|
42
|
+
id: string;
|
|
43
|
+
label: string;
|
|
44
|
+
adapter: string;
|
|
45
|
+
baseUrl: string;
|
|
46
|
+
kind: "forward" | "oauth" | "key" | "local";
|
|
47
|
+
codexAccountMode?: CodexAccountMode;
|
|
48
|
+
dashboardUrl?: string;
|
|
49
|
+
defaultModel?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface DerivedProviderPreset {
|
|
53
|
+
id: string;
|
|
54
|
+
label: string;
|
|
55
|
+
adapter: string;
|
|
56
|
+
baseUrl: string;
|
|
57
|
+
responsesPath?: string;
|
|
58
|
+
defaultModel?: string;
|
|
59
|
+
auth: "oauth" | "forward" | "key" | "local";
|
|
60
|
+
codexAccountMode?: CodexAccountMode;
|
|
61
|
+
oauthProvider?: string;
|
|
62
|
+
dashboardUrl?: string;
|
|
63
|
+
note?: string;
|
|
64
|
+
keyOptional?: boolean;
|
|
65
|
+
/** Free pricing (may still require a key). */
|
|
66
|
+
freeTier?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Endpoint picker rows (token plan / payg / custom). When present, the add-provider
|
|
69
|
+
* form shows a dropdown; `custom` reveals a free-text base URL field.
|
|
70
|
+
*/
|
|
71
|
+
baseUrlChoices?: Array<{ id: string; label: string; baseUrl?: string }>;
|
|
72
|
+
/** Immutable canonical provider config seed for the reserved canonical `openai` forward preset. */
|
|
73
|
+
provider?: OcxProviderConfig;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function listRegistryEntries(): readonly ProviderRegistryEntry[] {
|
|
77
|
+
return PROVIDER_REGISTRY;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function cloneRecordOfArrays(input: Record<string, string[]>): Record<string, string[]> {
|
|
81
|
+
return Object.fromEntries(Object.entries(input).map(([key, value]) => [key, [...value]]));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Fill registry defaults BENEATH the user's per-model entries.
|
|
86
|
+
*
|
|
87
|
+
* Capability maps are keyed per model, so an all-or-nothing fill lets a single
|
|
88
|
+
* customized model hide the registry's knowledge about every other model. That
|
|
89
|
+
* is how a partially customized `modelInputModalities` could leave a
|
|
90
|
+
* vision-capable model advertising no image support, which in turn collapses any
|
|
91
|
+
* combo containing it to text-only. Routing already merges these maps per key
|
|
92
|
+
* (`mergeRecordFill` in src/router.ts); catalog enrichment now matches.
|
|
93
|
+
*/
|
|
94
|
+
function fillRecordOfArrays(
|
|
95
|
+
seed: Record<string, string[]>,
|
|
96
|
+
user: Record<string, string[]> | undefined,
|
|
97
|
+
): Record<string, string[]> {
|
|
98
|
+
return { ...cloneRecordOfArrays(seed), ...(user ? cloneRecordOfArrays(user) : {}) };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function cloneNestedRecord(input: Record<string, Record<string, string>>): Record<string, Record<string, string>> {
|
|
102
|
+
return Object.fromEntries(Object.entries(input).map(([key, value]) => [key, { ...value }]));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function providerConfigSeed(entry: ProviderRegistryEntry): OcxProviderConfig {
|
|
106
|
+
return {
|
|
107
|
+
adapter: entry.adapter,
|
|
108
|
+
baseUrl: entry.baseUrl,
|
|
109
|
+
...(entry.apiKeyTransport !== undefined ? { apiKeyTransport: entry.apiKeyTransport } : {}),
|
|
110
|
+
...(entry.responsesPath ? { responsesPath: entry.responsesPath } : {}),
|
|
111
|
+
authMode: entry.authKind === "local" ? undefined : entry.authKind,
|
|
112
|
+
...(entry.codexAccountMode ? { codexAccountMode: entry.codexAccountMode } : {}),
|
|
113
|
+
...(entry.keyOptional !== undefined ? { keyOptional: entry.keyOptional } : {}),
|
|
114
|
+
...(entry.freeTier !== undefined ? { freeTier: entry.freeTier } : {}),
|
|
115
|
+
...(entry.modelSuffixBracketStrip !== undefined ? { modelSuffixBracketStrip: entry.modelSuffixBracketStrip } : {}),
|
|
116
|
+
...(entry.staticHeaders ? { headers: { ...entry.staticHeaders } } : {}),
|
|
117
|
+
...(entry.defaultModel ? { defaultModel: entry.defaultModel } : {}),
|
|
118
|
+
...(entry.models ? { models: [...entry.models] } : {}),
|
|
119
|
+
...(entry.liveModels !== undefined ? { liveModels: entry.liveModels } : {}),
|
|
120
|
+
...(entry.contextWindow !== undefined ? { contextWindow: entry.contextWindow } : {}),
|
|
121
|
+
...(entry.modelContextWindows ? { modelContextWindows: { ...entry.modelContextWindows } } : {}),
|
|
122
|
+
...(entry.modelInputModalities ? { modelInputModalities: cloneRecordOfArrays(entry.modelInputModalities) } : {}),
|
|
123
|
+
...(entry.modelMaxInputTokens ? { modelMaxInputTokens: { ...entry.modelMaxInputTokens } } : {}),
|
|
124
|
+
...(entry.defaultMaxOutputTokens !== undefined ? { defaultMaxOutputTokens: entry.defaultMaxOutputTokens } : {}),
|
|
125
|
+
...(entry.modelMaxOutputTokens ? { modelMaxOutputTokens: { ...entry.modelMaxOutputTokens } } : {}),
|
|
126
|
+
...(entry.reasoningEfforts ? { reasoningEfforts: [...entry.reasoningEfforts] } : {}),
|
|
127
|
+
...(entry.modelReasoningEfforts ? { modelReasoningEfforts: cloneRecordOfArrays(entry.modelReasoningEfforts) } : {}),
|
|
128
|
+
...(entry.modelDefaultReasoningEfforts ? { modelDefaultReasoningEfforts: { ...entry.modelDefaultReasoningEfforts } } : {}),
|
|
129
|
+
...(entry.reasoningEffortMap ? { reasoningEffortMap: { ...entry.reasoningEffortMap } } : {}),
|
|
130
|
+
...(entry.modelReasoningEffortMap ? { modelReasoningEffortMap: cloneNestedRecord(entry.modelReasoningEffortMap) } : {}),
|
|
131
|
+
...(entry.noVisionModels ? { noVisionModels: [...entry.noVisionModels] } : {}),
|
|
132
|
+
...(entry.noReasoningModels ? { noReasoningModels: [...entry.noReasoningModels] } : {}),
|
|
133
|
+
...(entry.noTemperatureModels ? { noTemperatureModels: [...entry.noTemperatureModels] } : {}),
|
|
134
|
+
...(entry.noTopPModels ? { noTopPModels: [...entry.noTopPModels] } : {}),
|
|
135
|
+
...(entry.noPenaltyModels ? { noPenaltyModels: [...entry.noPenaltyModels] } : {}),
|
|
136
|
+
...(entry.parallelToolCalls !== undefined ? { parallelToolCalls: entry.parallelToolCalls } : {}),
|
|
137
|
+
...(entry.promptCacheKey !== undefined ? { promptCacheKey: entry.promptCacheKey } : {}),
|
|
138
|
+
...(entry.responsesPath !== undefined ? { responsesPath: entry.responsesPath } : {}),
|
|
139
|
+
...(entry.statelessResponses !== undefined ? { statelessResponses: entry.statelessResponses } : {}),
|
|
140
|
+
...(entry.autoToolChoiceOnlyModels ? { autoToolChoiceOnlyModels: [...entry.autoToolChoiceOnlyModels] } : {}),
|
|
141
|
+
...(entry.preserveReasoningContentModels ? { preserveReasoningContentModels: [...entry.preserveReasoningContentModels] } : {}),
|
|
142
|
+
...(entry.reasoningSplitModels ? { reasoningSplitModels: [...entry.reasoningSplitModels] } : {}),
|
|
143
|
+
...(entry.thinkingToggleModels ? { thinkingToggleModels: [...entry.thinkingToggleModels] } : {}),
|
|
144
|
+
...(entry.thinkingBudgetModels ? { thinkingBudgetModels: [...entry.thinkingBudgetModels] } : {}),
|
|
145
|
+
...(entry.escapeBuiltinToolNames !== undefined ? { escapeBuiltinToolNames: entry.escapeBuiltinToolNames } : {}),
|
|
146
|
+
...(entry.googleMode ? { googleMode: entry.googleMode } : {}),
|
|
147
|
+
...(entry.project ? { project: entry.project } : {}),
|
|
148
|
+
...(entry.location ? { location: entry.location } : {}),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function deriveKeyLoginMap(): Record<string, DerivedKeyLoginProvider> {
|
|
153
|
+
const out: Record<string, DerivedKeyLoginProvider> = {};
|
|
154
|
+
for (const entry of PROVIDER_REGISTRY) {
|
|
155
|
+
if (entry.authKind !== "key") continue;
|
|
156
|
+
if (!entry.dashboardUrl) throw new Error(`Registry key provider missing dashboardUrl: ${entry.id}`);
|
|
157
|
+
out[entry.id] = {
|
|
158
|
+
label: entry.label,
|
|
159
|
+
baseUrl: entry.baseUrl,
|
|
160
|
+
...(entry.responsesPath ? { responsesPath: entry.responsesPath } : {}),
|
|
161
|
+
adapter: entry.adapter,
|
|
162
|
+
...(entry.apiKeyTransport !== undefined ? { apiKeyTransport: entry.apiKeyTransport } : {}),
|
|
163
|
+
dashboardUrl: entry.dashboardUrl,
|
|
164
|
+
...(entry.models ? { models: [...entry.models] } : {}),
|
|
165
|
+
...(entry.liveModels !== undefined ? { liveModels: entry.liveModels } : {}),
|
|
166
|
+
...(entry.defaultModel ? { defaultModel: entry.defaultModel } : {}),
|
|
167
|
+
...(entry.contextWindow !== undefined ? { contextWindow: entry.contextWindow } : {}),
|
|
168
|
+
...(entry.modelContextWindows ? { modelContextWindows: { ...entry.modelContextWindows } } : {}),
|
|
169
|
+
...(entry.modelInputModalities ? { modelInputModalities: cloneRecordOfArrays(entry.modelInputModalities) } : {}),
|
|
170
|
+
...(entry.modelMaxInputTokens ? { modelMaxInputTokens: { ...entry.modelMaxInputTokens } } : {}),
|
|
171
|
+
...(entry.defaultMaxOutputTokens !== undefined ? { defaultMaxOutputTokens: entry.defaultMaxOutputTokens } : {}),
|
|
172
|
+
...(entry.modelMaxOutputTokens ? { modelMaxOutputTokens: { ...entry.modelMaxOutputTokens } } : {}),
|
|
173
|
+
...(entry.reasoningEfforts ? { reasoningEfforts: [...entry.reasoningEfforts] } : {}),
|
|
174
|
+
...(entry.modelReasoningEfforts ? { modelReasoningEfforts: cloneRecordOfArrays(entry.modelReasoningEfforts) } : {}),
|
|
175
|
+
...(entry.modelDefaultReasoningEfforts ? { modelDefaultReasoningEfforts: { ...entry.modelDefaultReasoningEfforts } } : {}),
|
|
176
|
+
...(entry.reasoningEffortMap ? { reasoningEffortMap: { ...entry.reasoningEffortMap } } : {}),
|
|
177
|
+
...(entry.modelReasoningEffortMap ? { modelReasoningEffortMap: cloneNestedRecord(entry.modelReasoningEffortMap) } : {}),
|
|
178
|
+
...(entry.noVisionModels ? { noVisionModels: [...entry.noVisionModels] } : {}),
|
|
179
|
+
...(entry.noReasoningModels ? { noReasoningModels: [...entry.noReasoningModels] } : {}),
|
|
180
|
+
...(entry.noTemperatureModels ? { noTemperatureModels: [...entry.noTemperatureModels] } : {}),
|
|
181
|
+
...(entry.noTopPModels ? { noTopPModels: [...entry.noTopPModels] } : {}),
|
|
182
|
+
...(entry.noPenaltyModels ? { noPenaltyModels: [...entry.noPenaltyModels] } : {}),
|
|
183
|
+
...(entry.autoToolChoiceOnlyModels ? { autoToolChoiceOnlyModels: [...entry.autoToolChoiceOnlyModels] } : {}),
|
|
184
|
+
...(entry.preserveReasoningContentModels ? { preserveReasoningContentModels: [...entry.preserveReasoningContentModels] } : {}),
|
|
185
|
+
...(entry.reasoningSplitModels ? { reasoningSplitModels: [...entry.reasoningSplitModels] } : {}),
|
|
186
|
+
...(entry.thinkingToggleModels ? { thinkingToggleModels: [...entry.thinkingToggleModels] } : {}),
|
|
187
|
+
...(entry.thinkingBudgetModels ? { thinkingBudgetModels: [...entry.thinkingBudgetModels] } : {}),
|
|
188
|
+
...(entry.escapeBuiltinToolNames !== undefined ? { escapeBuiltinToolNames: entry.escapeBuiltinToolNames } : {}),
|
|
189
|
+
...(entry.googleMode ? { googleMode: entry.googleMode } : {}),
|
|
190
|
+
...(entry.project ? { project: entry.project } : {}),
|
|
191
|
+
...(entry.location ? { location: entry.location } : {}),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function deriveInitProviders(): DerivedInitProvider[] {
|
|
198
|
+
return PROVIDER_REGISTRY.map(entry => ({
|
|
199
|
+
id: entry.id,
|
|
200
|
+
label: formatInitLabel(entry),
|
|
201
|
+
adapter: entry.adapter,
|
|
202
|
+
baseUrl: entry.baseUrl,
|
|
203
|
+
kind: entry.authKind,
|
|
204
|
+
...(entry.codexAccountMode ? { codexAccountMode: entry.codexAccountMode } : {}),
|
|
205
|
+
...(entry.dashboardUrl ? { dashboardUrl: entry.dashboardUrl } : {}),
|
|
206
|
+
...(entry.defaultModel ? { defaultModel: entry.defaultModel } : {}),
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function deriveOAuthProviderConfig(id: string): OcxProviderConfig | undefined {
|
|
211
|
+
const entry = PROVIDER_REGISTRY.find(row => row.id === id && row.authKind === "oauth");
|
|
212
|
+
return entry ? providerConfigSeed(entry) : undefined;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function deriveOAuthDefaultModel(id: string): string | undefined {
|
|
216
|
+
return PROVIDER_REGISTRY.find(row => row.id === id && row.authKind === "oauth")?.defaultModel;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function deriveOAuthIds(): string[] {
|
|
220
|
+
return PROVIDER_REGISTRY.filter(entry => entry.authKind === "oauth").map(entry => entry.oauthId ?? entry.id);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function deriveProviderPresets(): DerivedProviderPreset[] {
|
|
224
|
+
const presets = PROVIDER_REGISTRY
|
|
225
|
+
.filter(entry => entry.featured || entry.authKind === "key" || entry.dashboardPreset)
|
|
226
|
+
.map(entryToPreset);
|
|
227
|
+
return [...dedupePresets(presets), customPreset()];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function enrichProviderFromRegistry(name: string, prov: OcxProviderConfig): void {
|
|
231
|
+
const entry = PROVIDER_REGISTRY.find(row => row.id === name);
|
|
232
|
+
if (!entry || !providerMatchesRegistryTransport(name, prov)) return;
|
|
233
|
+
const seed = providerConfigSeed(entry);
|
|
234
|
+
if (prov.apiKeyTransport === undefined && seed.apiKeyTransport !== undefined) prov.apiKeyTransport = seed.apiKeyTransport;
|
|
235
|
+
if (!prov.defaultModel && seed.defaultModel) prov.defaultModel = seed.defaultModel;
|
|
236
|
+
if (prov.responsesPath === undefined && seed.responsesPath !== undefined) prov.responsesPath = seed.responsesPath;
|
|
237
|
+
// Fill mode only when absent: an explicit persisted `direct` must never be overwritten.
|
|
238
|
+
if (prov.codexAccountMode === undefined && seed.codexAccountMode !== undefined) prov.codexAccountMode = seed.codexAccountMode;
|
|
239
|
+
if (!prov.models && seed.models) prov.models = [...seed.models];
|
|
240
|
+
if (prov.liveModels === undefined && seed.liveModels !== undefined) prov.liveModels = seed.liveModels;
|
|
241
|
+
if (prov.contextWindow === undefined && seed.contextWindow !== undefined) prov.contextWindow = seed.contextWindow;
|
|
242
|
+
if (!prov.modelContextWindows && seed.modelContextWindows) prov.modelContextWindows = { ...seed.modelContextWindows };
|
|
243
|
+
if (seed.modelInputModalities) prov.modelInputModalities = fillRecordOfArrays(seed.modelInputModalities, prov.modelInputModalities);
|
|
244
|
+
if (prov.defaultMaxOutputTokens === undefined && seed.defaultMaxOutputTokens !== undefined) prov.defaultMaxOutputTokens = seed.defaultMaxOutputTokens;
|
|
245
|
+
if (!prov.modelMaxOutputTokens && seed.modelMaxOutputTokens) prov.modelMaxOutputTokens = { ...seed.modelMaxOutputTokens };
|
|
246
|
+
if (!prov.reasoningEfforts && seed.reasoningEfforts) prov.reasoningEfforts = [...seed.reasoningEfforts];
|
|
247
|
+
if (!prov.modelReasoningEfforts && seed.modelReasoningEfforts) prov.modelReasoningEfforts = cloneRecordOfArrays(seed.modelReasoningEfforts);
|
|
248
|
+
if (!prov.modelDefaultReasoningEfforts && seed.modelDefaultReasoningEfforts) prov.modelDefaultReasoningEfforts = { ...seed.modelDefaultReasoningEfforts };
|
|
249
|
+
if (!prov.reasoningEffortMap && seed.reasoningEffortMap) prov.reasoningEffortMap = { ...seed.reasoningEffortMap };
|
|
250
|
+
if (!prov.modelReasoningEffortMap && seed.modelReasoningEffortMap) prov.modelReasoningEffortMap = cloneNestedRecord(seed.modelReasoningEffortMap);
|
|
251
|
+
if (!prov.noVisionModels && seed.noVisionModels) prov.noVisionModels = [...seed.noVisionModels];
|
|
252
|
+
if (!prov.noReasoningModels && seed.noReasoningModels) prov.noReasoningModels = [...seed.noReasoningModels];
|
|
253
|
+
if (!prov.noTemperatureModels && seed.noTemperatureModels) prov.noTemperatureModels = [...seed.noTemperatureModels];
|
|
254
|
+
if (!prov.noTopPModels && seed.noTopPModels) prov.noTopPModels = [...seed.noTopPModels];
|
|
255
|
+
if (!prov.noPenaltyModels && seed.noPenaltyModels) prov.noPenaltyModels = [...seed.noPenaltyModels];
|
|
256
|
+
if (prov.parallelToolCalls === undefined && seed.parallelToolCalls !== undefined) prov.parallelToolCalls = seed.parallelToolCalls;
|
|
257
|
+
if (prov.promptCacheKey === undefined && seed.promptCacheKey !== undefined) prov.promptCacheKey = seed.promptCacheKey;
|
|
258
|
+
// Fill-only: a hand-edited path must survive, and a config saved before the registry
|
|
259
|
+
// learned this route still gets backfilled.
|
|
260
|
+
if (prov.responsesPath === undefined && seed.responsesPath !== undefined) prov.responsesPath = seed.responsesPath;
|
|
261
|
+
if (prov.statelessResponses === undefined && seed.statelessResponses !== undefined) prov.statelessResponses = seed.statelessResponses;
|
|
262
|
+
if (!prov.autoToolChoiceOnlyModels && seed.autoToolChoiceOnlyModels) prov.autoToolChoiceOnlyModels = [...seed.autoToolChoiceOnlyModels];
|
|
263
|
+
if (!prov.preserveReasoningContentModels && seed.preserveReasoningContentModels) prov.preserveReasoningContentModels = [...seed.preserveReasoningContentModels];
|
|
264
|
+
if (!prov.reasoningSplitModels && seed.reasoningSplitModels) prov.reasoningSplitModels = [...seed.reasoningSplitModels];
|
|
265
|
+
if (!prov.thinkingToggleModels && seed.thinkingToggleModels) prov.thinkingToggleModels = [...seed.thinkingToggleModels];
|
|
266
|
+
if (!prov.thinkingBudgetModels && seed.thinkingBudgetModels) prov.thinkingBudgetModels = [...seed.thinkingBudgetModels];
|
|
267
|
+
if (prov.escapeBuiltinToolNames === undefined && seed.escapeBuiltinToolNames !== undefined) prov.escapeBuiltinToolNames = seed.escapeBuiltinToolNames;
|
|
268
|
+
if (prov.keyOptional === undefined && seed.keyOptional !== undefined) prov.keyOptional = seed.keyOptional;
|
|
269
|
+
if (prov.freeTier === undefined && seed.freeTier !== undefined) prov.freeTier = seed.freeTier;
|
|
270
|
+
if (prov.modelSuffixBracketStrip === undefined && seed.modelSuffixBracketStrip !== undefined) prov.modelSuffixBracketStrip = seed.modelSuffixBracketStrip;
|
|
271
|
+
if (!prov.headers && seed.headers) prov.headers = { ...seed.headers };
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function deriveFeaturedProviderIds(): string[] {
|
|
275
|
+
return PROVIDER_REGISTRY.filter(entry => entry.featured).map(entry => entry.id);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export function deriveJawcodeAliases(): Record<string, string> {
|
|
279
|
+
const aliases: Record<string, string> = {};
|
|
280
|
+
for (const entry of PROVIDER_REGISTRY) {
|
|
281
|
+
if (!entry.jawcodeBundle) continue;
|
|
282
|
+
aliases[entry.id] = entry.jawcodeBundle;
|
|
283
|
+
for (const alias of entry.extraMetadataAliases ?? []) {
|
|
284
|
+
aliases[alias] = entry.jawcodeBundle;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return aliases;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function shouldCaseFoldMetadataModelId(providerId: string): boolean {
|
|
291
|
+
const entry = PROVIDER_REGISTRY.find(row => row.id === providerId);
|
|
292
|
+
return entry?.metadataModelIdNormalize === "case-insensitive";
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function entryToPreset(entry: ProviderRegistryEntry): DerivedProviderPreset {
|
|
296
|
+
return {
|
|
297
|
+
id: entry.id,
|
|
298
|
+
label: entry.label,
|
|
299
|
+
adapter: entry.adapter,
|
|
300
|
+
baseUrl: entry.baseUrl,
|
|
301
|
+
...(entry.responsesPath ? { responsesPath: entry.responsesPath } : {}),
|
|
302
|
+
auth: entry.authKind === "forward" ? "forward" : entry.authKind === "oauth" ? "oauth" : entry.authKind === "local" ? "local" : "key",
|
|
303
|
+
...(entry.codexAccountMode ? { codexAccountMode: entry.codexAccountMode } : {}),
|
|
304
|
+
...(entry.codexAccountMode ? { provider: providerConfigSeed(entry) } : {}),
|
|
305
|
+
...(entry.defaultModel ? { defaultModel: entry.defaultModel } : {}),
|
|
306
|
+
...(entry.authKind === "oauth" ? { oauthProvider: entry.oauthId ?? entry.id } : {}),
|
|
307
|
+
...(entry.dashboardUrl ? { dashboardUrl: entry.dashboardUrl } : {}),
|
|
308
|
+
...(entry.note ? { note: entry.note } : {}),
|
|
309
|
+
...(entry.keyOptional ? { keyOptional: true } : {}),
|
|
310
|
+
...(entry.freeTier ? { freeTier: true } : {}),
|
|
311
|
+
...(entry.baseUrlChoices ? { baseUrlChoices: entry.baseUrlChoices.map(c => ({ ...c })) } : {}),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function dedupePresets(presets: DerivedProviderPreset[]): DerivedProviderPreset[] {
|
|
316
|
+
const seen = new Set<string>();
|
|
317
|
+
const out: DerivedProviderPreset[] = [];
|
|
318
|
+
for (const preset of presets) {
|
|
319
|
+
if (seen.has(preset.id)) continue;
|
|
320
|
+
seen.add(preset.id);
|
|
321
|
+
out.push(preset);
|
|
322
|
+
}
|
|
323
|
+
return out;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function customPreset(): DerivedProviderPreset {
|
|
327
|
+
return { id: "custom", label: "Custom provider", adapter: "openai-chat", baseUrl: "", auth: "key" };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function formatInitLabel(entry: ProviderRegistryEntry): string {
|
|
331
|
+
if (entry.authKind === "forward") return "OpenAI — ChatGPT login (no key; account pool default, Direct selectable)";
|
|
332
|
+
if (entry.authKind === "oauth") {
|
|
333
|
+
if (entry.id === "xai") return "xAI (Grok) — account login";
|
|
334
|
+
if (entry.id === "anthropic") return "Anthropic (Claude) — account login";
|
|
335
|
+
if (entry.id === "kimi") return "Kimi (Moonshot) — account login";
|
|
336
|
+
return `${entry.label} — account login`;
|
|
337
|
+
}
|
|
338
|
+
return entry.label;
|
|
339
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export type ProviderAccessGroup =
|
|
2
|
+
| "recurring-or-keyless"
|
|
3
|
+
| "recurring-uncapped"
|
|
4
|
+
| "recurring-credit"
|
|
5
|
+
| "signup-credit";
|
|
6
|
+
|
|
7
|
+
export const FREE_PROVIDER_ACCESS_GROUPS = {
|
|
8
|
+
"recurring-or-keyless": [
|
|
9
|
+
"agy", "aihorde", "api-airforce", "arcee-ai", "bazaarlink", "blackbox", "bluesminds", "cerebras",
|
|
10
|
+
"cloudflare-ai", "cohere", "coze", "duckduckgo-web", "felo-web", "friendliai", "gemini", "github-models",
|
|
11
|
+
"groq", "hackclub", "huggingchat", "huggingface", "iflytek", "inference-net", "kiro", "liquid", "llm7",
|
|
12
|
+
"mistral", "morph", "muse-spark-web", "nara", "navy", "nlpcloud", "ollama-cloud", "opencode", "openrouter",
|
|
13
|
+
"ovhcloud", "pollinations", "puter", "qwen-web", "reka", "sambanova", "sparkdesk", "t3-web", "uncloseai",
|
|
14
|
+
],
|
|
15
|
+
"recurring-uncapped": [
|
|
16
|
+
"agnes", "ainative", "aion", "baidu", "glm", "glm-cn", "kilo-gateway", "opencode-zen", "requesty",
|
|
17
|
+
"routeway", "sealion", "siliconflow", "tencent",
|
|
18
|
+
],
|
|
19
|
+
"recurring-credit": ["bytez", "nous-research"],
|
|
20
|
+
"signup-credit": [
|
|
21
|
+
"agentrouter", "ai21", "baichuan", "baseten", "deepinfra", "deepseek", "doubao", "fireworks", "freemodel-dev", "glm-cn",
|
|
22
|
+
"hyperbolic", "longcat", "monsterapi", "nebius", "novita", "nscale", "nvidia", "predibase", "publicai", "qoder",
|
|
23
|
+
"scaleway", "sensenova", "stepfun", "together", "vertex",
|
|
24
|
+
],
|
|
25
|
+
} as const satisfies Record<ProviderAccessGroup, readonly string[]>;
|
|
26
|
+
|
|
27
|
+
export interface FreeDirectoryProvider {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
adapter: string;
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
authKind: "oauth" | "key";
|
|
33
|
+
accessGroups: readonly ProviderAccessGroup[];
|
|
34
|
+
supportLevel: "supported" | "experimental" | "reference";
|
|
35
|
+
verification: "official" | "primary" | "unverified";
|
|
36
|
+
documentationUrl?: string;
|
|
37
|
+
modelsUrl?: string;
|
|
38
|
+
discovery: "live" | "static" | "hybrid" | "unsupported";
|
|
39
|
+
/**
|
|
40
|
+
* Date the endpoint was checked against provider documentation. Only rows that were actually
|
|
41
|
+
* verified carry it — a uniform date on an `unverified` row is a claim nobody made.
|
|
42
|
+
*/
|
|
43
|
+
lastVerified?: string;
|
|
44
|
+
dashboardUrl?: string;
|
|
45
|
+
keyOptional?: boolean;
|
|
46
|
+
models?: string[];
|
|
47
|
+
liveModels: boolean;
|
|
48
|
+
note?: string;
|
|
49
|
+
googleMode?: "ai-studio" | "vertex";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type ConnectableOverride = Partial<Omit<FreeDirectoryProvider, "id" | "accessGroups">>;
|
|
53
|
+
|
|
54
|
+
const LAST_VERIFIED = "2026-07-23";
|
|
55
|
+
/**
|
|
56
|
+
* Connectable rows carry `lastVerified` because their endpoint was checked against provider
|
|
57
|
+
* documentation on that date. Reference rows built by the generator below deliberately omit it:
|
|
58
|
+
* stamping a verification date on a row marked `unverified` asserts provenance nobody produced.
|
|
59
|
+
*/
|
|
60
|
+
const openAi = (baseUrl: string, dashboardUrl: string, extra: Partial<ConnectableOverride> = {}): ConnectableOverride => ({
|
|
61
|
+
baseUrl,
|
|
62
|
+
dashboardUrl,
|
|
63
|
+
adapter: "openai-chat",
|
|
64
|
+
authKind: "key",
|
|
65
|
+
supportLevel: "experimental",
|
|
66
|
+
verification: "primary",
|
|
67
|
+
discovery: "live",
|
|
68
|
+
liveModels: true,
|
|
69
|
+
lastVerified: LAST_VERIFIED,
|
|
70
|
+
...extra,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// API roots are limited to documented or primary-source integrations. Consumer-web/session
|
|
74
|
+
// providers remain reference-only: this directory never asks users to paste cookies or bypass WAFs.
|
|
75
|
+
const CONNECTABLE: Record<string, ConnectableOverride> = {
|
|
76
|
+
kiro: { baseUrl: "https://runtime.us-east-1.kiro.dev", dashboardUrl: "https://kiro.dev", adapter: "kiro", authKind: "oauth", supportLevel: "supported", verification: "official", documentationUrl: "https://kiro.dev/docs/cli/authentication/", lastVerified: LAST_VERIFIED, discovery: "static", liveModels: false },
|
|
77
|
+
aihorde: openAi("https://oai.aihorde.net/v1", "https://aihorde.net", { modelsUrl: "https://oai.aihorde.net/v1/models" }),
|
|
78
|
+
"arcee-ai": openAi("https://conductor.arcee.ai/v1", "https://conductor.arcee.ai", { verification: "official", documentationUrl: "https://docs.arcee.ai/" }),
|
|
79
|
+
cerebras: openAi("https://api.cerebras.ai/v1", "https://cloud.cerebras.ai/platform/apikeys", { supportLevel: "supported", verification: "official", documentationUrl: "https://inference-docs.cerebras.ai/api-reference/models/list" }),
|
|
80
|
+
"cloudflare-ai": openAi("https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1", "https://dash.cloudflare.com/?to=/:account/ai/workers-ai", { supportLevel: "supported", verification: "official", documentationUrl: "https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/", discovery: "static", liveModels: false, models: ["@cf/meta/llama-3.3-70b-instruct-fp8-fast", "@cf/qwen/qwq-32b"] }),
|
|
81
|
+
cohere: openAi("https://api.cohere.com/compatibility/v1", "https://dashboard.cohere.com/api-keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.cohere.com/reference/list-models", modelsUrl: "https://api.cohere.com/compatibility/v1/models" }),
|
|
82
|
+
friendliai: openAi("https://api.friendli.ai/serverless/v1", "https://suite.friendli.ai", { modelsUrl: "https://api.friendli.ai/serverless/v1/models" }),
|
|
83
|
+
gemini: { baseUrl: "https://generativelanguage.googleapis.com", dashboardUrl: "https://aistudio.google.com/apikey", adapter: "google", authKind: "key", supportLevel: "supported", verification: "official", documentationUrl: "https://ai.google.dev/api/models", lastVerified: LAST_VERIFIED, discovery: "live", liveModels: true, googleMode: "ai-studio", models: ["gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.1-pro-preview"] },
|
|
84
|
+
"github-models": openAi("https://models.github.ai/inference", "https://github.com/settings/tokens", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.github.com/en/github-models/prototyping-with-ai-models", discovery: "static", liveModels: false, models: ["openai/gpt-4.1", "meta/llama-4-scout-17b-16e-instruct"] }),
|
|
85
|
+
groq: openAi("https://api.groq.com/openai/v1", "https://console.groq.com/keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://console.groq.com/docs/api-reference#models" }),
|
|
86
|
+
hackclub: openAi("https://ai.hackclub.com/proxy/v1", "https://ai.hackclub.com", { modelsUrl: "https://ai.hackclub.com/proxy/v1/models" }),
|
|
87
|
+
huggingface: openAi("https://router.huggingface.co/v1", "https://huggingface.co/settings/tokens", { supportLevel: "supported", verification: "official", documentationUrl: "https://huggingface.co/docs/inference-providers/index", modelsUrl: "https://router.huggingface.co/v1/models" }),
|
|
88
|
+
// The OpenAI-compatible base URL is documented in the HTTP guide; Web.html covers the
|
|
89
|
+
// WebSocket protocol and does not describe this endpoint.
|
|
90
|
+
iflytek: openAi("https://spark-api-open.xf-yun.com/v1", "https://console.xfyun.cn", { verification: "official", documentationUrl: "https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html" }),
|
|
91
|
+
liquid: openAi("https://inference.liquid.ai/v1", "https://playground.liquid.ai", { modelsUrl: "https://inference.liquid.ai/v1/models" }),
|
|
92
|
+
mistral: openAi("https://api.mistral.ai/v1", "https://console.mistral.ai/api-keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.mistral.ai/api/endpoint/models" }),
|
|
93
|
+
morph: openAi("https://api.morphllm.com/v1", "https://morphllm.com", { verification: "official", documentationUrl: "https://docs.morphllm.com/api-reference/introduction" }),
|
|
94
|
+
"ollama-cloud": openAi("https://ollama.com/v1", "https://ollama.com/settings/keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.ollama.com/cloud", modelsUrl: "https://ollama.com/api/tags" }),
|
|
95
|
+
opencode: openAi("https://opencode.ai/zen/v1", "https://opencode.ai/auth", { supportLevel: "supported", verification: "official", documentationUrl: "https://opencode.ai/docs/zen/", modelsUrl: "https://opencode.ai/zen/v1/models" }),
|
|
96
|
+
openrouter: openAi("https://openrouter.ai/api/v1", "https://openrouter.ai/keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://openrouter.ai/docs/api/api-reference/models/get-models" }),
|
|
97
|
+
ovhcloud: openAi("https://oai.endpoints.kepler.ai.cloud.ovh.net/v1", "https://console.ovhcloud.com", { keyOptional: true, modelsUrl: "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/models" }),
|
|
98
|
+
pollinations: openAi("https://gen.pollinations.ai/v1", "https://pollinations.ai", { keyOptional: true }),
|
|
99
|
+
reka: openAi("https://api.reka.ai/v1", "https://platform.reka.ai"),
|
|
100
|
+
sambanova: openAi("https://api.sambanova.ai/v1", "https://cloud.sambanova.ai/apis", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.sambanova.ai/cloud/docs/api-reference/models" }),
|
|
101
|
+
sparkdesk: openAi("https://spark-api-open.xf-yun.com/v1", "https://console.xfyun.cn", { verification: "official", documentationUrl: "https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html" }),
|
|
102
|
+
agnes: openAi("https://apihub.agnes-ai.com/v1", "https://agnes-ai.com"),
|
|
103
|
+
ainative: openAi("https://api.ainative.studio/api/v1", "https://ainative.studio", { modelsUrl: "https://api.ainative.studio/api/v1/models" }),
|
|
104
|
+
aion: openAi("https://api.aionlabs.ai/v1", "https://aionlabs.ai", { modelsUrl: "https://api.aionlabs.ai/v1/models" }),
|
|
105
|
+
baidu: openAi("https://qianfan.baidubce.com/v2", "https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application", { verification: "official", documentationUrl: "https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Fm2vrveyu", discovery: "static", liveModels: false, models: ["ernie-5.1", "ernie-5.0", "ernie-4.5-turbo-128k"] }),
|
|
106
|
+
glm: openAi("https://api.z.ai/api/coding/paas/v4", "https://z.ai/manage-apikey/apikey-list", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.z.ai/guides/overview/quick-start", discovery: "static", liveModels: false, models: ["glm-5"] }),
|
|
107
|
+
"glm-cn": openAi("https://open.bigmodel.cn/api/coding/paas/v4", "https://open.bigmodel.cn/usercenter/apikeys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.bigmodel.cn/cn/api/introduction", discovery: "static", liveModels: false, models: ["glm-4.5-flash"] }),
|
|
108
|
+
"kilo-gateway": openAi("https://api.kilo.ai/api/gateway", "https://kilo.ai", { modelsUrl: "https://api.kilo.ai/api/gateway/models" }),
|
|
109
|
+
"opencode-zen": openAi("https://opencode.ai/zen/v1", "https://opencode.ai/auth", { supportLevel: "supported", verification: "official", documentationUrl: "https://opencode.ai/docs/zen/" }),
|
|
110
|
+
requesty: openAi("https://router.requesty.ai/v1", "https://app.requesty.ai", { modelsUrl: "https://router.requesty.ai/v1/models" }),
|
|
111
|
+
routeway: openAi("https://api.routeway.ai/v1", "https://routeway.ai", { modelsUrl: "https://api.routeway.ai/v1/models" }),
|
|
112
|
+
sealion: openAi("https://api.sea-lion.ai/v1", "https://sea-lion.ai", { discovery: "static", liveModels: false, models: ["aisingapore/Llama-SEA-LION-v3.5-70B-R", "aisingapore/Llama-SEA-LION-v3-70B-IT", "aisingapore/Gemma-SEA-LION-v4-27B-IT", "aisingapore/Qwen-SEA-LION-v4.5-27B-IT", "aisingapore/Qwen-SEA-LION-v4-32B-IT"] }),
|
|
113
|
+
siliconflow: openAi("https://api.siliconflow.cn/v1", "https://cloud.siliconflow.cn/account/ak", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.siliconflow.cn/en/api-reference/models/get-model-list" }),
|
|
114
|
+
tencent: openAi("https://api.hunyuan.cloud.tencent.com/v1", "https://console.cloud.tencent.com/hunyuan/api-key", { verification: "official", documentationUrl: "https://cloud.tencent.com/document/product/1729/111007", discovery: "static", liveModels: false, models: ["hunyuan-turbos-latest", "hunyuan-t1-latest", "hunyuan-pro", "hunyuan-lite"] }),
|
|
115
|
+
// Endpoint is live, but the recurring-credit terms could not be confirmed, so this row stays
|
|
116
|
+
// `unverified` and drops the shared verification date rather than borrowing it.
|
|
117
|
+
bytez: openAi("https://api.bytez.com/models/v2/openai/v1", "https://bytez.com", { verification: "unverified", lastVerified: undefined, documentationUrl: "https://docs.bytez.com/", discovery: "static", liveModels: false, models: ["meta-llama/Llama-3.3-70B-Instruct", "mistralai/Mistral-7B-Instruct-v0.3", "Qwen/Qwen2.5-72B-Instruct"], note: "The recurring-credit classification is retained from the requested catalog, but the current reset terms could not be independently verified." }),
|
|
118
|
+
"nous-research": openAi("https://inference-api.nousresearch.com/v1", "https://portal.nousresearch.com", { discovery: "static", liveModels: false, models: ["Hermes-4-405B", "Hermes-4-70B"] }),
|
|
119
|
+
agentrouter: { baseUrl: "https://agentrouter.org", dashboardUrl: "https://agentrouter.org", adapter: "anthropic", authKind: "key", supportLevel: "experimental", verification: "primary", modelsUrl: "https://agentrouter.org/v1/models", lastVerified: LAST_VERIFIED, discovery: "live", liveModels: true },
|
|
120
|
+
ai21: openAi("https://api.ai21.com/studio/v1", "https://studio.ai21.com/account/api-key", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.ai21.com/reference/models" }),
|
|
121
|
+
baichuan: openAi("https://api.baichuan-ai.com/v1", "https://platform.baichuan-ai.com/console/apikey", { verification: "official" }),
|
|
122
|
+
// Verified end-to-end 2026-07-30: /v1/models returns the OpenAI-shaped live catalog (13 models),
|
|
123
|
+
// and a chat completion against moonshotai/Kimi-K3 returned a standard chat.completion payload.
|
|
124
|
+
baseten: openAi("https://inference.baseten.co/v1", "https://app.baseten.co/settings/api_keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.baseten.co/inference/model-apis/overview", modelsUrl: "https://inference.baseten.co/v1/models", lastVerified: "2026-07-30" }),
|
|
125
|
+
deepinfra: openAi("https://api.deepinfra.com/v1/openai", "https://deepinfra.com/dash/api_keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://deepinfra.com/docs/openai_api" }),
|
|
126
|
+
deepseek: openAi("https://api.deepseek.com", "https://platform.deepseek.com/api_keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://api-docs.deepseek.com/api/list-models" }),
|
|
127
|
+
doubao: openAi("https://ark.cn-beijing.volces.com/api/v3", "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey", { verification: "official" }),
|
|
128
|
+
fireworks: openAi("https://api.fireworks.ai/inference/v1", "https://fireworks.ai/account/api-keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.fireworks.ai/api-reference/list-models", modelsUrl: "https://api.fireworks.ai/v1/accounts/fireworks/models?filter=supports_serverless=true" }),
|
|
129
|
+
"freemodel-dev": openAi("https://api.freemodel.dev/v1", "https://freemodel.dev", { modelsUrl: "https://api.freemodel.dev/v1/models" }),
|
|
130
|
+
hyperbolic: openAi("https://api.hyperbolic.xyz/v1", "https://app.hyperbolic.xyz/settings", { verification: "official" }),
|
|
131
|
+
longcat: openAi("https://api.longcat.chat/openai/v1", "https://longcat.chat", { verification: "official", discovery: "static", liveModels: false, models: ["LongCat-2.0"] }),
|
|
132
|
+
monsterapi: openAi("https://api.monsterapi.ai/v1", "https://monsterapi.ai", { verification: "official" }),
|
|
133
|
+
nebius: openAi("https://api.tokenfactory.nebius.com/v1", "https://studio.nebius.com", { verification: "official" }),
|
|
134
|
+
novita: openAi("https://api.novita.ai/openai/v1", "https://novita.ai/settings/key-management", { supportLevel: "supported", verification: "official", modelsUrl: "https://api.novita.ai/openai/v1/models" }),
|
|
135
|
+
nscale: openAi("https://inference.api.nscale.com/v1", "https://console.nscale.com", { verification: "official" }),
|
|
136
|
+
nvidia: openAi("https://integrate.api.nvidia.com/v1", "https://build.nvidia.com", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.api.nvidia.com/nim/reference/llm-apis" }),
|
|
137
|
+
publicai: openAi("https://api.publicai.co/v1", "https://publicai.co"),
|
|
138
|
+
scaleway: openAi("https://api.scaleway.ai/v1", "https://console.scaleway.com/generative-api", { verification: "official" }),
|
|
139
|
+
sensenova: openAi("https://token.sensenova.cn/v1", "https://console.sensenova.cn", { verification: "official" }),
|
|
140
|
+
stepfun: openAi("https://api.stepfun.com/v1", "https://platform.stepfun.com", { verification: "official" }),
|
|
141
|
+
together: openAi("https://api.together.xyz/v1", "https://api.together.xyz/settings/api-keys", { supportLevel: "supported", verification: "official", documentationUrl: "https://docs.together.ai/reference/models-1" }),
|
|
142
|
+
vertex: { baseUrl: "https://aiplatform.googleapis.com", dashboardUrl: "https://console.cloud.google.com/vertex-ai", adapter: "google", authKind: "key", supportLevel: "experimental", verification: "official", documentationUrl: "https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference", lastVerified: LAST_VERIFIED, discovery: "static", liveModels: false, googleMode: "vertex", models: ["gemini-3.1-pro-preview", "gemini-3.1-flash-lite", "gemini-3-flash-preview"], note: "Vertex accepts an express-mode API key here. ADC users can instead configure project and location through the existing Google Vertex provider." },
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const LABELS: Record<string, string> = {
|
|
146
|
+
agy: "AGY", aihorde: "AI Horde", "api-airforce": "API Airforce", "arcee-ai": "Arcee AI",
|
|
147
|
+
bazaarlink: "BazaarLink", blackbox: "Blackbox", bluesminds: "Bluesminds", "cloudflare-ai": "Cloudflare AI",
|
|
148
|
+
coze: "Coze", "duckduckgo-web": "DuckDuckGo Web", "felo-web": "Felo Web", friendliai: "FriendliAI",
|
|
149
|
+
gemini: "Google Gemini", "github-models": "GitHub Models", huggingchat: "HuggingChat", huggingface: "Hugging Face",
|
|
150
|
+
iflytek: "iFlytek", "inference-net": "Inference.net", llm7: "LLM7", "muse-spark-web": "Muse Spark Web",
|
|
151
|
+
nlpcloud: "NLP Cloud", "ollama-cloud": "Ollama Cloud", ovhcloud: "OVHcloud", "qwen-web": "Qwen Web",
|
|
152
|
+
"t3-web": "T3 Web", uncloseai: "UncloseAI", ainative: "AI Native", baidu: "Baidu Qianfan",
|
|
153
|
+
glm: "Z.AI GLM", "glm-cn": "BigModel GLM (CN)", "kilo-gateway": "Kilo Gateway", "opencode-zen": "OpenCode Zen",
|
|
154
|
+
sealion: "SEA-LION", bytez: "Bytez", "nous-research": "Nous Research", agentrouter: "AgentRouter",
|
|
155
|
+
ai21: "AI21", baichuan: "Baichuan", deepinfra: "DeepInfra", deepseek: "DeepSeek", doubao: "Doubao",
|
|
156
|
+
"freemodel-dev": "FreeModel.dev", nebius: "Nebius", novita: "Novita", nscale: "Nscale", nvidia: "NVIDIA NIM",
|
|
157
|
+
publicai: "PublicAI", qoder: "Qoder", sensenova: "SenseNova", stepfun: "StepFun", vertex: "Google Vertex AI",
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const referenceNote = "Reference entry only: no safe documented API integration is enabled. Configure it manually only with provider documentation; consumer-web cookies and anti-bot bypasses are intentionally unsupported.";
|
|
161
|
+
|
|
162
|
+
export const FREE_PROVIDER_DIRECTORY: readonly FreeDirectoryProvider[] = Object.values(FREE_PROVIDER_ACCESS_GROUPS)
|
|
163
|
+
.flat()
|
|
164
|
+
.filter((id, index, ids) => ids.indexOf(id) === index)
|
|
165
|
+
.map(id => {
|
|
166
|
+
const accessGroups = (Object.entries(FREE_PROVIDER_ACCESS_GROUPS) as [ProviderAccessGroup, readonly string[]][])
|
|
167
|
+
.filter(([, ids]) => ids.includes(id))
|
|
168
|
+
.map(([group]) => group);
|
|
169
|
+
const override = CONNECTABLE[id];
|
|
170
|
+
return {
|
|
171
|
+
id,
|
|
172
|
+
label: LABELS[id] ?? id.split("-").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" "),
|
|
173
|
+
adapter: "openai-chat",
|
|
174
|
+
baseUrl: "",
|
|
175
|
+
authKind: "key",
|
|
176
|
+
accessGroups,
|
|
177
|
+
supportLevel: "reference",
|
|
178
|
+
verification: "unverified",
|
|
179
|
+
discovery: "unsupported",
|
|
180
|
+
liveModels: false,
|
|
181
|
+
...(!override ? { note: referenceNote } : {}),
|
|
182
|
+
...override,
|
|
183
|
+
} satisfies FreeDirectoryProvider;
|
|
184
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { OcxProviderConfig } from "../types";
|
|
2
|
+
import {
|
|
3
|
+
GITHUB_COPILOT_DEFAULT_API_BASE,
|
|
4
|
+
GITHUB_COPILOT_EDITOR_HEADERS,
|
|
5
|
+
validateCopilotApiBaseUrl,
|
|
6
|
+
} from "../oauth/github-copilot";
|
|
7
|
+
|
|
8
|
+
export type OcxProviderTransport = OcxProviderConfig & {
|
|
9
|
+
fetch?: typeof globalThis.fetch;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function hasHeaderCaseInsensitive(
|
|
13
|
+
headers: Record<string, string> | undefined,
|
|
14
|
+
name: string,
|
|
15
|
+
): boolean {
|
|
16
|
+
const target = name.toLowerCase();
|
|
17
|
+
return Object.keys(headers ?? {}).some(key => key.toLowerCase() === target);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function withoutUserOverridden(
|
|
21
|
+
defaults: Readonly<Record<string, string>>,
|
|
22
|
+
userHeaders: Record<string, string> | undefined,
|
|
23
|
+
): Record<string, string> {
|
|
24
|
+
return Object.fromEntries(
|
|
25
|
+
Object.entries(defaults).filter(([name]) => !hasHeaderCaseInsensitive(userHeaders, name)),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Copilot chat requires editor fingerprint headers. Defaults are honest OpenCodex values
|
|
31
|
+
* with Copilot-Integration-Id set to the vscode-chat integration id the public client uses.
|
|
32
|
+
* User-configured headers always win.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveGithubCopilotTransport(
|
|
35
|
+
provider: OcxProviderTransport,
|
|
36
|
+
apiBaseUrl?: string,
|
|
37
|
+
): OcxProviderTransport {
|
|
38
|
+
const stableDefaults = withoutUserOverridden(GITHUB_COPILOT_EDITOR_HEADERS, provider.headers);
|
|
39
|
+
const headers = {
|
|
40
|
+
...stableDefaults,
|
|
41
|
+
...(provider.headers ?? {}),
|
|
42
|
+
};
|
|
43
|
+
// Fail closed: the OAuth bearer only ever goes to an allowlisted *.githubcopilot.com
|
|
44
|
+
// host. A legacy/crafted credential without endpoints.api, or a user-edited baseUrl,
|
|
45
|
+
// must not redirect the token — fall back to the canonical default instead.
|
|
46
|
+
const baseUrl = provider.authMode === "oauth"
|
|
47
|
+
? validateCopilotApiBaseUrl(apiBaseUrl)
|
|
48
|
+
?? validateCopilotApiBaseUrl(provider.baseUrl)
|
|
49
|
+
?? GITHUB_COPILOT_DEFAULT_API_BASE
|
|
50
|
+
: apiBaseUrl?.trim() || provider.baseUrl || GITHUB_COPILOT_DEFAULT_API_BASE;
|
|
51
|
+
return {
|
|
52
|
+
...provider,
|
|
53
|
+
baseUrl,
|
|
54
|
+
headers,
|
|
55
|
+
};
|
|
56
|
+
}
|