Support OpenAI Chat Completions API as a complement to the existing Responses API
Feature Request
Summary
Add support for the OpenAI Chat Completions API (POST /v1/chat/completions) as a complement to the currently supported Responses API.
Motivation
The Chat Completions API is the most widely used OpenAI-compatible interface and serves as the standard for many third-party clients and frameworks (e.g., LangChain, OpenAI SDKs, various chat UIs). Supporting it would greatly broaden compatibility and allow more developers to integrate sub2api into their existing workflows without modifications.
Proposed Behavior
- Add a
/v1/chat/completionsendpoint that accepts standard OpenAI Chat Completions request payloads. - Support both streaming (
stream: true) and non-streaming responses. - Route requests appropriately to the underlying model providers (Claude, Gemini, etc.) via the existing middleware/translation layer.
- Preserve full compatibility with the existing Responses API — this is intended as an additive feature, not a replacement.
Expected Request Format
{
"model": "claude-3-5-sonnet",
"messages": [
{ "role": "user", "content": "Hello!" }
],
"stream": false
}
Additional Context
- This would make sub2api more plug-and-play for users already using OpenAI-compatible tools.
- Could also improve cost-sharing and carpooling scenarios by enabling more client diversity.
agree!
agree!
agree!
强烈同意
agree!
agree !强烈同意!
强烈同意
agree!
强烈建议!
agree !强烈同意! +1
Unsupported legacy protocol: /v1/chat/completions is not supported. Please use /v1/responses. {"error":{"message":"Unsupported legacy protocol: /v1/chat/completions is not supported. Please use /v1/responses.","type":"invalid_request_error"}}
Strongly agree!
同意
https://github.com/Wei-Shaw/sub2api/pull/648
我看有人提 pr 了
#926 已经合并了