Skip to content

feat(models): add openai-responses as a custom endpoint API flavor - #32

Open
jacisko wants to merge 1 commit into
join3r:mainfrom
jacisko:openai-responses
Open

jacisko wants to merge 1 commit into
join3r:mainfrom
jacisko:openai-responses

Conversation

@jacisko

@jacisko jacisko commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Expose openai-responses as a first-class custom-endpoint API flavor, so reasoning models route through /v1/responses instead of /v1/chat/completions.

Why

Reasoning models such as gpt-6.1-sol reject function tools combined with reasoning_effort on /v1/chat/completions:

400 ... "Function tools with reasoning_effort are not supported for
gpt-6.1-sol-... in /v1/chat/completions. To use function tools, use
/v1/responses or set reasoning_effort to 'none'."

A custom endpoint could only be openai-completions or anthropic-messages, so every tool turn on such a model returned 400.

Changes

  • LocalProviderApi union and coerceLocal accept openai-responses, so the saved value survives a settings rewrite.
  • syncModelsConfig writes a models.json block that keeps /v1 and an empty compat.
  • Auto-detect probes /v1/responses. A dual-route endpoint returns an ambiguous result and asks the user to pick a flavor, rather than silently routing to completions.
  • The models settings tab shows the new flavor and explains the pick-on-ambiguity.
  • The providers:testLocal IPC guard accepts the flavor (otherwise the Test button fails before the probe).
  • The paired-computer relay allows /v1/responses (otherwise discovery passes but every turn 502s).

Tests

  • tests/unit/responses-integration.test.ts: drives updateLocalProvider then syncModelsConfig, spawns a real pi in RPC mode against a recording mock, and asserts pi POSTs to /v1/responses with a non-empty tools array and a Bearer token, never /v1/chat/completions. Flipping the generated flavor to completions makes the test time out, which confirms it is a real regression guard.
  • tests/unit/ipc-guard.test.ts: the guard accepts all three flavors as argument 4, still rejects a bogus flavor.
  • tests/unit/llm-relay.test.ts: the relay allows /v1/responses.
  • tests/unit/models-config.test.ts: auto-detect picks responses when only /v1/responses answers; a dual-route endpoint returns ambiguous; the generated block keeps /v1 with empty compat.

Typecheck, lint, and the four affected suites pass (65 tests).

Verification status

Verified live against the HAI gateway. A built app was seeded with a Responses custom endpoint for gpt-6.1-sol. The seed used the exact failing reasoning: true override. One real turn through the desktop UI returned a reply. The same combo 400s on /v1/chat/completions, so the reply proves the turn routed through /v1/responses. The committed integration test also verifies the route against a recording mock and a real pi RPC child.

Not yet verified: a Responses endpoint on a paired computer (the relay fix has a unit guard only), and onboarding (out of scope, below).

Out of scope

Onboarding has no flavor control and persists no flavor, so it cannot set up a Responses endpoint yet. That needs a UI control plus persistence and is left as a separate change. The settings tab is the supported path.

Reasoning models such as gpt-6.1-sol reject function tools with
reasoning_effort on /v1/chat/completions and need /v1/responses. A
custom endpoint could only be openai-completions or anthropic-messages,
so these models returned 400 on every tool turn.

Expose openai-responses as a first-class flavor:
- add it to the LocalProviderApi union and coerceLocal, so the saved
  value survives a settings rewrite
- generate a models.json block that keeps /v1 and an empty compat
- probe /v1/responses during auto-detect; a dual-route endpoint returns
  an ambiguous result so the user picks a flavor instead of silently
  routing to completions
- surface the flavor in the models settings tab
- allow the flavor through the providers:testLocal IPC guard
- relay /v1/responses on a paired computer

Tests drive updateLocalProvider and syncModelsConfig, then spawn a real
pi in RPC mode against a recording mock and assert it POSTs to
/v1/responses with tools, never /v1/chat/completions. Regression guards
cover the IPC allowlist and the paired-computer relay path.
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