The TypeScript SDK and docs are currently in beta.
Report issues on GitHub.
Example Usage
import { OpenResponsesNonStreamingResponse } from "@openrouter/sdk/models";
let value: OpenResponsesNonStreamingResponse = {
id: "resp-abc123",
object: "response",
createdAt: 1704067200,
model: "gpt-4",
status: "completed",
completedAt: null,
output: [
{
id: "msg-abc123",
role: "assistant",
type: "message",
content: [
{
type: "output_text",
text: "Hello! How can I help you today?",
},
],
},
],
error: null,
incompleteDetails: null,
temperature: null,
topP: null,
presencePenalty: 293.66,
frequencyPenalty: 9884.38,
instructions: null,
metadata: null,
tools: [],
toolChoice: "auto",
parallelToolCalls: true,
};
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
id | string | :heavy_check_mark: | N/A | |
object | models.ObjectT | :heavy_check_mark: | N/A | |
createdAt | number | :heavy_check_mark: | N/A | |
model | string | :heavy_check_mark: | N/A | |
status | models.OpenAIResponsesResponseStatus | :heavy_check_mark: | N/A | |
completedAt | number | :heavy_check_mark: | N/A | |
output | models.ResponsesOutputItem[] | :heavy_check_mark: | N/A | |
user | string | :heavy_minus_sign: | N/A | |
outputText | string | :heavy_minus_sign: | N/A | |
promptCacheKey | string | :heavy_minus_sign: | N/A | |
safetyIdentifier | string | :heavy_minus_sign: | N/A | |
error | models.ResponsesErrorField | :heavy_check_mark: | Error information returned from the API | {"code": "rate_limit_exceeded","message": "Rate limit exceeded. Please try again later."} |
incompleteDetails | models.OpenAIResponsesIncompleteDetails | :heavy_check_mark: | N/A | |
usage | models.OpenResponsesUsage | :heavy_minus_sign: | Token usage information for the response | {"input_tokens": 10,"output_tokens": 25,"total_tokens": 35,"input_tokens_details": {"cached_tokens": 0},“output_tokens_details”: {"reasoning_tokens": 0},“cost”: 0.0012, “cost_details”: {"upstream_inference_cost": null,"upstream_inference_input_cost": 0.0008,"upstream_inference_output_cost": 0.0004}} |
maxToolCalls | number | :heavy_minus_sign: | N/A | |
topLogprobs | number | :heavy_minus_sign: | N/A | |
maxOutputTokens | number | :heavy_minus_sign: | N/A | |
temperature | number | :heavy_check_mark: | N/A | |
topP | number | :heavy_check_mark: | N/A | |
presencePenalty | number | :heavy_check_mark: | N/A | |
frequencyPenalty | number | :heavy_check_mark: | N/A | |
instructions | models.OpenAIResponsesInputUnion | :heavy_check_mark: | N/A | |
metadata | Record<string, *string*> | :heavy_check_mark: | 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. | {"user_id": "123","session_id": "abc-def-ghi"} |
tools | models.OpenResponsesNonStreamingResponseToolUnion[] | :heavy_check_mark: | N/A | |
toolChoice | models.OpenAIResponsesToolChoiceUnion | :heavy_check_mark: | N/A | |
parallelToolCalls | boolean | :heavy_check_mark: | N/A | |
prompt | models.OpenAIResponsesPrompt | :heavy_minus_sign: | N/A | |
background | boolean | :heavy_minus_sign: | N/A | |
previousResponseId | string | :heavy_minus_sign: | N/A | |
reasoning | models.OpenAIResponsesReasoningConfig | :heavy_minus_sign: | N/A | |
serviceTier | models.OpenAIResponsesServiceTier | :heavy_minus_sign: | N/A | |
store | boolean | :heavy_minus_sign: | N/A | |
truncation | models.OpenAIResponsesTruncation | :heavy_minus_sign: | N/A | |
text | models.ResponseTextConfig | :heavy_minus_sign: | Text output configuration including format and verbosity | {"format": {"type": "text"},“verbosity”: “medium” } |