ResponsesRequest - Go SDK

ResponsesRequest type definition

The Go SDK and docs are currently in beta. Report issues on GitHub.

Request schema for Responses endpoint

Fields

FieldTypeRequiredDescriptionExample
Input*components.InputsUnionInput for a response request - can be a string or array of items[
{"role": "user","content": "What is the weather today?"}
]
Instructionsoptionalnullable.OptionalNullable[string]N/A
Metadataoptionalnullable.OptionalNullable[map[string]string]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[]components.ResponsesRequestToolUnionN/A
ToolChoice*components.OpenAIResponsesToolChoiceUnionN/Aauto
ParallelToolCallsoptionalnullable.OptionalNullable[bool]N/A
Model*stringN/A
Models[]stringN/A
Text*components.TextExtendedConfigText output configuration including format and verbosity{"format": {"type": "text"}
}
Reasoningoptionalnullable.OptionalNullable[components.ReasoningConfig]Configuration for reasoning mode in the response{"summary": "auto","enabled": true}
MaxOutputTokens*int64N/A
Temperature*float64N/A
TopP*float64N/A
TopLogprobs*int64N/A
MaxToolCalls*int64N/A
PresencePenalty*float64N/A
FrequencyPenalty*float64N/A
TopK*int64N/A
ImageConfigmap[string]components.ResponsesRequestImageConfigProvider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details.{"aspect_ratio": "16:9"}
Modalities[]components.OutputModalityEnumOutput modalities for the response. Supported values are “text” and “image”.[
“text”,
“image”
]
PromptCacheKeyoptionalnullable.OptionalNullable[string]N/A
PreviousResponseIDoptionalnullable.OptionalNullable[string]N/A
Promptoptionalnullable.OptionalNullable[components.StoredPromptTemplate]N/A{"id": "prompt-abc123","variables": {"name": "John"}
}
Includeoptionalnullable.OptionalNullable[[]components.ResponseIncludesEnum]N/A
Backgroundoptionalnullable.OptionalNullable[bool]N/A
SafetyIdentifieroptionalnullable.OptionalNullable[string]N/A
Store*boolN/A
ServiceTieroptionalnullable.OptionalNullable[components.ResponsesRequestServiceTier]N/A
Truncationoptionalnullable.OptionalNullable[components.OpenAIResponsesTruncation]N/Aauto
Stream*boolN/A
Provideroptionalnullable.OptionalNullable[components.ProviderPreferences]When multiple model providers are available, optionally indicate your routing preference.{"allow_fallbacks": true}
Plugins[]components.ResponsesRequestPluginPlugins you want to enable for this request, including their settings.
User*stringA 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.
SessionID*stringA unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
Trace*components.TraceConfigMetadata 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"}