feat(gateway): add OpenResponses /v1/responses endpoint

Add a new `/v1/responses` endpoint implementing the OpenResponses API
standard for agentic workflows. This provides:

- Item-based input (messages, function_call_output, reasoning)
- Semantic streaming events (response.created, response.output_text.delta,
  response.completed, etc.)
- Full SSE event support with both event: and data: lines
- Configuration via gateway.http.endpoints.responses.enabled

The endpoint is disabled by default and can be enabled independently
from the existing Chat Completions endpoint.

Phase 1 implementation supports:
- String or ItemParam[] input
- system/developer/user/assistant message roles
- function_call_output items
- instructions parameter
- Agent routing via headers or model parameter
- Session key management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ryan LisseandClaude Opus 4.5 authored and Peter Steinberger committed 2026-01-20 07:37:01 +00:00
1 parent 7f6e87e918
commit f4b03599f0
11 files changed
+1563

No files matched your search

+9
View File
@@ -105,8 +105,17 @@ export type GatewayHttpChatCompletionsConfig = {
enabled?: boolean;
};
export type GatewayHttpResponsesConfig = {
/**
* If false, the Gateway will not serve `POST /v1/responses` (OpenResponses API).
* Default: false when absent.
*/
enabled?: boolean;
};
export type GatewayHttpEndpointsConfig = {
chatCompletions?: GatewayHttpChatCompletionsConfig;
responses?: GatewayHttpResponsesConfig;
};
export type GatewayHttpConfig = {
+6
View File
@@ -299,6 +299,12 @@ export const ClawdbotSchema = z
})
.strict()
.optional(),
responses: z
.object({
enabled: z.boolean().optional(),
})
.strict()
.optional(),
})
.strict()
.optional(),