-
Notifications
You must be signed in to change notification settings - Fork 459
feat(providers): add bounded model discovery contract #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b373ddd
4e8e7d5
92ab57d
169e637
a7ae397
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,15 +299,15 @@ or bind the forward explicitly to loopback (`ssh -L 127.0.0.1:20100:localhost:10 | |
| | Field | Type | Meaning | | ||
| | --- | --- | --- | | ||
| | `adapter` | `string` | One of `openai-chat`, `openai-responses`, `anthropic`, `google`, `kiro`, `cursor`, `azure-openai` (or alias `azure`). | | ||
| | `baseUrl` | `string` | Upstream API base URL. Built-in providers with a fixed endpoint ignore it — see [Fixed provider endpoints](#fixed-provider-endpoints). | | ||
| | `baseUrl` | `string` | Upstream API base URL. Most built-in fixed endpoints ignore a mismatch; newly promoted collision-safe key presets preserve an older same-named custom destination. See [Fixed provider endpoints](#fixed-provider-endpoints). | | ||
| | `responsesPath?` | `string` | Optional relative resource path for key-auth `openai-responses` requests. It must start with `/` and contain no URL scheme, query, or fragment. When omitted, the adapter keeps its legacy `/v1/responses` URL construction. | | ||
| | `disabled?` | `boolean` | Keep the provider on disk but exclude it from routing and model/catalog listings. | | ||
| | `apiKey?` | `string` | API key, or an `${ENV_VAR}` / `$ENV_VAR` reference resolved at request time. | | ||
| | `apiKeyTransport?` | `"x-api-key" \| "bearer"` | Anthropic API-key header style. Defaults to native `x-api-key`; set `"bearer"` for compatible gateways that require `Authorization: Bearer <key>`. Valid only for key-auth `anthropic` providers. | | ||
| | `apiKeyPool?` | `ApiKeyPoolEntry[]` | Multi-key pool. `apiKey` mirrors the active entry; each item has `id`, `key`, optional `label`, and optional numeric `addedAt`. | | ||
| | `defaultModel?` | `string` | Model used when this provider is selected without an explicit model. | | ||
| | `models?` | `string[]` | Seed/fallback model list. When `liveModels` is `false`, these are the only discovered models. | | ||
| | `liveModels?` | `boolean` | Fetch the provider's live `/models` catalog on start/sync (default `true`). Set `false` to use only configured `models`. | | ||
| | `liveModels?` | `boolean` | Fetch the provider's live model catalog on start/sync (default `true`). Built-in presets may use a trusted registry URL/query/filter; custom providers default to `${baseUrl}/models`. Set `false` to use only configured `models`. | | ||
| | `selectedModels?` | `string[]` | Catalog allowlist applied after discovery. A non-empty list exposes only those ids to Codex; empty/omitted exposes all discovered models. | | ||
| | `contextWindow?` | `number` | Provider-wide Codex-visible context-window cap for routed catalog entries. Live metadata below this value is kept. | | ||
| | `modelContextWindows?` | `Record<string,number>` | Model-specific context-window caps. These override `contextWindow` for matching model ids and never raise smaller live metadata. | | ||
|
|
@@ -351,13 +351,16 @@ or bind the forward explicitly to loopback (`ssh -L 127.0.0.1:20100:localhost:10 | |
| ### Fixed provider endpoints | ||
|
|
||
| Routing resolves a provider's endpoint before any adapter sees it, and for most built-in | ||
| providers the registry's own endpoint wins over a `baseUrl` in your config. Three kinds of entry | ||
| providers the registry's own endpoint wins over a `baseUrl` in your config. Four kinds of entry | ||
| keep the configured URL at this stage: | ||
|
|
||
| - providers that opt into an override — `ollama`, `vllm`, `lm-studio`, `litellm`, `qwen-cloud` | ||
| and `alibaba-token-plan-intl`; | ||
| - providers whose registry endpoint is a template you fill in, such as `azure-openai` and | ||
| `cloudflare-ai-gateway`; | ||
| - newly promoted fixed API-key presets that protect name collisions: if an older same-named | ||
| custom provider points somewhere else, it remains custom instead of sending that key to the new | ||
| registry host; | ||
| - providers you define yourself, which are not in the registry at all. | ||
|
|
||
| Adapters may adjust the resolved URL afterward. The `kiro` adapter, for example, follows the API | ||
|
|
@@ -521,6 +524,12 @@ want Codex to see only the models pinned in `models`: | |
| When `liveModels` is `false` and `models` is empty or omitted, opencodex exposes no routed models | ||
| for that provider. | ||
|
|
||
| Live discovery rejects a response before caching when it exceeds 4 MiB or 2,000 raw model rows. | ||
| Built-in presets may lower either limit and filter mixed catalogs to chat-eligible rows. An | ||
| oversized or malformed response follows the normal stale/configured fallback path, while | ||
| ineligible rows are excluded. A valid result with zero eligible rows remains an authoritative | ||
| empty catalog; OpenCodex never silently truncates an over-limit response. | ||
|
Comment on lines
+527
to
+531
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Document whole-catalog rejection for malformed rows and invalid model IDs across all configuration locales. The runtime SOT already states that malformed OpenAI envelopes and invalid model IDs are rejected before caching. The configuration pages currently say only that malformed responses use fallback, which can imply that malformed individual rows are silently filtered. Add one synchronized sentence explaining that any malformed row or invalid model ID rejects the complete discovery result and triggers stale/static fallback without partial caching.
As per path instructions: “Check that user-facing docs stay in sync with actual CLI/API behavior and that translated locale pages (ja, ko, ru, zh-cn) are not left contradicting the English source.” 📍 Affects 5 files
🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| Use `selectedModels` for a different purpose: discovery still runs, but only the selected ids are | ||
| published to Codex's catalog and `/v1/models`. The dashboard's full model list remains available so | ||
| the allowlist can be changed later. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.