mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
feat(gateway): add OpenAI Responses API endpoints
Add POST /v1/responses and GET /v1/responses/{id} to the web gateway,
implementing the OpenAI Responses API. Unlike the existing Chat
Completions proxy which passes through to the raw LLM, the Responses
API routes requests through the full agent loop — giving external
clients access to tools, memory, safety, and server-side conversation
state via a standard OpenAI-compatible interface.
Key design decisions:
- Response IDs encode thread UUIDs statelessly (resp_{uuid_simple})
- previous_response_id enables multi-turn conversations
- Streaming maps AppEvent variants to Responses API SSE events
- Tool approval returns response.failed (no interactive approval flow)
- GET endpoint reconstructs ResponseObject from conversation_messages
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
committed by
Pranav Raja
co-authored by
Claude Opus 4.6
parent
e808fbaf54
commit
6691f1408a
@@ -18,6 +18,7 @@ pub mod auth;
|
||||
pub(crate) mod handlers;
|
||||
pub mod log_layer;
|
||||
pub mod openai_compat;
|
||||
pub mod responses_api;
|
||||
pub mod server;
|
||||
pub mod sse;
|
||||
pub mod types;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -571,6 +571,15 @@ pub async fn start_server(
|
||||
post(super::openai_compat::chat_completions_handler),
|
||||
)
|
||||
.route("/v1/models", get(super::openai_compat::models_handler))
|
||||
// OpenAI Responses API (routes through the full agent loop)
|
||||
.route(
|
||||
"/v1/responses",
|
||||
post(super::responses_api::create_response_handler),
|
||||
)
|
||||
.route(
|
||||
"/v1/responses/{id}",
|
||||
get(super::responses_api::get_response_handler),
|
||||
)
|
||||
.route_layer(middleware::from_fn_with_state(
|
||||
auth_state.clone(),
|
||||
auth_middleware,
|
||||
|
||||
Reference in New Issue
Block a user