Skip to content

feat(provider): add openai-responses provider_type for the Responses API (#703) - #709

Merged
yogthos merged 1 commit into
mainfrom
openai-responses-provider-type
Jul 23, 2026
Merged

feat(provider): add openai-responses provider_type for the Responses API (#703)#709
yogthos merged 1 commit into
mainfrom
openai-responses-provider-type

Conversation

@yogthos

@yogthos yogthos commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #703.

A custom provider with provider_type: "openai" always targets /v1/chat/completions. Some OpenAI-compatible endpoints only expose the Responses API (/v1/responses) — e.g. the OAuth proxy in the issue that mirrors what OpenAI itself serves for GPT-5+ — and there was no way to select it.

What

Add a new provider_type: "openai-responses":

"providers": {
  "gpt5-proxy": {
    "provider_type": "openai-responses",
    "model": "gpt-5.6",
    "base_url": "http://127.0.0.1:8639/v1",
    "api_key": "${MY_PROXY_KEY}",
    "allow_insecure": true
  }
}
  • Resolves to the OpenAI kind, so every other behavior (default model, env-var fallbacks, base_url/allow_insecure handling, model-family routing) is reused — no ProviderKind explosion.
  • Forks only the final client build to the existing ChatGptOpenAI client (openai::Client's Responses adapter) with a non-token CodexHttpClient: a plain api-key bearer against the configured base_url, no OAuth/Codex login. The codex http layer still normalizes the outgoing Responses body (rig 0.37 emits instructions: null + a system item in input), which is the correct shape for any /v1/responses endpoint.
  • allow_insecure is honored (the https-only guard only applies to OAuth bearers), so the reporter's http://127.0.0.1 proxy works.
  • provider_type: "openai" is unchanged (chat/completions).

Note

Pin a model on the entry. An unset model falls back to the OpenAI default (gpt-4o), which the Codex-default remap (resolve_codex_default, only fires when the model is not explicitly set) would then rewrite — harmless but not what you want against a proxy.

Tests

  • parse_provider("openai-responses") → OpenAI kind (both separators, case-insensitive); resolve_provider_info sets the openai_responses flag for it and not for plain openai.
  • create_client builds AnyClient::ChatGptOpenAI for openai-responses (and doesn't read the OAuth store), while plain openai still builds AnyClient::OpenAI.
  • cargo fmt + cargo clippy --tests clean; provider suite green locally.

Docs: docs/config.md (provider_type table + a "Chat Completions vs Responses API" subsection).

…API (#703)

A custom provider_type=openai always hits /v1/chat/completions. Some
OpenAI-compatible endpoints (e.g. an OAuth proxy mirroring OpenAI's own
GPT-5+ surface) only expose /v1/responses, with no way to select it.

Add provider_type "openai-responses": it resolves to the OpenAI kind (so all
the OpenAI defaults/env/base_url handling is reused) but forks the client
build to the existing ChatGptOpenAI client — openai::Client's Responses
adapter — with a non-token CodexHttpClient. That means a plain api-key bearer
against the configured base_url, no OAuth/Codex login required, while still
normalizing the outgoing Responses body to the correct shape. allow_insecure
works since no OAuth bearer is involved.

Pin a `model` on the entry; an unset model falls back to the OpenAI default,
which the codex-default remap would then rewrite.
@yogthos
yogthos merged commit 0154fb3 into main Jul 23, 2026
14 checks passed
@yogthos
yogthos deleted the openai-responses-provider-type branch July 23, 2026 19:24
@draxxris

Copy link
Copy Markdown

Thanks. I started on it last night but my subscription hit its limit =V

@yogthos

yogthos commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

ah no worries

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.

Support openai-chat-completions vs openai-responses API

2 participants