diff --git a/codex-rs/core/src/model_provider_info.rs b/codex-rs/core/src/model_provider_info.rs index 1a3e5a27679..ecc530cd43a 100644 --- a/codex-rs/core/src/model_provider_info.rs +++ b/codex-rs/core/src/model_provider_info.rs @@ -281,6 +281,28 @@ pub fn built_in_model_providers() -> HashMap { requires_openai_auth: true, }, ), + ( + "github", + P { + name: "GitHub Models".into(), + // GitHub Models exposes an OpenAI‑compatible API hosted on Azure AI Inference. + // Users authenticate with a GitHub token via Bearer auth. + base_url: Some("https://models.github.ai/inference".to_string()), + env_key: Some("GITHUB_TOKEN".to_string()), + env_key_instructions: Some( + "Set GITHUB_TOKEN with access to GitHub Models. See https://docs.github.com/en/github-models".to_string(), + ), + wire_api: WireApi::Chat, + query_params: None, + http_headers: None, + env_http_headers: None, + // Use global defaults for retry/timeout unless overridden in config.toml. + request_max_retries: None, + stream_max_retries: None, + stream_idle_timeout_ms: None, + requires_openai_auth: false, + }, + ), (BUILT_IN_OSS_MODEL_PROVIDER_ID, create_oss_provider()), ] .into_iter() diff --git a/docs/config.md b/docs/config.md index 7d0bd7d2b80..1e66da43976 100644 --- a/docs/config.md +++ b/docs/config.md @@ -66,6 +66,22 @@ base_url = "https://api.mistral.ai/v1" env_key = "MISTRAL_API_KEY" ``` +GitHub Models via the Responses API is supported out of the box under the provider id `github`: + +```toml +# Use GitHub Models +model_provider = "github" +model = "openai/gpt-5" # or any supported model + +[model_providers.github] +name = "GitHub Models" # built-in +base_url = "https://models.github.ai/inference" +env_key = "GITHUB_TOKEN" # Bearer token for GitHub Models +wire_api = "chat" +``` + +Ensure `GITHUB_TOKEN` is set in your environment with access to GitHub Models. See the GitHub documentation for details. + Note that Azure requires `api-version` to be passed as a query parameter, so be sure to specify it as part of `query_params` when defining the Azure provider: ```toml