feat(provider): add openai-responses provider_type for the Responses API (#703) - #709
Merged
Conversation
…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.
|
Thanks. I started on it last night but my subscription hit its limit =V |
Collaborator
Author
|
ah no worries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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":base_url/allow_insecurehandling, model-family routing) is reused — noProviderKindexplosion.ChatGptOpenAIclient (openai::Client's Responses adapter) with a non-tokenCodexHttpClient: a plain api-key bearer against the configuredbase_url, no OAuth/Codex login. The codex http layer still normalizes the outgoing Responses body (rig 0.37 emitsinstructions: null+ a system item ininput), which is the correct shape for any/v1/responsesendpoint.allow_insecureis honored (the https-only guard only applies to OAuth bearers), so the reporter'shttp://127.0.0.1proxy works.provider_type: "openai"is unchanged (chat/completions).Note
Pin a
modelon 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_infosets theopenai_responsesflag for it and not for plainopenai.create_clientbuildsAnyClient::ChatGptOpenAIforopenai-responses(and doesn't read the OAuth store), while plainopenaistill buildsAnyClient::OpenAI.cargo fmt+cargo clippy --testsclean; provider suite green locally.Docs:
docs/config.md(provider_type table + a "Chat Completions vs Responses API" subsection).