Versions in this module Expand all Collapse all v0 v0.1.0 Dec 1, 2026 Changes in this version + const DefaultBaseURL + const DefaultEnvAPIKey + const ModelCyberV1 + const ModelDecideV1 + const ModelImageV1 + const RoleAssistant + const RoleSystem + const RoleTool + const RoleUser + func IsInsufficientBalance(err error) bool + func IsRateLimited(err error) bool + func IsUnauthorized(err error) bool + type APIError struct + Code string + Message string + Param string + RawBody string + Refill *RefillInfo + RequestID string + StatusCode int + Type string + func (e *APIError) Error() string + type AccountUsage struct + Balance []Balance + House *HouseUsage + Object string + Pays string + Plan *PlanUsage + type Balance struct + Currency string + Micros int64 + func (b Balance) Amount() float64 + type ChatCompletionChunk struct + Choices []ChunkChoice + Created int64 + ID string + Model string + Object string + SystemFingerprint string + Usage *TokenUsage + type ChatCompletionRequest struct + MaxCompletionTokens int + MaxTokens int + Messages []Message + Model string + ParallelToolCalls *bool + ReasoningEffort string + ResponseFormat *ResponseFormat + Seed *int + Stop []string + Stream bool + StreamOptions *StreamOptions + Temperature *float64 + ToolChoice any + Tools []Tool + TopP *float64 + User string + type ChatCompletionResponse struct + Choices []Choice + Created int64 + ID string + Model string + Object string + SystemFingerprint string + Usage *TokenUsage + type ChatStream struct + func (s *ChatStream) Chunk() ChatCompletionChunk + func (s *ChatStream) Close() error + func (s *ChatStream) Err() error + func (s *ChatStream) Next() bool + type Choice struct + FinishReason string + Index int + Message Message + type ChunkChoice struct + Delta ChunkDelta + FinishReason string + Index int + type ChunkDelta struct + Content string + Reasoning string + ReasoningContent string + Role string + ToolCalls []ToolCall + func (d ChunkDelta) ReasoningText() string + type Client struct + func NewClient(opts ...Option) *Client + func (c *Client) ChatCompletion(ctx context.Context, req ChatCompletionRequest) (*ChatCompletionResponse, error) + func (c *Client) ChatCompletionStream(ctx context.Context, req ChatCompletionRequest) (*ChatStream, error) + func (c *Client) GenerateImage(ctx context.Context, req ImageGenerationRequest) (*ImageGenerationResponse, error) + func (c *Client) GetModel(ctx context.Context, modelID string) (*Model, error) + func (c *Client) ListModels(ctx context.Context) (*ModelList, error) + func (c *Client) Usage(ctx context.Context) (*AccountUsage, error) + type CompletionTokensDetails struct + ReasoningTokens int + type GeneratedImage struct + B64JSON string + RevisedPrompt string + URL string + func (g GeneratedImage) DecodeBytes() ([]byte, error) + type HouseUsage struct + Running uint32 + Threads uint32 + type ImageGenerationRequest struct + Model string + N int + Prompt string + ResponseFormat string + Seed *int + Size string + type ImageGenerationResponse struct + Created int64 + Data []GeneratedImage + type LongContextPricing struct + CachedInputTimes float64 + OverTokens int + type Message struct + Content string + Name string + Reasoning string + ReasoningContent string + Role string + ToolCallID string + ToolCalls []ToolCall + func (m Message) ReasoningText() string + type Model struct + ContextLength *int + Created int64 + ID string + Kind string + MaxOutputTokens *int + Name string + Object string + OwnedBy string + Pricing *ModelPricing + type ModelList struct + Data []Model + Object string + Onboarding *OnboardingLinks + type ModelPricing struct + CachedInputPerMillion *float64 + Currency string + InputPerMillion *float64 + LongContext *LongContextPricing + OutputPerMillion *float64 + PerImage *float64 + type OnboardingLinks struct + ChallengeURL string + CoinsURL string + OpenAPIURL string + OrdersURL string + SkillURL string + X402KeyURL string + type Option func(*Client) + func WithAPIKey(key string) Option + func WithBaseURL(rawURL string) Option + func WithHTTPClient(hc *http.Client) Option + func WithUserAgent(ua string) Option + type PlanUsage struct + Carried int64 + EndsAt *string + Label string + Left float64 + Name string + Requests int64 + ResetsAt string + Running uint32 + Threads uint32 + Used float64 + type PromptTokensDetails struct + CachedTokens int + type RefillInfo struct + Auth string + BalanceURL string + CoinsURL string + Method string + MinUSD float64 + OpenAPIURL string + URL string + X402TopupURL string + type ResponseFormat struct + JSONSchema any + Type string + type StreamOptions struct + IncludeUsage bool + type TokenUsage struct + CompletionTokens int + CompletionTokensDetails *CompletionTokensDetails + PromptTokens int + PromptTokensDetails *PromptTokensDetails + TotalTokens int + type Tool struct + Function ToolFunction + Type string + type ToolCall struct + Function ToolCallFunction + ID string + Index *int + Type string + type ToolCallFunction struct + Arguments string + Name string + type ToolFunction struct + Description string + Name string + Parameters any + Strict *bool