feat: codex subscription support (#6600)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Michael Neale
2026-01-23 17:11:58 +11:00
committed by GitHub
parent e7bfdf8fa2
commit e78a1e7d4e
26 changed files with 1666 additions and 69 deletions
+6 -2
View File
@@ -633,9 +633,13 @@ impl McpClientTrait for AppsManagerClient {
}
fn schema<T: JsonSchema>() -> JsonObject {
serde_json::to_value(schema_for!(T))
let mut obj = serde_json::to_value(schema_for!(T))
.map(|v| v.as_object().unwrap().clone())
.expect("valid schema")
.expect("valid schema");
// Ensure properties key exists (required by OpenAI-compatible APIs)
obj.entry("properties")
.or_insert_with(|| serde_json::json!({}));
obj
}
fn extract_string(args: &JsonObject, key: &str) -> Result<String, String> {
@@ -3724,6 +3724,10 @@
"provider_model": "gpt-5.1-codex-mini",
"canonical_model": "openai/gpt-5.1-codex-mini"
},
{
"provider_model": "gpt-5.2-codex",
"canonical_model": "openai/gpt-5.2-codex"
},
{
"provider_model": "gpt-5.2",
"canonical_model": "openai/gpt-5.2"
@@ -2033,6 +2033,27 @@
"completion": 0.000014
}
},
{
"id": "openai/gpt-5.2-codex",
"name": "OpenAI: GPT-5.2-Codex",
"context_length": 400000,
"max_completion_tokens": 128000,
"input_modalities": [
"file",
"image",
"text"
],
"output_modalities": [
"text"
],
"supports_tools": true,
"pricing": {
"prompt": 1.75e-6,
"completion": 0.000014,
"request": 0.0,
"image": 0.0
}
},
{
"id": "openai/gpt-5.2-pro",
"name": "OpenAI: GPT-5.2 Pro",
@@ -133,7 +133,10 @@ fn swap_claude_word_order(model: &str) -> Option<String> {
}
fn is_hosting_provider(provider: &str) -> bool {
matches!(provider, "databricks" | "openrouter" | "azure" | "bedrock")
matches!(
provider,
"databricks" | "openrouter" | "azure" | "bedrock" | "chatgpt_codex"
)
}
/// Infer the real provider from model name patterns
File diff suppressed because it is too large Load Diff
+5
View File
@@ -5,6 +5,7 @@ use super::{
azure::AzureProvider,
base::{Provider, ProviderMetadata},
bedrock::BedrockProvider,
chatgpt_codex::ChatGptCodexProvider,
claude_code::ClaudeCodeProvider,
codex::CodexProvider,
cursor_agent::CursorAgentProvider,
@@ -46,6 +47,10 @@ async fn init_registry() -> RwLock<ProviderRegistry> {
.register::<AnthropicProvider, _>(|m| Box::pin(AnthropicProvider::from_env(m)), true);
registry.register::<AzureProvider, _>(|m| Box::pin(AzureProvider::from_env(m)), false);
registry.register::<BedrockProvider, _>(|m| Box::pin(BedrockProvider::from_env(m)), false);
registry.register::<ChatGptCodexProvider, _>(
|m| Box::pin(ChatGptCodexProvider::from_env(m)),
true,
);
registry
.register::<ClaudeCodeProvider, _>(|m| Box::pin(ClaudeCodeProvider::from_env(m)), true);
registry.register::<CodexProvider, _>(|m| Box::pin(CodexProvider::from_env(m)), true);
+1
View File
@@ -6,6 +6,7 @@ pub mod azureauth;
pub mod base;
pub mod bedrock;
pub mod canonical;
pub mod chatgpt_codex;
pub mod claude_code;
pub mod codex;
pub mod cursor_agent;