Feature: Translate between chat completions and Responses API (maybe even Anthropic API?) across providers
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- backend-api-design
Direzione di ricerca
Start with the existing adapter in internal/providers/responses_adapter.go, the stream converter in internal/providers/responses_converter.go, and the chatgpt provider methods in internal/providers/chatgpt/chatgpt.go; read ADR-0002 and ADR-0007 for the boundary design. Issue #1084 specifies the first implementation slice, while #1055 flags a known translation-loss concern. Done means chat requests can reach Responses-only providers with responses converted back, including streaming, usage, and the stated ID and chaining semantics.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
The new chatgpt provider (#718) serves only the Responses API. The Codex
backend behind a ChatGPT subscription has no chat completions endpoint.
ChatGPT and Codex subscription tokens now work through the Responses API only.
A client that calls /v1/chat/completions on a chatgpt model gets
501 unsupported_provider_operation. The provider returns this from
ChatCompletion and StreamChatCompletion
(internal/providers/chatgpt/chatgpt.go).
This blocks real setups:
- A harness that speaks only chat completions, for example Kimi Code CLI,
cannot use ChatGPT subscription models. - An Anthropic harness on
/v1/messagescannot use them either. GoModel
translates the Anthropic dialect to the canonical chat request at ingress
(ADR-0007). The request then hits the same 501. - A virtual model that mixes
chatgptwith chat-native providers is
unreliable. Failover treats the 501 as eligible and skips the provider
(internal/gateway/failover.go). A mixed pool loses capacity instead of
using it.
- The reverse direction works today.
ResponsesViaChat
(internal/providers/responses_adapter.go) lets chat-only providers serve
/v1/responses. Providers like kilo, groq, gemini, bedrock, ollama, cohere,
and vertex use it throughopenai.ChatCompatible. The Anthropic ingress
(ADR-0007) proves dialect translation at the boundary for a third API shape.
Only one direction is missing: chat completions in, Responses out.
Describe the solution you'd like
Goal: the client dialect and the provider dialect should be independent.
GoModel translates between them on the fly.
This issue uses "dialect" for one API format: chat completions, Responses,
or Anthropic Messages. This table shows the desired state:
| Client calls | Provider serves | Today |
|---|---|---|
/v1/chat/completions |
chat completions | works |
/v1/responses |
chat completions | works (ResponsesViaChat) |
/v1/messages |
chat completions | works (ADR-0007) |
/v1/responses |
Responses | works (native) |
/v1/chat/completions |
Responses only (chatgpt) |
501 |
/v1/messages |
Responses only (chatgpt) |
501 |
The two 501 rows share one gap: no conversion from a chat request to a
Responses request.
Expected logic:
- A client request arrives in any supported dialect.
- GoModel resolves the model to a provider, as today.
- GoModel checks which dialect the provider serves.
- If the dialects differ, GoModel converts the request to the provider
dialect. - GoModel converts the response back to the client dialect. Streaming
responses convert event by event. - Usage, budgets, cache, failover, and audit keep working on the canonical
request, as today.
Virtual models then work across API types. Load balancing can mix a chat-only
provider and a Responses-only provider in one pool.
Conversion must follow the existing Postel's Law rule: translate what is
portable, drop or reject what is not, and document the loss. Known hard
points:
- Some chat fields have no Responses equivalent, for example
n > 1and
logit_bias. Decide per field: convert, drop, or reject. - Usage shapes differ (
prompt_tokensagainstinput_tokens). Cost tracking
and budgets must see correct numbers. - The Codex backend accepts a strict parameter allowlist and streams only.
Thechatgptprovider already adapts this for direct Responses calls. The
translated path must reuse that adaptation. - Chat completions is stateless. Responses features that need server state
(previous_response_id, conversations) stay Responses-only.
I do not propose a specific implementation. Two directions look consistent
with the current design, for orientation:
- Mirror the existing adapter: add the reverse of
ResponsesViaChat, and
let Responses-only providers delegate their chat methods to it. - Make dispatch capability-aware: providers declare the dialects they serve,
and the gateway inserts conversion where dialects differ. This also lets
failover and virtual-model balancing prefer native targets.
Describe alternatives you've considered
- Keep the 501 and document it. Works for Codex itself. Does not work for
chat-only or Anthropic harnesses. - Put a shim in front of GoModel per client. Duplicates gateway work outside
the gateway. - Extend passthrough. Passthrough forwards bytes unchanged and cannot convert
dialects.chatgptis not in the passthrough allowlist. - Rely on failover. Failover skips the incompatible provider. Capacity stays
unused, and a pool with onlychatgpttargets still fails.
Additional context
- @SantiagoDePolonia asked for this to be moved to an issue from Discord DMs for broader evaluation.
- Implementation issue: #1084 specifies the first slice (chat to Responses
adapter pluschatgptprovider wiring, ID and chaining semantics). - Known translation-loss point: #1055 (tool
strictdropped on the Anthropic
and Gemini output paths). - Related material:
- ADR-0002: dialect translation belongs at the ingress boundary.
- ADR-0007: Anthropic Messages ingress, the same pattern for a third
dialect. docs/advanced/responses-compatibility.mdx: the existing compatibility
matrix. This feature adds the reverse direction.internal/providers/responses_adapter.go: the existing one-way adapter.internal/providers/responses_converter.go: the existing stream
converter for the Responses direction.- PR #718: the
chatgptprovider.
This issue was drafted with AI assistance (Kimi Code CLI). The AI analyzed
the codebase at commit0a174082.
- Lingua principale
- Go
- Stelle
- 1.2k
- Fork
- 111
- Merge medio
- 14h 43m
- PR unite (30g)
- 142
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ENTERPILOT/GoModel
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
ENTERPILOT/GoModel#1182 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
ENTERPILOT/GoModel#1170 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
ENTERPILOT/GoModel#1165 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 35/100
ENTERPILOT/GoModel#1154 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ENTERPILOT/GoModel#1107 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ENTERPILOT/GoModel
Issue simili
-
oss/0 pending team/container-integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DataDog/datadog-agent#58323 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
kubernetes-sigs/external-dns#6816 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
ANSI translator ignores SGR 22/24 (and other attribute-off codes): bold and underline never turn offAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100