-
Notifications
You must be signed in to change notification settings - Fork 1.5k
docs: add Responses API reference #2440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -491,6 +491,135 @@ Revoke one of the authenticated user's tokens. Users can only revoke their own t | |||||||||
|
|
||||||||||
| --- | ||||||||||
|
|
||||||||||
| ## Responses API | ||||||||||
|
|
||||||||||
| Routes through the full agent loop — tools, memory, safety, and server-side conversation state are all active. Compatible with any standard OpenAI SDK via `client.responses.create()`. | ||||||||||
|
|
||||||||||
| **Auth:** Any authenticated user (`Authorization: Bearer <token>`) | ||||||||||
|
|
||||||||||
| ### POST /v1/responses | ||||||||||
|
|
||||||||||
| Create a response. | ||||||||||
|
|
||||||||||
| **Request body:** | ||||||||||
|
|
||||||||||
| ```json | ||||||||||
| { | ||||||||||
| "model": "claude-sonnet-4-5-20250514", | ||||||||||
| "input": "What's a good time to send money to India?", | ||||||||||
| "stream": true, | ||||||||||
| "previous_response_id": null | ||||||||||
| } | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| | Field | Type | Notes | | ||||||||||
| |-------|------|-------| | ||||||||||
| | `model` | string | LLM model to use. Pass `"default"` to use the server-configured model | | ||||||||||
| | `input` | string or array | User message as a string, or a messages array (see below) | | ||||||||||
| | `stream` | boolean | `true` for SSE, `false` for blocking (120s timeout) | | ||||||||||
| | `previous_response_id` | string | Pass the previous `id` to continue a conversation thread | | ||||||||||
|
Comment on lines
+506
to
+520
|
||||||||||
|
|
||||||||||
| **Messages array input:** `input` may be passed as an array instead of a string: | ||||||||||
|
|
||||||||||
| ```json | ||||||||||
| { | ||||||||||
| "model": "default", | ||||||||||
| "input": [ | ||||||||||
| { "role": "user", "content": "What is 2+2? Reply with just the number." } | ||||||||||
| ] | ||||||||||
| } | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| **Response (non-streaming):** `200 OK` | ||||||||||
|
|
||||||||||
| ```json | ||||||||||
| { | ||||||||||
| "id": "resp_<uuid>", | ||||||||||
| "object": "response", | ||||||||||
| "created_at": 1743000000, | ||||||||||
| "model": "claude-sonnet-4-5-20250514", | ||||||||||
|
||||||||||
| "model": "claude-sonnet-4-5-20250514", | |
| "model": "default", |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status can be in_progress during streaming (the server emits response.created with an in-progress response object), but the docs list only completed | failed. Please include in_progress as a possible status value (at least for streaming events).
| **Status values:** `completed` | `failed` | |
| **Status values:** `in_progress` | `completed` | `failed` | |
| For streaming responses, expect `status: "in_progress"` on the initial `response.created` event and until the response reaches a terminal state of `completed` or `failed`. |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs describe a x_context request field that is prepended to the user message and persisted, but the current Responses API request type does not accept/process x_context (unknown JSON fields are ignored and nothing is added to message metadata). Please either remove/mark this section as not yet supported, or implement x_context handling so the described behavior is true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section describes a "Structured context" feature using an x_context field that is not currently implemented in the backend. The ResponsesRequest struct in src/channels/web/responses_api.rs does not define an x_context field, and the handler does not contain logic to process it or prepend it to the user message as described. Additionally, the text states the context object is accepted within the input field, while the example shows x_context as a top-level field. This section should be removed or updated to reflect the actual capabilities of the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error list for the GET endpoint is missing the 503 Service Unavailable status code, which is returned by the implementation when the database is not configured (see src/channels/web/responses_api.rs, line 1061). Also, the 400 error on a GET request typically refers to an invalid response ID rather than "empty input."
| **Errors:** `400` (empty input), `401` (missing or invalid bearer token), `404` (response ID not found or not owned by caller), `500` (internal error) | |
| Errors: 400 (invalid response ID), 401 (missing or invalid bearer token), 404 (response ID not found or not owned by caller), 503 (database not configured), 500 (internal error) |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documented GET errors don’t match the handler behavior: 400 is returned for an invalid response_id format (not “empty input”), and 503 is possible when the database isn’t configured. Also, this endpoint returns OpenAI-style JSON errors ({ "error": { ... } }), which differs from the plain-text ## Error Format section below—please clarify the Responses API error shape here to avoid misleading clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The claim that this API is "Compatible with any standard OpenAI SDK via
client.responses.create()" is misleading. Official OpenAI SDKs (such as the Python and Node.js libraries) do not have aresponsesresource or acreatemethod under that name. While the request/response format may be similar to OpenAI's, users will need to use generic HTTP request methods (e.g.,client.post) to interact with this specific endpoint.