Skip to content

Conversation

vtomnet
Copy link

@vtomnet vtomnet commented Sep 25, 2025

This enables access to gpt-5-codex, with the following codex-cli config.toml. It works but needs polishing. TODO:

  • isNonStreaming
  • max_tokens
  • type definitions
  • testing

Config:

model_provider = "copilot-api"
model = "gpt-5-codex"
model_reasoning_effort = "high"

[model_providers.copilot-api]
name = "GitHub Copilot API"
base_url = "http://localhost:4141/v1"
wire_api = "responses"

Re: max_tokens, I'm not sure of the purpose of this code from chat-completions/handler.ts:

  if (isNullish(payload.max_tokens)) {
    const selectedModel = state.models?.data.find(
      (model) => model.id === payload.model,
    )

    payload = {
      ...payload,
      max_tokens: selectedModel?.capabilities.limits.max_output_tokens,
    }
    consola.debug("Set max_tokens to:", JSON.stringify(payload.max_tokens))
  }

Re: testing, the model is currently overloaded via GitHub so it's mostly unusable at the moment:

⚠️ stream error: We're currently experiencing high demand, which may cause temporary errors.; retrying 1/5 in 182ms…
⚠️ stream error: stream disconnected before completion: Transport error: error decoding response body; retrying 1/5 in 216ms…
⚠️ stream error: exceeded retry limit, last status: 429 Too Many Requests; retrying 1/5 in 214ms…

Another thing: Codex is unable to do web searches (--search), but it looks like a github limitation:

 ERROR  HTTP error: { error:
   { message: 'The requested tool web_search is not supported.',
     code: 'unsupported_value',
     param: 'tools',
     type: 'invalid_request_error' } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant