-
Notifications
You must be signed in to change notification settings - Fork 312
fix(models): hide unsupported API models #887
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
Open
Komzpa
wants to merge
9
commits into
main
Choose a base branch
from
fix/model-visibility-supported-in-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+348
−48
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
de7fdd5
fix(models): hide unsupported API models
Komzpa c96d1d3
fix(proxy): filter hidden codex allowlist models
Komzpa 2599740
fix(models): add Codex models data alias
Komzpa a965659
feat(models): expose speed tiers in v1 metadata
KakatkarAkshay d8b249e
fix(models): type service tier metadata
Komzpa 333796d
docs: add @KakatkarAkshay as contributor
Komzpa ec57113
fix(models): omit absent speed tier metadata
Komzpa 51bc7da
fix(models): stabilize codex model alias timestamps
Komzpa 52eb83c
fix(models): keep spark in bootstrap catalog
Komzpa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ## Why | ||
|
|
||
| Some OpenAI-compatible clients, including JetBrains IDE provider setup, probe the configured base URL by requesting `GET /backend-api/codex/models` and deserializing an OpenAI-style model list with a top-level `data` field. codex-lb's Codex-native endpoint only returned `models`, so those clients rejected the otherwise valid response before they could use the provider. | ||
|
|
||
| ## What Changes | ||
|
|
||
| - Preserve the Codex-native `models` payload for `/backend-api/codex/models`. | ||
| - Add an OpenAI-compatible top-level `object: "list"` and `data` model list alias to the same response. | ||
| - Keep `data` limited to entries whose Codex visibility is `list`, so hidden Codex catalog entries remain hidden from generic OpenAI-style clients. | ||
|
|
||
| ## Capabilities | ||
|
|
||
| ### Modified Capabilities | ||
|
|
||
| - `model-catalog-compat`: `/backend-api/codex/models` remains Codex-native while also exposing an OpenAI-style `data` alias for generic client probes. | ||
|
|
||
| ## Impact | ||
|
|
||
| - Code: `app/modules/proxy/api.py`, `app/modules/proxy/schemas.py` | ||
| - Tests: `tests/integration/test_v1_models.py` | ||
| - Compatibility: JetBrains/OpenAI-style model-list deserializers can read `/backend-api/codex/models` without losing Codex-native clients. |
13 changes: 13 additions & 0 deletions
13
openspec/changes/add-codex-models-data-alias/specs/model-catalog-compat/spec.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ## MODIFIED Requirements | ||
|
|
||
| ### Requirement: Native Codex model catalog stays backend-faithful | ||
|
|
||
| When serving `GET /backend-api/codex/models`, the system MUST keep Codex-native model catalog semantics unchanged: the top-level `context_window` field remains the backend compact/input budget unless an explicit operator override applies, and upstream raw fields such as `max_context_window` remain available when upstream provides them. The `/v1/models` compatibility metadata MUST NOT mutate the native Codex endpoint. | ||
|
|
||
| #### Scenario: Codex model catalog also exposes OpenAI data alias | ||
|
|
||
| - **WHEN** a client requests `GET /backend-api/codex/models` | ||
| - **THEN** the response keeps the Codex-native `models` list | ||
| - **AND** the response includes `object: "list"` and an OpenAI-compatible `data` list | ||
| - **AND** `data` contains model entries whose Codex visibility is `list` | ||
| - **AND** `data` excludes entries whose Codex visibility is `hide` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ## 1. Spec And Regression Coverage | ||
|
|
||
| - [x] 1.1 Add an OpenSpec delta for the `/backend-api/codex/models` `data` alias. | ||
| - [x] 1.2 Add integration coverage proving the Codex-native `models` payload remains present. | ||
| - [x] 1.3 Add integration coverage proving `data` is OpenAI-style and excludes Codex-hidden entries. | ||
|
|
||
| ## 2. Implementation | ||
|
|
||
| - [x] 2.1 Add `data` to the Codex models response schema. | ||
| - [x] 2.2 Reuse the `/v1/models` model-list item mapping for the compatibility alias. | ||
| - [x] 2.3 Preserve existing Codex-native `models` behavior. | ||
|
|
||
| ## 3. Verification | ||
|
|
||
| - [x] 3.1 Run targeted model endpoint tests. | ||
| - [x] 3.2 Run OpenSpec validation for this change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ## Why | ||
|
|
||
| OpenAI-compatible model discovery clients need to know when Codex models expose upstream speed tiers, such as GPT-5.5 Fast. The Codex-native `/backend-api/codex/models` endpoint already preserves these upstream fields, but `/v1/models` drops them from `metadata`. | ||
|
|
||
| ## What Changes | ||
|
|
||
| - Preserve upstream speed-tier metadata on `/v1/models` metadata entries. | ||
| - Include `additional_speed_tiers`, `service_tiers`, and `default_service_tier` when upstream provides them. | ||
| - Keep existing model IDs and pricing/request behavior unchanged. | ||
|
|
||
| ## Impact | ||
|
|
||
| - OpenAI-compatible clients can synthesize fast-mode model aliases from `/v1/models` metadata. | ||
| - No database migration or dashboard UI change. |
14 changes: 14 additions & 0 deletions
14
openspec/changes/expose-v1-model-speed-tiers/specs/model-catalog-compat/spec.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ## ADDED Requirements | ||
|
|
||
| ### Requirement: OpenAI-compatible model metadata preserves speed tiers | ||
|
|
||
| When serving `GET /v1/models`, the system SHALL preserve upstream speed-tier metadata in each model's `metadata` object when upstream provides it. This includes `additional_speed_tiers`, `service_tiers`, and `default_service_tier`. The system MUST NOT invent speed tiers for models whose upstream catalog entry does not advertise them. | ||
|
|
||
| #### Scenario: /v1/models exposes upstream fast tier metadata | ||
|
|
||
| - **WHEN** the upstream model catalog contains `gpt-5.5` with `additional_speed_tiers=["fast"]` | ||
| - **AND** the upstream model catalog includes a `service_tiers` entry with `id="priority"` and `name="Fast"` | ||
| - **WHEN** a client calls `GET /v1/models` | ||
| - **THEN** the `gpt-5.5` entry's metadata includes `additional_speed_tiers=["fast"]` | ||
| - **AND** the metadata includes the upstream `service_tiers` entry | ||
| - **AND** the metadata includes the upstream `default_service_tier` when present |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ## Tasks | ||
|
|
||
| - [x] Add `/v1/models` metadata fields for upstream speed tiers. | ||
| - [x] Map fields from the refreshed model registry raw upstream payload. | ||
| - [x] Add integration coverage for speed-tier metadata on `/v1/models`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.