Skip to navigation

Create a response (OpenAI Responses format)

Use this when your client speaks the OpenAI Responses API. The OpenAI Python SDK (client.responses.create) was checked against the hosted service. Codex CLI uses this format and has not been checked end to end.

The body is the OpenAI Responses request. Meadow reads model, models, provider and stream, removes models and provider, and passes everything else to the vendor. One exception: background: true returns 400 parameter_invalid with param background, because Meadow cannot record a call the vendor runs later. The rules for routing, fallback, limits, headers and streaming are in the Models section above.

Meadow keeps no response state. A request with previous_response_id depends on a response one vendor stored, so it must reach that same vendor: pin the vendor with a prefixed model id or with provider.only holding one provider, and send no models. Otherwise the call returns 400.

Scope: models.

curl -sS "$MEADOW_BASE_URL/v1/responses" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"grok-4.7","max_output_tokens":16,
"input":"Reply with the single word: meadow"}'

Streaming. With stream: true the response is text/event-stream with the Responses event names. Each data object carries a sequence_number and a type equal to the event name. The order is response.created, response.in_progress, then for each output item response.output_item.added, its content and delta events and response.output_item.done, then response.completed with the whole response and its usage. A reasoning model sends a reasoning item before the message item. A failed run ends with response.failed instead. Meadow relays that event and does not fall back. A captured stream, with the response objects shortened:

event: response.created
data: {"sequence_number":0,"type":"response.created","response":{"id":"00000000-084d","model":"grok-4.7","object":"response","output":[],"status":"in_progress","usage":null}}
event: response.in_progress
data: {"sequence_number":1,"type":"response.in_progress","response":{"id":"00000000-084d","model":"grok-4.7","object":"response","output":[],"status":"in_progress","usage":null}}
event: response.output_item.added
data: {"sequence_number":2,"type":"response.output_item.added","item":{"id":"rs_000070ec-7239","summary":[],"type":"reasoning","status":"in_progress"},"output_index":0}
event: response.output_item.done
data: {"sequence_number":3,"type":"response.output_item.done","item":{"id":"rs_000070ec-7239","summary":[],"type":"reasoning","status":"completed","encrypted_content":"nchbsDNCdckZM4lXT2VjmLJaL2CRHq+XECo1rZikAh5nCFArCUWMyq3R5KhxEOmL1nDuTQJSv+2zL8ap7OrRsXcik2lLqudKJ4g05r5HQ+0BHUwKXdCmV/Ns1phmOI8NXnv/4N/3LNQ5sNe2J4Th73h+PYr3cqW47HQLAoogCWDDqgK+4Ux/5J08IFqk7fH/n0ybGQK3xWdtfHlpRDX6V5Blf2OPPhBJ0ygCaItFrEhTWDPemg"},"output_index":0}
event: response.output_item.added
data: {"sequence_number":4,"type":"response.output_item.added","item":{"content":[],"id":"msg_000070ec-7239","role":"assistant","type":"message","status":"in_progress"},"output_index":1}
event: response.content_part.added
data: {"sequence_number":5,"type":"response.content_part.added","content_index":0,"item_id":"msg_000070ec-7239","output_index":1,"part":{"type":"output_text","text":""}}
event: response.output_text.delta
data: {"sequence_number":6,"type":"response.output_text.delta","content_index":0,"delta":"me","item_id":"msg_000070ec-7239","output_index":1}
event: response.output_text.delta
data: {"sequence_number":7,"type":"response.output_text.delta","content_index":0,"delta":"adow","item_id":"msg_000070ec-7239","output_index":1}
event: response.output_text.done
data: {"sequence_number":8,"type":"response.output_text.done","content_index":0,"item_id":"msg_000070ec-7239","output_index":1,"text":"meadow"}
event: response.content_part.done
data: {"sequence_number":9,"type":"response.content_part.done","content_index":0,"item_id":"msg_000070ec-7239","output_index":1,"part":{"type":"output_text","text":"meadow"}}
event: response.output_item.done
data: {"sequence_number":10,"type":"response.output_item.done","item":{"content":[{"type":"output_text","text":"meadow"}],"id":"msg_000070ec-7239","role":"assistant","type":"message","status":"completed"},"output_index":1}
event: response.completed
data: {"sequence_number":11,"type":"response.completed","response":{"id":"00000000-084d","model":"grok-4.7","object":"response","output":[...],"status":"completed","usage":{"input_tokens":1249,"output_tokens":35,"total_tokens":1284}}}

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Request

An OpenAI Responses request, plus the optional Meadow fields models and provider. At most 16 MiB.

modelstringRequired
A plain or prefixed model id. Same rules as Chat Completions.
inputanyRequired

The input, in the Responses format: a string or an array of items. Required and not null. Passed through unchanged.

modelslist of stringsOptional

Fallback models, at most 3. Same rules as Chat Completions. Not allowed with previous_response_id.

providerobjectOptional

Which model providers may serve a request, and in what order. Send it as provider on a model request, or store it on a project as routing.models. The field names follow OpenRouter’s provider object. A field set on the request replaces the same field from the project. Fields the request leaves out keep the project’s value. Every entry must be a model provider. An unknown field returns 400.

streambooleanOptionalDefaults to false

When true, the response is a server-sent event stream.

Response headers

x-meadow-providerstringOptional

The provider that answered, for example anthropic. Present on a 200 and on a vendor error that was passed through.

x-meadow-modelstringOptional
The vendor's own id for the model that answered.
x-meadow-attemptsintegerOptional
The number of vendors tried, including the one that answered. A value above 1 means a fallback happened.
x-meadow-routestringOptional

Why this vendor answered, in stable codes only. direct: <vendor> when the first vendor in the route served the call. fallback: <vendor> <reason> -> <vendor> when an earlier vendor failed, with the same reason codes as attempts[].reason in an error body. failed: ... on a vendor error passed through. It never carries vendor error text.

x-meadow-provider-auth-failedstringOptional

Comma-separated providers that rejected your stored credential during this request (HTTP 401 or 403, or a failed token exchange). Absent when none did. Replace the provider key for each one named.

x-meadow-abandoned-attemptsstringOptional

Comma-separated providers that received the request and may bill for it, but whose response was not used (a timeout or broken connection after the request was sent, or an unusable 200 body). Absent when there are none.

x-request-idstringOptional

Meadow’s id for this request, req_ and 24 hex characters. Every response carries it, including errors, streams and unknown routes. Every error in the Error schema repeats it as request_id. Quote it when you report a problem.

x-meadow-provider-request-idstringOptional

The request id of the vendor that answered, taken from its x-request-id, request-id, x-amzn-requestid, apim-request-id or x-generation-id header, the first one present in that order. Use it with that vendor’s support. Vendors tried before a fallback are not listed. Absent when the vendor sent none.

x-gemini-service-tierstringOptional

The service tier Google served this call on, returned as Google sent it, on a served call answered by google. standard, priority or flex. standard after a request with service_tier priority means Google downgraded it and bills it at the standard rate. Absent when another provider served the call or Google sent none.

x-amzn-bedrock-service-tierstringOptional

The service tier Bedrock served this call on, returned as Bedrock sent it, on a served call answered by bedrock. default, priority, flex or reserved. Absent when another provider served the call or Bedrock sent none.

Response

The vendor’s Responses object, or its event stream when stream is true.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
413
Content Too Large Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error