Versions in this module Expand all Collapse all v1 v1.0.0 Feb 22, 2026 Changes in this version + const AnthropicClaude2 + const AnthropicClaudeInstantV1 + const ChatMessageRoleAssistant + const ChatMessageRoleSystem + const ChatMessageRoleUser + const Claude2 + const ClaudeInstantV1 + const G432K + const GooglePalm2ChatBison + const GooglePalm2CodeChatBison + const Gpt35Turbo + const Gpt35Turbo16k + const Gpt4 + const Llama213bChat + const Llama270bChat + const MetaLlamaLlama213bChat + const MetaLlamaLlama270bChat + const OpenaiGpt35Turbo + const OpenaiGpt35Turbo16k + const OpenaiGpt4 + const OpenaiGpt432K + const Palm2ChatBison + const Palm2CodeChatBison + var ErrChatCompletionStreamNotSupported = errors.New(...) + var ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method") + var ErrTooManyEmptyStreamMessages = errors.New("stream has sent too many empty messages") + type APIError struct + Code any + Details any + HTTPStatusCode int + Message string + func (e *APIError) Error() string + func (e *APIError) UnmarshalJSON(data []byte) (err error) + type ChatCompletionChoice struct + Delta Index + FinishReason string + Index uint + Message Index + type ChatCompletionMessage struct + Content string + Role string + type ChatCompletionRequest struct + MaxTokens int + Messages []ChatCompletionMessage + Model string + Stream bool + Temperature *float32 + TopK *uint + TopP *float32 + type ChatCompletionResponse struct + Choices []ChatCompletionChoice + Created int64 + ID string + Model string + Object string + type ChatCompletionStream struct + func (stream *ChatCompletionStream) Close() + func (stream *ChatCompletionStream) Recv() (response *ChatCompletionResponse, err error) + type Client struct + func NewClient(auth, xTitle, httpReferer string) (*Client, error) + func NewClientWithConfig(config ClientConfig) *Client + func (c *Client) CreateChatCompletion(ctx context.Context, request *ChatCompletionRequest) (response *ChatCompletionResponse, err error) + func (c *Client) CreateChatCompletionStream(ctx context.Context, request *ChatCompletionRequest) (stream *ChatCompletionStream, err error) + type ClientConfig struct + BaseURL string + EmptyMessagesLimit uint + HTTPClient *http.Client + HttpReferer string + XTitle string + func DefaultConfig(auth, xTitle, httpReferer string) (ClientConfig, error) + func (c ClientConfig) WithHttpClientConfig(client *http.Client) ClientConfig + type ErrorResponse struct + Error *APIError + type Index struct + Content string + Role string + type ModelName string + type RequestError struct + Err error + HTTPStatusCode int + func (e *RequestError) Error() string + func (e *RequestError) Unwrap() error + type Usage struct + CompletionTokens int + TotalTokens int