> ## Documentation Index
> Fetch the complete documentation index at: https://opentouter.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ResponsesRequest - TypeScript SDK

> ResponsesRequest type definition

<Warning>
  The TypeScript SDK and docs are currently in beta.
  Report issues on [GitHub](https://github.com/OpenRouterTeam/typescript-sdk/issues).
</Warning>

Request schema for Responses endpoint

## Example Usage

```typescript lines theme={null}
import { ResponsesRequest } from "@openrouter/sdk/models";

let value: ResponsesRequest = {};
```

## Fields

| Field                 | Type                                                                                                               | Required             | Description                                                                                                                                                                                                                                                                                                                                                                                                          | Example                                                                                                            |
| --------------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `background`          | *boolean*                                                                                                          | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `cacheControl`        | [models.AnthropicCacheControlDirective](/agent-sdk/typescript/api-reference/models/anthropiccachecontroldirective) | :heavy\_minus\_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.                                                                                                                                                                                                          | `{"type": "ephemeral"}`                                                                                            |
| `frequencyPenalty`    | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `imageConfig`         | `Record<string, *models.ImageConfig*>`                                                                             | :heavy\_minus\_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See [https://openrouter.ai/docs/guides/overview/multimodal/image-generation](https://openrouter.ai/docs/guides/overview/multimodal/image-generation) for more details.                                                                                                                                                        | `{"aspect_ratio": "16:9","quality": "high"}`                                                                       |
| `include`             | [models.ResponseIncludesEnum](/agent-sdk/typescript/api-reference/models/responseincludesenum)\[]                  | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `input`               | *models.InputsUnion*                                                                                               | :heavy\_minus\_sign: | Input for a response request - can be a string or array of items                                                                                                                                                                                                                                                                                                                                                     | \[<br />`{"content": "What is the weather today?","role": "user"}`<br />]                                          |
| `instructions`        | *string*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `maxOutputTokens`     | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `maxToolCalls`        | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `metadata`            | `Record<string, *string*>`                                                                                         | :heavy\_minus\_sign: | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.                                                                                                                                                                                                                                                         | `{"session_id": "abc-def-ghi","user_id": "123"}`                                                                   |
| `modalities`          | [models.OutputModalityEnum](/agent-sdk/typescript/api-reference/models/outputmodalityenum)\[]                      | :heavy\_minus\_sign: | Output modalities for the response. Supported values are "text" and "image".                                                                                                                                                                                                                                                                                                                                         | \[<br />"text",<br />"image"<br />]                                                                                |
| `model`               | *string*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `models`              | *string*\[]                                                                                                        | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `parallelToolCalls`   | *boolean*                                                                                                          | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `plugins`             | *models.ResponsesRequestPlugin*\[]                                                                                 | :heavy\_minus\_sign: | Plugins you want to enable for this request, including their settings.                                                                                                                                                                                                                                                                                                                                               |                                                                                                                    |
| `presencePenalty`     | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `previousResponseId`  | *string*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `prompt`              | [models.StoredPromptTemplate](/agent-sdk/typescript/api-reference/models/storedprompttemplate)                     | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  | `{"id": "prompt-abc123","variables": {"name": "John"}`<br />}                                                      |
| `promptCacheKey`      | *string*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `provider`            | [models.ProviderPreferences](/agent-sdk/typescript/api-reference/models/providerpreferences)                       | :heavy\_minus\_sign: | When multiple model providers are available, optionally indicate your routing preference.                                                                                                                                                                                                                                                                                                                            | `{"allow_fallbacks": true}`                                                                                        |
| `reasoning`           | [models.ReasoningConfig](/agent-sdk/typescript/api-reference/models/reasoningconfig)                               | :heavy\_minus\_sign: | Configuration for reasoning mode in the response                                                                                                                                                                                                                                                                                                                                                                     | `{"enabled": true,"summary": "auto"}`                                                                              |
| `safetyIdentifier`    | *string*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `serviceTier`         | [models.ResponsesRequestServiceTier](/agent-sdk/typescript/api-reference/models/responsesrequestservicetier)       | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `sessionId`           | *string*                                                                                                           | :heavy\_minus\_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. |                                                                                                                    |
| `stopServerToolsWhen` | *models.StopServerToolsWhenCondition*\[]                                                                           | :heavy\_minus\_sign: | Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`.                                                                                                                                                                                                                                                                           | \[<br />`{"step_count": 5,"type": "step_count_is"}`,<br />`{"max_cost_in_dollars": 0.5,"type": "max_cost"}`<br />] |
| `store`               | *false*                                                                                                            | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `stream`              | *boolean*                                                                                                          | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `temperature`         | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `text`                | [models.TextExtendedConfig](/agent-sdk/typescript/api-reference/models/textextendedconfig)                         | :heavy\_minus\_sign: | Text output configuration including format and verbosity                                                                                                                                                                                                                                                                                                                                                             | `{"format": {"type": "text"}`<br />}                                                                               |
| `toolChoice`          | *models.OpenAIResponsesToolChoiceUnion*                                                                            | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  | auto                                                                                                               |
| `tools`               | *models.ResponsesRequestToolUnion*\[]                                                                              | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `topK`                | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `topLogprobs`         | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `topP`                | *number*                                                                                                           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                                                                    |
| `trace`               | [models.TraceConfig](/agent-sdk/typescript/api-reference/models/traceconfig)                                       | :heavy\_minus\_sign: | Metadata for observability and tracing. Known keys (trace\_id, trace\_name, span\_name, generation\_name, parent\_span\_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.                                                                                                                                                                       | `{"trace_id": "trace-abc123","trace_name": "my-app-trace"}`                                                        |
| `truncation`          | [models.OpenAIResponsesTruncation](/agent-sdk/typescript/api-reference/models/openairesponsestruncation)           | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                  | auto                                                                                                               |
| `user`                | *string*                                                                                                           | :heavy\_minus\_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters.                                                                                                                 |                                                                                                                    |
