From ca3f6c7dd35e1c9775e7a3af316371ee8a413a35 Mon Sep 17 00:00:00 2001 From: pxysea Date: Thu, 19 Nov 2026 08:20:18 +0800 Subject: [PATCH 1/2] feat(codex): support GPT-6.2 Astra and Sol --- docs/src/content/docs/providers/codex.md | 9 +++-- .../content/docs/using/models-and-routing.md | 2 +- src/providers/codex/mod.rs | 40 ++++++++++++++----- .../codex/translate/model_allowlist.rs | 13 +++++- src/registry.rs | 31 +++++--------- tests/codex_model_catalog.rs | 7 ++++ tests/server.rs | 10 +++++ 7 files changed, 76 insertions(+), 36 deletions(-) diff --git a/docs/src/content/docs/providers/codex.md b/docs/src/content/docs/providers/codex.md index cca0fc42..f0600977 100644 --- a/docs/src/content/docs/providers/codex.md +++ b/docs/src/content/docs/providers/codex.md @@ -26,7 +26,7 @@ The proxy owns its tokens and does not read native Codex CLI credentials. It ref ## Models and fast mode -Use `claude-code-proxy models` as the current catalog. Model access depends on your ChatGPT account. A model rejected by the subscription produces the upstream error verbatim. +Select GPT-6.2 with `ANTHROPIC_MODEL=gpt-6.2-sol` or `ANTHROPIC_MODEL=gpt-6.2-astra`. Use `claude-code-proxy models` as the current catalog. Model access depends on your ChatGPT account. A model rejected by the subscription produces the upstream error verbatim. The proxy also reads the Codex CLI's optional `$CODEX_HOME/models_cache.json` (default `~/.codex/models_cache.json`) to recognize additional models. Listed @@ -44,7 +44,7 @@ Claude-style aliases map to Codex models: `haiku` and `claude-haiku-*` to `gpt-6 Append `-fast` to any registered Codex model to request `service_tier: "priority"`. For example, `gpt-6-sol-fast` selects `gpt-6-sol` with fast service. -Append `-ultrafast` to a model that offers the ultrafast tier to request `service_tier: "ultrafast"`. `gpt-6-astra` and `gpt-6.1-sol` offer it today, so `gpt-6-astra-ultrafast` and `gpt-6.1-sol-ultrafast` are the ultrafast IDs. +Append `-ultrafast` to a model that offers the ultrafast tier to request `service_tier: "ultrafast"`. The supported base models are `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6.2-astra`, and `gpt-6.2-sol`. On `/v1/messages`, `CCP_CODEX_SERVICE_TIER` or `codex.serviceTier` takes precedence over either suffix. A forced `ultrafast` applies to models that offer it, and the proxy requests `priority` for the others. The OpenAI-compatible routes use only the suffix or, on `/v1/responses`, the request's own `service_tier`. @@ -78,8 +78,9 @@ The gpt-5.6 and gpt-6 families use Responses Lite by default. Lite requires `parallel_tool_calls: false`, so function tools run serially. Set `codex.fullLane: true` or `CCP_CODEX_FULL_LANE=1` to use the full Responses lane for `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-6-astra`, `gpt-6-sol`, `gpt-6.1-sol`, -and `gpt-6.1-terra`. This permits parallel calls; the model still decides whether to batch tools, and explicit -client restrictions on parallel tools remain effective. +`gpt-6.1-terra`, `gpt-6.2-astra`, and `gpt-6.2-sol`. This permits parallel calls. +The model decides whether to batch tools and respects explicit client +restrictions on parallel calls. This is not a universal lane override: catalog-only models keep the lane specified in the local Codex model cache. Luna models stay on Lite. diff --git a/docs/src/content/docs/using/models-and-routing.md b/docs/src/content/docs/using/models-and-routing.md index 219b77e7..e39c09db 100644 --- a/docs/src/content/docs/using/models-and-routing.md +++ b/docs/src/content/docs/using/models-and-routing.md @@ -39,7 +39,7 @@ curl http://127.0.0.1:18765/v1/models Every registered Codex model also has a local `-fast` form. The proxy removes `-fast` from the upstream model and requests the priority service tier. -Models that offer the ultrafast tier also have a local `-ultrafast` form, which requests the ultrafast service tier. Today those are `gpt-6-astra-ultrafast` and `gpt-6.1-sol-ultrafast`. An `-ultrafast` name on any other model is not a registered ID. +Models that offer the ultrafast tier also have a local `-ultrafast` form, which requests the ultrafast service tier. The registered IDs are `gpt-6-astra-ultrafast`, `gpt-6.1-sol-ultrafast`, `gpt-6.2-astra-ultrafast`, and `gpt-6.2-sol-ultrafast`. For Claude Code requests on `/v1/messages`, a configured `codex.serviceTier` or `CCP_CODEX_SERVICE_TIER` override wins over both suffixes. When the forced tier is `ultrafast` and the model does not offer it, the proxy requests priority instead. diff --git a/src/providers/codex/mod.rs b/src/providers/codex/mod.rs index 4e0f9d12..0a1cdcc1 100644 --- a/src/providers/codex/mod.rs +++ b/src/providers/codex/mod.rs @@ -2504,8 +2504,35 @@ mod tests { } #[test] - fn terra_translation_preserves_model_and_tier_across_lanes() { - for requested in ["gpt-6.1-terra", "gpt-6.1-terra-fast"] { + fn translation_preserves_model_and_tier_across_lanes() { + for (requested, model, tier) in [ + ("gpt-6.1-terra", "gpt-6.1-terra", None), + ( + "gpt-6.1-terra-fast", + "gpt-6.1-terra", + Some(ServiceTier::Priority), + ), + ( + "gpt-6.2-astra-fast", + "gpt-6.2-astra", + Some(ServiceTier::Priority), + ), + ( + "gpt-6.2-sol-fast", + "gpt-6.2-sol", + Some(ServiceTier::Priority), + ), + ( + "gpt-6.2-astra-ultrafast", + "gpt-6.2-astra", + Some(ServiceTier::Ultrafast), + ), + ( + "gpt-6.2-sol-ultrafast", + "gpt-6.2-sol", + Some(ServiceTier::Ultrafast), + ), + ] { for hosted_search in [false, true] { let tools = if hosted_search { serde_json::json!([{"type":"web_search_20250305", "name":"web_search"}]) @@ -2526,14 +2553,9 @@ mod tests { }, ) .unwrap(); - assert_eq!(translated.model, "gpt-6.1-terra"); + assert_eq!(translated.model, model, "{requested}"); assert_eq!(translated.client_metadata.is_some(), !hosted_search); - assert_eq!( - translated.service_tier, - requested - .ends_with("-fast") - .then_some(ServiceTier::Priority) - ); + assert_eq!(translated.service_tier, tier, "{requested}"); } } } diff --git a/src/providers/codex/translate/model_allowlist.rs b/src/providers/codex/translate/model_allowlist.rs index 63075fc4..78f4b716 100644 --- a/src/providers/codex/translate/model_allowlist.rs +++ b/src/providers/codex/translate/model_allowlist.rs @@ -23,6 +23,8 @@ pub const ALLOWED_MODELS: &[&str] = &[ "gpt-6-sol", "gpt-6.1-sol", "gpt-6.1-terra", + "gpt-6.2-astra", + "gpt-6.2-sol", ]; pub const MODEL_ALIASES: &[(&str, &str)] = &[ @@ -81,9 +83,10 @@ pub fn allowed_models_display() -> String { allowed_models().join(", ") } -/// Models whose Codex catalog entry offers the `ultrafast` service tier. +/// Models that offer the `ultrafast` service tier in Codex. /// Every other model offers `priority` at most, so it gets no `-ultrafast` form. -pub const ULTRAFAST_MODELS: &[&str] = &["gpt-6-astra", "gpt-6.1-sol"]; +pub const ULTRAFAST_MODELS: &[&str] = + &["gpt-6-astra", "gpt-6.1-sol", "gpt-6.2-astra", "gpt-6.2-sol"]; const FAST_SUFFIX: &str = "-fast"; const ULTRAFAST_SUFFIX: &str = "-ultrafast"; @@ -207,6 +210,8 @@ pub fn uses_responses_lite(model: &str) -> bool { | "gpt-6-sol" | "gpt-6.1-sol" | "gpt-6.1-terra" + | "gpt-6.2-astra" + | "gpt-6.2-sol" ) || (!ALLOWED_MODELS.contains(&model) && catalog_model(model) .is_some_and(|entry| entry.supported_in_api && entry.use_responses_lite)) @@ -224,6 +229,8 @@ pub fn uses_responses_lite_with_full_lane(model: &str, full_lane: bool) -> bool | "gpt-6-sol" | "gpt-6.1-sol" | "gpt-6.1-terra" + | "gpt-6.2-astra" + | "gpt-6.2-sol" ) { return false; @@ -272,6 +279,8 @@ mod tests { "gpt-6-sol", "gpt-6.1-sol", "gpt-6.1-terra", + "gpt-6.2-astra", + "gpt-6.2-sol", ] { assert!(uses_responses_lite_with_full_lane(model, false), "{model}"); assert!(!uses_responses_lite_with_full_lane(model, true), "{model}"); diff --git a/src/registry.rs b/src/registry.rs index 2dad8e5c..0b6994d4 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -2,7 +2,9 @@ use crate::{ anthropic::{json_error, schema::MessagesRequest}, config::AliasProvider, provider::{CliHandlers, Provider, RequestContext}, - providers::codex::translate::model_allowlist::tier_model_variants, + providers::codex::translate::model_allowlist::{ + ALLOWED_MODELS, listed_catalog_models, tier_model_variants, + }, }; use anyhow::{Result, anyhow}; use async_trait::async_trait; @@ -39,23 +41,6 @@ const CURSOR_LEGACY_MODELS: &[&str] = &[ "composer-2.5-fast", ]; -pub(crate) const CODEX_MODELS: &[&str] = &[ - "gpt-5.2", - "gpt-5.3-codex", - "gpt-5.3-codex-spark", - "gpt-5.4", - "gpt-5.4-mini", - "gpt-5.5", - "gpt-5.6-luna", - "gpt-5.6-sol", - "gpt-5.6-terra", - "gpt-6-astra", - "gpt-6-luna", - "gpt-6-sol", - "gpt-6.1-sol", - "gpt-6.1-terra", -]; - pub(crate) const KIMI_MODELS: &[&str] = &["kimi-for-coding", "kimi-k2.6", "kimi-k3", "k2.6", "k3"]; pub(crate) const GROK_MODELS: &[&str] = &["grok-composer-2.5-fast", "grok-4.5", "grok-4.6", "grok-4.7"]; @@ -342,8 +327,8 @@ pub(crate) fn expand_codex_models() -> Vec { let mut out = Vec::new(); // Baseline ∪ models the Codex CLI advertises in its own model cache, so a // model OpenAI ships to Codex routes here before a proxy release lists it. - let catalog = crate::providers::codex::translate::model_allowlist::listed_catalog_models(); - for model in CODEX_MODELS + let catalog = listed_catalog_models(); + for model in ALLOWED_MODELS .iter() .map(|model| (*model).to_string()) .chain(catalog) @@ -391,6 +376,8 @@ mod tests { "gpt-6-astra-ultrafast", "gpt-6-astra-ultrafast[1m]", "gpt-6.1-sol-ultrafast", + "gpt-6.2-astra-ultrafast", + "gpt-6.2-sol-ultrafast[1m]", ] { assert_eq!( registry.provider_for_model(model, None).unwrap().name(), @@ -486,6 +473,10 @@ mod tests { "gpt-6.1-sol-fast", "gpt-6.1-terra", "gpt-6.1-terra-fast", + "gpt-6.2-astra", + "gpt-6.2-astra-fast", + "gpt-6.2-sol", + "gpt-6.2-sol-fast", ] { assert_eq!( registry.provider_for_model(model, None).unwrap().name(), diff --git a/tests/codex_model_catalog.rs b/tests/codex_model_catalog.rs index 109f7734..ef371377 100644 --- a/tests/codex_model_catalog.rs +++ b/tests/codex_model_catalog.rs @@ -167,6 +167,13 @@ async fn catalog_drives_discovery_routing_tiers_and_lanes_in_actual_process() { true, Some("ultrafast"), ), + ( + "gpt-6.2-astra-ultrafast", + "gpt-6.2-astra", + true, + Some("ultrafast"), + ), + ("gpt-6.2-sol-fast", "gpt-6.2-sol", true, Some("priority")), ] { let response = client .post(format!("{url}/v1/responses")) diff --git a/tests/server.rs b/tests/server.rs index 7fb5e6f8..18b75830 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -1756,6 +1756,16 @@ async fn models_endpoint_lists_supported_models() { assert!(ids.contains(&"gpt-6.1-terra-fast")); assert!(ids.contains(&"gpt-6-astra-ultrafast")); assert!(ids.contains(&"gpt-6.1-sol-ultrafast")); + for id in [ + "gpt-6.2-astra", + "gpt-6.2-astra-fast", + "gpt-6.2-astra-ultrafast", + "gpt-6.2-sol", + "gpt-6.2-sol-fast", + "gpt-6.2-sol-ultrafast", + ] { + assert!(ids.contains(&id), "{id}"); + } assert!(!ids.contains(&"gpt-6-sol-ultrafast")); assert!(ids.contains(&"grok-4.6")); for entry in data { From 396c2bd6ac0aa5fce0c9bf5ff0c8edb921556cc3 Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Sat, 21 Nov 2026 12:31:30 +0200 Subject: [PATCH 2/2] remove unverified ultrafast variants for gpt-6.2 Both base models complete Codex requests under their own names, but requests for ultrafast complete at the default tier. Neither model is advertised by the account catalog. Keep the working routes without advertising an unverified tier, and check the discovery list excludes it. --- docs/src/content/docs/providers/codex.md | 2 +- docs/src/content/docs/using/models-and-routing.md | 2 +- src/providers/codex/mod.rs | 12 ++---------- src/providers/codex/translate/model_allowlist.rs | 3 +-- src/registry.rs | 2 -- tests/codex_model_catalog.rs | 7 +------ tests/server.rs | 4 ++-- 7 files changed, 8 insertions(+), 24 deletions(-) diff --git a/docs/src/content/docs/providers/codex.md b/docs/src/content/docs/providers/codex.md index f0600977..23acad88 100644 --- a/docs/src/content/docs/providers/codex.md +++ b/docs/src/content/docs/providers/codex.md @@ -44,7 +44,7 @@ Claude-style aliases map to Codex models: `haiku` and `claude-haiku-*` to `gpt-6 Append `-fast` to any registered Codex model to request `service_tier: "priority"`. For example, `gpt-6-sol-fast` selects `gpt-6-sol` with fast service. -Append `-ultrafast` to a model that offers the ultrafast tier to request `service_tier: "ultrafast"`. The supported base models are `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6.2-astra`, and `gpt-6.2-sol`. +Append `-ultrafast` to a model that offers the ultrafast tier to request `service_tier: "ultrafast"`. `gpt-6-astra` and `gpt-6.1-sol` offer it today, so `gpt-6-astra-ultrafast` and `gpt-6.1-sol-ultrafast` are the ultrafast IDs. On `/v1/messages`, `CCP_CODEX_SERVICE_TIER` or `codex.serviceTier` takes precedence over either suffix. A forced `ultrafast` applies to models that offer it, and the proxy requests `priority` for the others. The OpenAI-compatible routes use only the suffix or, on `/v1/responses`, the request's own `service_tier`. diff --git a/docs/src/content/docs/using/models-and-routing.md b/docs/src/content/docs/using/models-and-routing.md index e39c09db..219b77e7 100644 --- a/docs/src/content/docs/using/models-and-routing.md +++ b/docs/src/content/docs/using/models-and-routing.md @@ -39,7 +39,7 @@ curl http://127.0.0.1:18765/v1/models Every registered Codex model also has a local `-fast` form. The proxy removes `-fast` from the upstream model and requests the priority service tier. -Models that offer the ultrafast tier also have a local `-ultrafast` form, which requests the ultrafast service tier. The registered IDs are `gpt-6-astra-ultrafast`, `gpt-6.1-sol-ultrafast`, `gpt-6.2-astra-ultrafast`, and `gpt-6.2-sol-ultrafast`. +Models that offer the ultrafast tier also have a local `-ultrafast` form, which requests the ultrafast service tier. Today those are `gpt-6-astra-ultrafast` and `gpt-6.1-sol-ultrafast`. An `-ultrafast` name on any other model is not a registered ID. For Claude Code requests on `/v1/messages`, a configured `codex.serviceTier` or `CCP_CODEX_SERVICE_TIER` override wins over both suffixes. When the forced tier is `ultrafast` and the model does not offer it, the proxy requests priority instead. diff --git a/src/providers/codex/mod.rs b/src/providers/codex/mod.rs index 0a1cdcc1..0695706f 100644 --- a/src/providers/codex/mod.rs +++ b/src/providers/codex/mod.rs @@ -2522,16 +2522,8 @@ mod tests { "gpt-6.2-sol", Some(ServiceTier::Priority), ), - ( - "gpt-6.2-astra-ultrafast", - "gpt-6.2-astra", - Some(ServiceTier::Ultrafast), - ), - ( - "gpt-6.2-sol-ultrafast", - "gpt-6.2-sol", - Some(ServiceTier::Ultrafast), - ), + ("gpt-6.2-astra", "gpt-6.2-astra", None), + ("gpt-6.2-sol", "gpt-6.2-sol", None), ] { for hosted_search in [false, true] { let tools = if hosted_search { diff --git a/src/providers/codex/translate/model_allowlist.rs b/src/providers/codex/translate/model_allowlist.rs index 78f4b716..c3b05ef4 100644 --- a/src/providers/codex/translate/model_allowlist.rs +++ b/src/providers/codex/translate/model_allowlist.rs @@ -85,8 +85,7 @@ pub fn allowed_models_display() -> String { /// Models that offer the `ultrafast` service tier in Codex. /// Every other model offers `priority` at most, so it gets no `-ultrafast` form. -pub const ULTRAFAST_MODELS: &[&str] = - &["gpt-6-astra", "gpt-6.1-sol", "gpt-6.2-astra", "gpt-6.2-sol"]; +pub const ULTRAFAST_MODELS: &[&str] = &["gpt-6-astra", "gpt-6.1-sol"]; const FAST_SUFFIX: &str = "-fast"; const ULTRAFAST_SUFFIX: &str = "-ultrafast"; diff --git a/src/registry.rs b/src/registry.rs index 0b6994d4..b2368814 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -376,8 +376,6 @@ mod tests { "gpt-6-astra-ultrafast", "gpt-6-astra-ultrafast[1m]", "gpt-6.1-sol-ultrafast", - "gpt-6.2-astra-ultrafast", - "gpt-6.2-sol-ultrafast[1m]", ] { assert_eq!( registry.provider_for_model(model, None).unwrap().name(), diff --git a/tests/codex_model_catalog.rs b/tests/codex_model_catalog.rs index ef371377..b895227b 100644 --- a/tests/codex_model_catalog.rs +++ b/tests/codex_model_catalog.rs @@ -167,12 +167,7 @@ async fn catalog_drives_discovery_routing_tiers_and_lanes_in_actual_process() { true, Some("ultrafast"), ), - ( - "gpt-6.2-astra-ultrafast", - "gpt-6.2-astra", - true, - Some("ultrafast"), - ), + ("gpt-6.2-astra", "gpt-6.2-astra", true, None), ("gpt-6.2-sol-fast", "gpt-6.2-sol", true, Some("priority")), ] { let response = client diff --git a/tests/server.rs b/tests/server.rs index 18b75830..a050cf3a 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -1759,13 +1759,13 @@ async fn models_endpoint_lists_supported_models() { for id in [ "gpt-6.2-astra", "gpt-6.2-astra-fast", - "gpt-6.2-astra-ultrafast", "gpt-6.2-sol", "gpt-6.2-sol-fast", - "gpt-6.2-sol-ultrafast", ] { assert!(ids.contains(&id), "{id}"); } + assert!(!ids.contains(&"gpt-6.2-astra-ultrafast")); + assert!(!ids.contains(&"gpt-6.2-sol-ultrafast")); assert!(!ids.contains(&"gpt-6-sol-ultrafast")); assert!(ids.contains(&"grok-4.6")); for entry in data {