Skip to content

Can't use GPT-5 Codex #220

@ncaq

Description

@ncaq

GPT-5 Codex appears to be unavailable. While it can be selected in the model selection dialog developed here, attempting to send a chat results in the following error:

## [19:28:44] Copilot(gpt-5-codex):
Error: model gpt-5-codex is not accessible via the /chat/completions endpoint

It seems the issue is that we're using the https://api.githubcopilot.com/chat/completions endpoint. It appears we need to migrate to a new endpoint going forward. Looking at the JSON data from the model list, GPT-5 has the following fields:

    {
      "capabilities": {
        "family": "gpt-5",
        "limits": {
          "max_context_window_tokens": 400000,
          "max_output_tokens": 128000,
          "max_prompt_tokens": 128000,
          "vision": {
            "max_prompt_image_size": 3145728,
            "max_prompt_images": 1,
            "supported_media_types": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/gif"
            ]
          }
        },
        "object": "model_capabilities",
        "supports": {
          "parallel_tool_calls": true,
          "streaming": true,
          "structured_outputs": true,
          "tool_calls": true,
          "vision": true
        },
        "tokenizer": "o200k_base",
        "type": "chat"
      },
      "id": "gpt-5",
      "model_picker_category": "versatile",
      "model_picker_enabled": true,
      "name": "GPT-5",
      "object": "model",
      "policy": {
        "state": "enabled",
        "terms": "Enable access to the latest GPT-5 model from OpenAI. [Learn more about how GitHub Copilot serves GPT-5](https://gh.io/copilot-openai)."
      },
      "preview": false,
      "supported_endpoints": ["/chat/completions", "/responses"],
      "vendor": "Azure OpenAI",
      "version": "gpt-5"
    },

In contrast, GPT-5 Codex looks like this:

    {
      "capabilities": {
        "family": "gpt-5-codex",
        "limits": {
          "max_context_window_tokens": 400000,
          "max_output_tokens": 128000,
          "max_prompt_tokens": 128000,
          "vision": {
            "max_prompt_image_size": 3145728,
            "max_prompt_images": 1,
            "supported_media_types": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "image/gif"
            ]
          }
        },
        "object": "model_capabilities",
        "supports": {
          "parallel_tool_calls": true,
          "streaming": true,
          "structured_outputs": true,
          "tool_calls": true,
          "vision": true
        },
        "tokenizer": "o200k_base",
        "type": "chat"
      },
      "id": "gpt-5-codex",
      "model_picker_category": "powerful",
      "model_picker_enabled": true,
      "name": "GPT-5-Codex (Preview)",
      "object": "model",
      "policy": {
        "state": "enabled",
        "terms": "Enable access to the latest GPT-5-Codex model from OpenAI. [Learn more about how GitHub Copilot serves GPT-5-Codex](https://gh.io/copilot-openai)."
      },
      "preview": true,
      "supported_endpoints": ["/responses"],
      "vendor": "OpenAI",
      "version": "gpt-5-codex"
    },

It appears that gpt-5-codex requires using the /responses endpoint. I haven't looked into the details yet, but I've heard that the VSCode GitHub Copilot Chat extension was recently open-sourced, so examining that code might help us emulate the functionality. However, for this implementation, it might be better to consolidate either curl or request rather than maintaining both backends, as supporting multiple backends is becoming challenging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions