For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
    • Overview
    • Usage for Agents
  • TypeScript SDK
    • Overview
  • Python SDK
    • Overview
  • Go SDK
      • Analytics
      • APIKeys
      • Byok
      • Chat
      • Credits
      • Embeddings
      • Endpoints
      • Generations
      • Guardrails
        • Models
        • ResponsesRequest
      • OAuth
      • Observability
      • Organization
      • Presets
      • Providers
      • Rerank
      • Beta.Responses
      • Transcriptions
      • Speech
      • VideoGeneration
      • Workspaces
  • DevTools
    • Overview
    • Migrating to @openrouter/agent
LogoLogo
ModelsChatRankingsDocs
On this page
  • Fields
Go SDKAPI ReferenceModels

ResponsesRequest - Go SDK

ResponsesRequest type definition
Was this page helpful?
Previous

OAuth - Go SDK

OAuth method reference
Next
Built with

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

Request schema for Responses endpoint

Fields

FieldTypeRequiredDescriptionExample
Backgroundoptionalnullable.OptionalNullable[bool]➖N/A
CacheControl*components.AnthropicCacheControlDirective➖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"}
FrequencyPenaltyoptionalnullable.OptionalNullable[float64]➖N/A
ImageConfigmap[string]components.ImageConfig➖Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.{"aspect_ratio": "16:9","quality": "high"}
Includeoptionalnullable.OptionalNullable[[]components.ResponseIncludesEnum]➖N/A
Input*components.InputsUnion➖Input for a response request - can be a string or array of items[
{"content": "What is the weather today?","role": "user"}
]
Instructionsoptionalnullable.OptionalNullable[string]➖N/A
MaxOutputTokensoptionalnullable.OptionalNullable[int64]➖N/A
MaxToolCallsoptionalnullable.OptionalNullable[int64]➖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.{"session_id": "abc-def-ghi","user_id": "123"}
Modalities[]components.OutputModalityEnum➖Output modalities for the response. Supported values are “text” and “image”.[
“text”,
“image”
]
Model*string➖N/A
Models[]string➖N/A
ParallelToolCallsoptionalnullable.OptionalNullable[bool]➖N/A
Plugins[]components.ResponsesRequestPlugin➖Plugins you want to enable for this request, including their settings.
PresencePenaltyoptionalnullable.OptionalNullable[float64]➖N/A
PreviousResponseIDoptionalnullable.OptionalNullable[string]➖N/A
Promptoptionalnullable.OptionalNullable[components.StoredPromptTemplate]➖N/A{"id": "prompt-abc123","variables": {"name": "John"}
}
PromptCacheKeyoptionalnullable.OptionalNullable[string]➖N/A
Provideroptionalnullable.OptionalNullable[components.ProviderPreferences]➖When multiple model providers are available, optionally indicate your routing preference.{"allow_fallbacks": true}
Reasoningoptionalnullable.OptionalNullable[components.ReasoningConfig]➖Configuration for reasoning mode in the response{"enabled": true,"summary": "auto"}
SafetyIdentifieroptionalnullable.OptionalNullable[string]➖N/A
ServiceTieroptionalnullable.OptionalNullable[components.ResponsesRequestServiceTier]➖N/A
SessionID*string➖A 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.
StopServerToolsWhen[]components.StopServerToolsWhenCondition➖Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides max_tool_calls.[
{"step_count": 5,"type": "step_count_is"},
{"max_cost_in_dollars": 0.5,"type": "max_cost"}
]
Store*bool➖N/A
Stream*bool➖N/A
Temperatureoptionalnullable.OptionalNullable[float64]➖N/A
Text*components.TextExtendedConfig➖Text output configuration including format and verbosity{"format": {"type": "text"}
}
ToolChoice*components.OpenAIResponsesToolChoiceUnion➖N/Aauto
Tools[]components.ResponsesRequestToolUnion➖N/A
TopK*int64➖N/A
TopLogprobsoptionalnullable.OptionalNullable[int64]➖N/A
TopPoptionalnullable.OptionalNullable[float64]➖N/A
Trace*components.TraceConfig➖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"}
Truncationoptionalnullable.OptionalNullable[components.OpenAIResponsesTruncation]➖N/Aauto
User*string➖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.