Skip to main content
A model returned by client.Model implements llm.Provider. The SDK translates shared Go types into a provider’s native API. Select the method for the operation: All package paths above are under github.com/hastekit/agent-sdk-go/pkg/gateway. A provider implementing the interface may still reject an unsupported operation.

Responses request

responses.Request contains Model, Instructions, Input, Tools, and embedded Parameters. For a bound model, omit Request.Model unless intentionally overriding routing. Set one branch of a union value at a time. Use pointers for optional scalar parameters (utils.Ptr is available) so omitted and explicitly zero values remain distinct. The bound client’s response methods set streaming mode from the method you call and set Store to false. Do not rely on Parameters.Stream to select the streaming API or Store to enable provider-side history through these methods. Request objects are modified during routing; create a request per concurrent call rather than sharing one mutable pointer.

Response and stream types

A complete response has an Output list, optional Usage, and optional Error. Each output item selects a union branch such as OfOutputMessage, OfFunctionCall, OfReasoning, or OfImageGenerationCall. Text is not guaranteed to be the first output item. A stream yields ResponseChunk values. Check OfError and terminal response events as well as text deltas. Initial request errors are returned from the method; failures after streaming starts can arrive in-band. For provider HTTP failures, llm.AsAPIError exposes StatusCode and RetryAfter; llm.StatusCodeOf returns zero for errors without a provider status. Handle context cancellation separately from a provider rejection.

Capability boundaries

Fields present in the shared schema are not a promise of cross-provider support. Unsupported fields may be translated, ignored, or rejected depending on the adapter. Validate the exact provider/model combinations your application enables, especially structured output, reasoning, hosted tools, and multimodal formats.