You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
api/apps/api-server/src/routes/application_public_api/mod.rs:25-38 currently mounts OpenAI Chat Completions compatible routes such as /chat/completions, /v1/chat/completions, model-list aliases, and Anthropic /v1/messages.
api/crates/control-plane/src/application_public_api/compat/openai.rs:41-120 maps Chat Completions request shape into NativeRunRequest with query, model, history, conversation, response_mode, metadata, and compatibility_mode.
api/crates/control-plane/src/application_public_api/run_service.rs:326-356 binds native public conversations from native request fields; external protocols must not own a second conversation truth layer.
api/apps/api-server/src/application_public_docs.rs:1504-1522 currently documents /v1/chat/completions, /v1/models, and /v1/messages, but no /v1/responses operation.
Suspected Problems
Chat Completions compatible clients do not get a protocol-native continuation cursor that maps cleanly to the next call, so callers may manually maintain 1flowbase conversation identifiers.
Adding OpenAI Responses naively could accidentally make previous_response_id or OpenAI response state a second source of truth.
Non-negotiable Invariants
1flowbase Native API, native run records, native runtime events, and native conversation semantics are the only truth layer.
OpenAI Chat Completions, OpenAI Responses, and Anthropic protocols are adapter projections only.
Existing Chat Completions-compatible endpoints must keep working.
previous_response_id is an external protocol cursor only; it must resolve back to 1flowbase native run/conversation/history semantics and must not introduce an OpenAI-owned conversation store.
stream: true must use native streaming as the event source and only translate the outer SSE event shape.
Draft Hypotheses
/v1/responses can be implemented as a new OpenAI-compatible route and mapping module that creates native public runs with compatibility_mode = openai-responses-v1.
The Responses id can safely be derived from the 1flowbase native run id, then accepted later as previous_response_id after validating it belongs to the same API key/application through native public run lookup.
If the native layer lacks enough previous-run context for continuation, the smallest acceptable fix is to add native-first continuation support, then project it through the Responses adapter.
Open Decisions
Keep /v1/responses as the only new Responses endpoint in this task. Do not add /openai/v1/responses unless the issue is updated.
Add /openai/v1/chat/completions as the requested prefixed Chat Completions alias while preserving existing Chat Completions routes. Do not remove old aliases.
/openai/v1/models is not in this task unless implementation evidence shows the prefixed Chat Completions route is unusable for common clients without the matching model-list alias.
Bad Solutions
Creating a separate OpenAI conversation/session table.
Treating previous_response_id as internal truth instead of resolving it to native run state.
Translating Chat Completions chunks directly as Responses SSE without checking native event semantics.
Changing model-provider runtime protocol or LLM node behavior to satisfy only the OpenAI adapter.
Acceptance Evidence
Existing /v1/chat/completions, /chat/completions, and /v1/models compatible route tests still pass.
POST /openai/v1/chat/completions accepts the same body and auth behavior as existing Chat Completions and returns the same compatible response shape.
POST /v1/responses supports blocking text input mapped through native run creation and returns an OpenAI Responses-shaped object whose id is derived from the native run id.
POST /v1/responses with previous_response_id can continue from a prior Responses call without the caller manually sending a 1flowbase conversation id, while still using native run/history/conversation semantics.
POST /v1/responses with stream: true emits Responses-shaped SSE events projected from native streaming events.
API docs list the new Responses operation and the prefixed Chat Completions alias if docs are expected to expose aliases.
Issue Metadata
[讨论]新增 OpenAI Responses 兼容映射入口type:feature,area:api,area:backend,level:l3,grade:g3,priority:p1,risk:high,size:m,phase:discussion,contract,needs-backend,needs-qa,child-issueObserved Facts
api/apps/api-server/src/routes/application_public_api/mod.rs:25-38currently mounts OpenAI Chat Completions compatible routes such as/chat/completions,/v1/chat/completions, model-list aliases, and Anthropic/v1/messages.api/crates/control-plane/src/application_public_api/compat/openai.rs:41-120maps Chat Completions request shape intoNativeRunRequestwithquery,model,history,conversation,response_mode,metadata, andcompatibility_mode.api/crates/control-plane/src/application_public_api/run_service.rs:326-356binds native public conversations from native request fields; external protocols must not own a second conversation truth layer.api/apps/api-server/src/application_public_docs.rs:1504-1522currently documents/v1/chat/completions,/v1/models, and/v1/messages, but no/v1/responsesoperation.Suspected Problems
previous_response_idor OpenAI response state a second source of truth.Non-negotiable Invariants
previous_response_idis an external protocol cursor only; it must resolve back to 1flowbase native run/conversation/history semantics and must not introduce an OpenAI-owned conversation store.stream: truemust use native streaming as the event source and only translate the outer SSE event shape.Draft Hypotheses
/v1/responsescan be implemented as a new OpenAI-compatible route and mapping module that creates native public runs withcompatibility_mode = openai-responses-v1.idcan safely be derived from the 1flowbase native run id, then accepted later asprevious_response_idafter validating it belongs to the same API key/application through native public run lookup.Open Decisions
/v1/responsesas the only new Responses endpoint in this task. Do not add/openai/v1/responsesunless the issue is updated./openai/v1/chat/completionsas the requested prefixed Chat Completions alias while preserving existing Chat Completions routes. Do not remove old aliases./openai/v1/modelsis not in this task unless implementation evidence shows the prefixed Chat Completions route is unusable for common clients without the matching model-list alias.Bad Solutions
previous_response_idas internal truth instead of resolving it to native run state.Acceptance Evidence
/v1/chat/completions,/chat/completions, and/v1/modelscompatible route tests still pass.POST /openai/v1/chat/completionsaccepts the same body and auth behavior as existing Chat Completions and returns the same compatible response shape.POST /v1/responsessupports blocking text input mapped through native run creation and returns an OpenAI Responses-shaped object whose id is derived from the native run id.POST /v1/responseswithprevious_response_idcan continue from a prior Responses call without the caller manually sending a 1flowbase conversation id, while still using native run/history/conversation semantics.POST /v1/responseswithstream: trueemits Responses-shaped SSE events projected from native streaming events.Execution Boundary
api/apps/api-server/src/routes/application_public_api/mod.rsapi/apps/api-server/src/routes/application_public_api/openai.rsor a new sibling Responses route moduleapi/crates/control-plane/src/application_public_api/compat/openai.rsor a new Responses mapping moduleapi/apps/api-server/src/routes/application_public_api/compat_sse.rs/ native SSE projection code if streaming output needs a Responses event shapeapi/apps/api-server/src/application_public_docs.rsapi/apps/api-server/src/_tests/application_public_api/compat_routes.rsapi/apps/api-server/src/_tests/application/application_api_docs_routes.rsapplication_public_api::compat_routesLifecycle
phase:discussionphase:readybefore implementation.