Versions in this module Expand all Collapse all v1 v1.0.0 Jul 29, 2026 Changes in this version + const DefaultBaseURL + func Float(v float64) *float64 + func Int(v int) *int + type ChatRequest struct + ConversationID string + Extra map[string]any + MaxTokens *int + Messages []Message + Model string + Seed *int + Stop []string + Temperature *float64 + ToolChoice any + Tools []any + TopP *float64 + type ChatResponse struct + Choices []Choice + ID string + Model string + Usage Usage + func (r *ChatResponse) Text() string + type Choice struct + FinishReason string + Index int + Message Message + type Client struct + func New(apiKey string, opts ...Option) *Client + func (c *Client) Chat(ctx context.Context, req ChatRequest) (*ChatResponse, error) + func (c *Client) CompleteText(ctx context.Context, req ChatRequest) (string, error) + func (c *Client) Embeddings(ctx context.Context, req EmbeddingsRequest) (*EmbeddingsResponse, error) + func (c *Client) Images(ctx context.Context, req ImageRequest) (*ImageResponse, error) + func (c *Client) Models(ctx context.Context) ([]Model, error) + func (c *Client) Speech(ctx context.Context, req SpeechRequest) ([]byte, error) + func (c *Client) Stream(ctx context.Context, req ChatRequest, onChunk func(StreamChunk) error) error + func (c *Client) StreamText(ctx context.Context, req ChatRequest, onText func(string) error) error + func (c *Client) Usage(ctx context.Context) (map[string]any, error) + type EmbeddingsRequest struct + Dimensions *int + Input any + Model string + type EmbeddingsResponse struct + Data []struct{ ... } + Model string + Usage Usage + type Error struct + Body string + StatusCode int + func (e *Error) Error() string + type ImageRequest struct + Model string + N int + Prompt string + Size string + type ImageResponse struct + Created int64 + Data []struct{ ... } + type Message struct + Content any + Name string + Role string + ToolCallID string + ToolCalls []any + func Text(role, content string) Message + type Model struct + ID string + Object string + OwnedBy string + type Option func(*Client) + func WithBaseURL(url string) Option + func WithDefaultModel(model string) Option + func WithHTTPClient(h *http.Client) Option + func WithHeader(key, value string) Option + type SpeechRequest struct + Input string + Model string + ResponseFormat string + Speed float64 + Voice string + type StreamChunk struct + Choices []struct{ ... } + ID string + Model string + type Usage struct + CompletionTokens int + PromptTokens int + TotalTokens int