> For the list of every page, fetch /llms.txt. The API contract is the OpenAPI file linked from the API reference.

# Create a response (OpenAI Responses format)

POST https%3A%2F%2Fapi.usemeadow.ai/v1/responses
Content-Type: application/json

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`.

```bash
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:

```text
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}}}
```

Reference: https://docs.usemeadow.ai/api-endpoints/models/create-response

## Authentication

- `Authorization` header (bearer token, required) — A Meadow API key, sent as `Authorization: Bearer mdw_...`. The header `x-api-key: mdw_...` is accepted in its place.

## Request

### Body (application/json)

This endpoint expects a ResponsesRequest.

- `model` (string, required) — A plain or prefixed model id. Same rules as Chat Completions.
- `input` (any, required) — The input, in the Responses format: a string or an array of items. Required and not null. Passed through unchanged.
- `models` (list of string, optional) — Fallback models, at most 3. Same rules as Chat Completions. Not allowed with `previous_response_id`.
- `provider` (ModelRouting, optional) — 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.
- `stream` (boolean, optional, default: false) — When true, the response is a server-sent event stream.

## Response

### 200

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

- `map from string to any`

## Errors

### 400 Bad Request Error

Either Meadow refused the request, or the vendor did. A Meadow 400 is in the format's own envelope (`ModelRouteError`). A vendor 400 has the vendor's own body and carries `x-meadow-provider`. Fix the request before you send it again.

- `any`

### 401 Unauthorized Error

The key is missing, malformed, unknown, revoked, or expired, or a key it was minted from no longer exists. Check the key and the header. The body is in the format's own envelope, and `error.code` says which case it is.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 402 Payment Required Error

A dollar `limit` stops the call: the key, or a key above it, has spent its `limit`, or the estimate this call reserves would pass it. No vendor was called and nothing was charged. There is no `retry-after` header, because the wait is until the limit resets or is raised. Do not retry: raise the `limit` with `PATCH /v1/keys/{key_id}`, wait for `limit_reset_at`, or lower the request's output cap. The body is in the format's own envelope: the type is `insufficient_quota` on an OpenAI-format route and `billing_error` on `/v1/messages`. The same 402 with `error.code` `budget_exceeded` means a budget with `hard_limit` on the project or on the account has reached its `limit_usd`, or this call's estimate does not fit what is left of it. Raise `limit_usd`, switch `hard_limit` off, or wait for the budget's `resets_at`.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 403 Forbidden Error

The key may not make this call: it lacks the `models` scope, the model is not in its `allowed_models` or those of a key above it (`key_model_access_denied`), no provider in the route is in its `allowed_providers` (`key_provider_access_denied`), a request or token limit is used up, a dollar `limit` applies and the route includes a provider with no price (`key_spend_price_unknown`), or the project is locked and the request tried to override its routing. The body is in the format's own envelope.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 404 Not Found Error

The model id was not found, by Meadow or by the vendor. - Meadow cannot resolve a plain model id: it is not in `GET /v1/models`, and it is not an id of the `claude-`, `gpt-`, `gemini-` or `grok-` family on a project with that vendor's key. The body is in the format's own envelope (`ModelRouteError`) with `error.code` `model_not_found` and `error.param` `model`. The message names the id, lists up to three close ids the key can call, and shows how to pin a provider. No vendor was called. Earlier builds returned 400 with `error.code` `parameter_invalid`. - The vendor does not know the model id: a pinned id, or a plain id on a route with only one vendor (earlier builds: a 502). The body is the vendor's own and does not follow the `Error` schema. The response carries `x-meadow-provider`. Check the part of the model id after the provider prefix, or whether that vendor still serves the model.

- `any`

### 413 Content Too Large Error

The request body is larger than the 16 MiB the model routes allow. The body is in the format's own envelope.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 422 Unprocessable Entity Error

No stored provider key can serve this model in this format. Store a key for a provider that `GET /v1/models` would list for it, check that key's `project_ids`, or loosen `provider.only` and `provider.ignore`. The body is in the format's own envelope, with `error.code` `no_provider_key`.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 429 Too Many Requests Error

Too many requests. Either the server instance was full and no slot came free for the account within 3 seconds (`account_in_flight_limit_exceeded`), or the key's limit check waited too long (`key_limit_check_busy`), or the last vendor tried was rate limited, or too many failed authentications came from your address. Wait for `retry-after` seconds, then retry with backoff. The body is in the format's own envelope.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 500 Internal Server Error

Meadow failed. Do not resend a model call blindly: a vendor may have received it. Tell us if it persists. The body is in the format's own envelope.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

### 502 Bad Gateway Error

No vendor served the request. `attempts` lists each vendor tried and how it failed. `all_providers_failed` means the whole route was tried. `provider_error` means fallbacks were off (`allow_fallbacks: false`) and the one vendor failed, or a limited key ran out of time. A 404 from the only vendor in the route is not a 502: the vendor's 404 comes back as written. Retry with backoff. Read `x-meadow-provider-auth-failed` to find a stored key a vendor rejected, and `x-meadow-abandoned-attempts` for vendors that may bill for the call anyway. The body is in the format's own envelope: `error.type` is `server_error` or `api_error`, and `error.code` keeps `all_providers_failed` or `provider_error`.

- `ModelRouteError`
  - OpenAIError: OpenAIError
  - AnthropicError: AnthropicError

## Types

### ModelRouting

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.

- `order` (list of enum, optional) — Providers to try first, in this order. Providers not named are still tried afterwards, in the default order. When neither the request nor the project sets it, Meadow uses the model's own vendor, then hosts (`azure`, `bedrock`, `vertex`, `fireworks`), then `openrouter`. Providers the account has no key for are skipped.
  - Allowed values: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`, `daytona`, `modal`
- `only` (list of enum, optional) — Use only these providers. Others are never tried.
  - Allowed values: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`, `daytona`, `modal`
- `ignore` (list of enum, optional) — Never use these providers.
  - Allowed values: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`, `daytona`, `modal`
- `allow_fallbacks` (boolean, optional, default: true) — When false, only the first provider is tried, and the ids in `models` are not tried.

### OpenAIError

An error in OpenAI's envelope, `{"error": {"message", "type", "param", "code"}}`. The OpenAI SDKs pick the error class from the HTTP status and expose these four fields. `attempts` and `request_id` are Meadow's additions.

- `error` (OpenAiErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. The OpenAI SDKs read the header.

### AnthropicError

An error in Anthropic's envelope, `{"type": "error", "error": {"type", "message"}, "request_id"}`. The Anthropic SDKs pick the error class from the HTTP status and expose `error.type` as `type` and `error.details.error_code` as `error_code`. `code`, `param` and `attempts` inside `error` are Meadow's additions.

- `type` (enum, required)
  - Allowed values: `error`
- `request_id` (string, required, nullable) — The same id as the `request-id` and `x-request-id` response headers.
- `error` (AnthropicErrorError, required)

### OpenAiErrorError

- `message` (string, required) — A sentence for people. It can change, so do not match on it.
- `type` (enum, required) — OpenAI's class for the failure: `invalid_request_error` for a 400, 401, 403, 404, 405, 409, 413 or 422, `insufficient_quota` for a 402, `rate_limit_error` for a 429, `server_error` for a 500, 501 or 502, and `service_unavailable_error` for a 503.
  - Allowed values: `invalid_request_error`, `insufficient_quota`, `rate_limit_error`, `server_error`, `service_unavailable_error`
- `param` (string, required, nullable) — The request field or header at fault, or null. Set on most validation errors.
- `code` (string, required, nullable) — Meadow's stable code for the specific failure, the same value as `error.code` on every other route. The Errors guide lists them.
- `attempts` (list of Attempt, optional) — The vendors Meadow tried for this request, in order. Present only when it tried at least one.

### AnthropicErrorError

- `type` (enum, required) — Anthropic's class for the failure: `invalid_request_error` (400, 405, 422), `authentication_error` (401), `billing_error` (402), `permission_error` (403), `not_found_error` (404), `conflict_error` (409), `request_too_large` (413), `rate_limit_error` (429) and `api_error` (500, 501, 502, 503).
  - Allowed values: `invalid_request_error`, `authentication_error`, `billing_error`, `permission_error`, `not_found_error`, `conflict_error`, `request_too_large`, `rate_limit_error`, `api_error`
- `message` (string, required) — A sentence for people. It can change, so do not match on it.
- `details` (AnthropicErrorErrorDetails, optional) — Where Anthropic's format carries an error code.
- `code` (string, optional) — Meadow's stable code for the specific failure, the same value as `error.code` on every other route. The Errors guide lists them.
- `param` (string, optional) — The request field or header at fault, when there is one.
- `attempts` (list of Attempt, optional) — The vendors Meadow tried for this request, in order. Present only when it tried at least one.

### Attempt

One try at one vendor, for a model call or a sandbox create.

- `provider` (enum, required) — The name of a vendor. Model providers and sandbox providers share one list. Model providers: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`. Sandbox providers: `daytona`, `modal`.
  - Allowed values: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`, `daytona`, `modal`
- `outcome` (enum, required) — How the try ended. - `served`: this vendor served the request. - `unsupported`: the vendor cannot do what was asked, such as a resource size, a network rule, or a model it does not offer. - `refused`: the vendor rejected the request or the stored credential. - `no_capacity`: the vendor had no capacity. - `timeout`: the vendor did not answer in time. - `rate_limited`: the vendor answered 429. - `error`: any other failure.
  - Allowed values: `served`, `unsupported`, `refused`, `no_capacity`, `timeout`, `rate_limited`, `error`
- `reason` (enum, optional) — A stable code for why the try ended as it did. It is narrower than `outcome`, and it is the code to branch on or to count. More values can be added: treat one you do not know like `vendor_error`. - `served`: this vendor served the request. - `no_capacity`: the vendor had no capacity. - `quota_exceeded`: the vendor account is out of quota or credit. - `rate_limited`: the vendor answered 429. - `timeout`: the vendor did not answer in time. - `auth_failed`: the vendor rejected the stored vendor key. - `invalid_request`: the vendor rejected the request itself. - `refused`: the vendor refused for another reason. - `unsupported`: the vendor cannot do what was asked, such as a model, a GPU type, a size or a network rule. - `no_provider_key`: skipped, because no usable vendor key was stored. - `image_pull_failed`, `build_failed`: the vendor could not pull or build the image (sandboxes). - `provider_lost`: the vendor lost the sandbox while it was starting. - `vendor_error`: any other failure.
  - Allowed values: `served`, `no_capacity`, `quota_exceeded`, `rate_limited`, `timeout`, `auth_failed`, `invalid_request`, `refused`, `unsupported`, `no_provider_key`, `image_pull_failed`, `build_failed`, `provider_lost`, `vendor_error`
- `started_at` (datetime, optional) — When Meadow started this try. Absent on attempts recorded before 2026-11-24.
- `finished_at` (datetime, optional) — When this try ended.
- `detail` (string, optional) — A short description of what happened, written by Meadow, such as `provider returned HTTP 404`. On a `served` sandbox attempt it reports resources the vendor granted that differ from the request, such as `provider granted cpu 2 instead of 1.5` or `gpu type H200 instead of H100`. It says `provider built a copy of the image for this size` when this create made a new Daytona snapshot for an `image_id`. On an `unsupported` attempt it carries the vendor's size limit, such as `daytona cannot serve this size: CPU request 8 exceeds maximum allowed per sandbox (4)`. Absent when there is nothing to say.
- `duration_ms` (integer, optional) — How long the try took, in milliseconds.

### AnthropicErrorErrorDetails

Where Anthropic's format carries an error code.

- `error_code` (string, optional) — The same value as `code`. The Anthropic SDKs expose it as `error_code`.

## Examples

### Served by xAI (reasoning item and settings left out)

**Response**

```json
{
  "completed_at": 1795472358,
  "created_at": 1795472356,
  "id": "00000000-e327",
  "max_output_tokens": 16,
  "model": "grok-4.7",
  "object": "response",
  "output": [
    {
      "content": [
        {
          "annotations": [],
          "logprobs": [],
          "text": "meadow",
          "type": "output_text"
        }
      ],
      "id": "msg_0000e4a4-c16c",
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "previous_response_id": null,
  "status": "completed",
  "usage": {
    "input_tokens": 1249,
    "output_tokens": 244,
    "total_tokens": 1493
  }
}
```

**SDK Code**

```python Served by xAI (reasoning item and settings left out)
import requests

url = "https://api.example.com/v1/responses"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Served by xAI (reasoning item and settings left out)
const url = 'https://api.example.com/v1/responses';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Served by xAI (reasoning item and settings left out)
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/responses"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Served by xAI (reasoning item and settings left out)
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/responses")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Served by xAI (reasoning item and settings left out)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/responses")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Served by xAI (reasoning item and settings left out)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/responses', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Served by xAI (reasoning item and settings left out)
using RestSharp;

var client = new RestClient("https://api.example.com/v1/responses");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Served by xAI (reasoning item and settings left out)
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/responses")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Let Meadow pick the vendor

**Request**

```json
{
  "model": "grok-4.7",
  "input": null,
  "max_output_tokens": 16
}
```

**Response**

```json
{
  "completed_at": 1795472358,
  "created_at": 1795472356,
  "id": "00000000-e327",
  "max_output_tokens": 16,
  "model": "grok-4.7",
  "object": "response",
  "output": [
    {
      "content": [
        {
          "annotations": [],
          "logprobs": [],
          "text": "meadow",
          "type": "output_text"
        }
      ],
      "id": "msg_0000e4a4-c16c",
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "previous_response_id": null,
  "status": "completed",
  "usage": {
    "input_tokens": 1249,
    "output_tokens": 244,
    "total_tokens": 1493
  }
}
```

**SDK Code**

```python Let Meadow pick the vendor
import requests

url = "https://api.example.com/v1/responses"

payload = {
    "model": "grok-4.7",
    "input": None,
    "max_output_tokens": 16
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Let Meadow pick the vendor
const url = 'https://api.example.com/v1/responses';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"grok-4.7","input":null,"max_output_tokens":16}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Let Meadow pick the vendor
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/responses"

	payload := strings.NewReader("{\n  \"model\": \"grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Let Meadow pick the vendor
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/responses")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16\n}"

response = http.request(request)
puts response.read_body
```

```java Let Meadow pick the vendor
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/responses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16\n}")
  .asString();
```

```php Let Meadow pick the vendor
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/responses', [
  'body' => '{
  "model": "grok-4.7",
  "input": null,
  "max_output_tokens": 16
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Let Meadow pick the vendor
using RestSharp;

var client = new RestClient("https://api.example.com/v1/responses");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Let Meadow pick the vendor
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "grok-4.7",
  "input": ,
  "max_output_tokens": 16
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/responses")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Continue a stored response on one pinned vendor

**Request**

```json
{
  "model": "xai/grok-4.7",
  "input": null,
  "max_output_tokens": 16,
  "previous_response_id": "00000000-e327"
}
```

**Response**

```json
{
  "completed_at": 1795472358,
  "created_at": 1795472356,
  "id": "00000000-e327",
  "max_output_tokens": 16,
  "model": "grok-4.7",
  "object": "response",
  "output": [
    {
      "content": [
        {
          "annotations": [],
          "logprobs": [],
          "text": "meadow",
          "type": "output_text"
        }
      ],
      "id": "msg_0000e4a4-c16c",
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "previous_response_id": null,
  "status": "completed",
  "usage": {
    "input_tokens": 1249,
    "output_tokens": 244,
    "total_tokens": 1493
  }
}
```

**SDK Code**

```python Continue a stored response on one pinned vendor
import requests

url = "https://api.example.com/v1/responses"

payload = {
    "model": "xai/grok-4.7",
    "input": None,
    "max_output_tokens": 16,
    "previous_response_id": "00000000-e327"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Continue a stored response on one pinned vendor
const url = 'https://api.example.com/v1/responses';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"xai/grok-4.7","input":null,"max_output_tokens":16,"previous_response_id":"00000000-e327"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Continue a stored response on one pinned vendor
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/responses"

	payload := strings.NewReader("{\n  \"model\": \"xai/grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16,\n  \"previous_response_id\": \"00000000-e327\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Continue a stored response on one pinned vendor
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/responses")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"xai/grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16,\n  \"previous_response_id\": \"00000000-e327\"\n}"

response = http.request(request)
puts response.read_body
```

```java Continue a stored response on one pinned vendor
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/responses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"xai/grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16,\n  \"previous_response_id\": \"00000000-e327\"\n}")
  .asString();
```

```php Continue a stored response on one pinned vendor
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/responses', [
  'body' => '{
  "model": "xai/grok-4.7",
  "input": null,
  "max_output_tokens": 16,
  "previous_response_id": "00000000-e327"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Continue a stored response on one pinned vendor
using RestSharp;

var client = new RestClient("https://api.example.com/v1/responses");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"xai/grok-4.7\",\n  \"input\": null,\n  \"max_output_tokens\": 16,\n  \"previous_response_id\": \"00000000-e327\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Continue a stored response on one pinned vendor
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "xai/grok-4.7",
  "input": ,
  "max_output_tokens": 16,
  "previous_response_id": "00000000-e327"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/responses")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```