Skip to content

feat(server): add stateless OpenAI Responses API - #32

Open
Iwctwbh wants to merge 1 commit into
Headmaster218:mainfrom
Iwctwbh:codex/responses-api
Open

feat(server): add stateless OpenAI Responses API#32
Iwctwbh wants to merge 1 commit into
Headmaster218:mainfrom
Iwctwbh:codex/responses-api

Conversation

@Iwctwbh

@Iwctwbh Iwctwbh commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add POST /v1/responses as a stateless compatibility layer over the existing chat dispatch path
  • support non-streaming Responses JSON and typed SSE lifecycle events for text, reasoning summaries, and custom function calls
  • support replay of message, reasoning-summary, function_call, and function_call_output input items
  • preserve request metadata (instructions, tools, tool choice, token limit, temperature, top-p, text verbosity, metadata) in response objects
  • report full input usage plus KV-cached tokens through input_tokens_details

Explicit capability boundaries

Unsupported semantics return an OpenAI-shaped 400 instead of being silently ignored:

  • previous_response_id, conversation, and store=true
  • truncation="auto"
  • image/file content and opaque reasoning without a readable summary
  • hosted tools such as web/file search
  • structured JSON output formats
  • parallel_tool_calls=false

The supported path is deliberately stateless: clients replay prior message and function-call items in input and use store=false.

Protocol compatibility

The SSE order and object shapes follow the official OpenAI Responses lifecycle for text and function calls:

  • response.created / response.in_progress
  • response.output_item.added
  • content or function-arguments delta/done events
  • response.output_item.done
  • response.completed or response.incomplete

Reference: https://developers.openai.com/api/reference/typescript/resources/beta/subresources/responses/methods/create

I also checked the lifecycle against the local DeepSeek Harness Responses fixture at cd5ef81481; focused tests cover both its text and function-call flows.

Scope

Extracted from #6 and rebuilt on current main (3901476d). This PR contains no metrics endpoint and no ToolCallStart change.

Verification

  • cargo check --workspace --all-targets
  • cargo test -p infr-server -p infr-chat (94 + 58 unit tests, plus 5 integration tests)
  • cargo fmt --check
  • git diff --check

Clippy was not run because the current Rust toolchain does not have the Clippy component installed.

Add non-streaming and typed SSE Responses output on the existing chat dispatch path, including function-tool round trips, request metadata, cached-token usage, and explicit errors for unsupported stateful or multimodal features.
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