Versions in this module Expand all Collapse all v0 v0.1.1 Sep 3, 2026 v0.1.0 Aug 23, 2026 Changes in this version + const BlockTypeImage + const BlockTypeText + const BlockTypeThinking + const BlockTypeToolResult + const BlockTypeToolUse + const ChunkTypeError + const ChunkTypeFinish + const ChunkTypeTextDelta + const ChunkTypeThinkingDelta + const ChunkTypeToolUseDelta + const ChunkTypeUsage + const SunoActionLyrics + const SunoActionMusic + func DefaultHTTPClient() *http.Client + type AlphaSearchRequest struct + Model string + Query json.RawMessage + type AudioRequest struct + Input json.RawMessage + Language string + Model string + ResponseFormat string + Speed *float64 + Voice string + type AudioResponse struct + Data []byte + Headers http.Header + Usage meter.Usage + type ChatChoice struct + FinishReason string + Index int + Message Message + type ChatRequest struct + Betas []string + MaxTokens *int + Messages []Message + Model string + N *int + ReasoningEffort string + Stop json.RawMessage + Stream bool + System string + Temperature *float64 + ToolChoice json.RawMessage + Tools []Tool + TopP *float64 + User string + type ChatResponse struct + Choices []ChatChoice + ID string + Model string + Provider string + Usage meter.Usage + type ChatStreamChunk struct + Delta string + Done bool + Err error + FinishReason string + Reasoning string + ToolCalls []dto.ToolCallResponse + Usage *meter.Usage + type ChatStreamResult struct + Ch chan ChatStreamChunk + Usage meter.Usage + type Client struct + func New(opts ...Option) *Client + func (c *Client) AlphaSearch(ctx context.Context, req *AlphaSearchRequest) (*ResponsesResponse, error) + func (c *Client) Audio(ctx context.Context, req *AudioRequest, isTranscription bool) (*AudioResponse, error) + func (c *Client) AudioTranslation(ctx context.Context, req *AudioRequest) (*AudioResponse, error) + func (c *Client) Chat(ctx context.Context, req *ChatRequest) (*ChatResponse, error) + func (c *Client) ChatStream(ctx context.Context, req *ChatRequest) (*ChatStreamResult, error) + func (c *Client) Completions(ctx context.Context, req *CompletionsRequest) (*CompletionsResponse, error) + func (c *Client) Edit(ctx context.Context, req *EditRequest) (*CompletionsResponse, error) + func (c *Client) Embed(ctx context.Context, req *EmbedRequest) (*EmbedResponse, error) + func (c *Client) FetchSunoTask(ctx context.Context, baseURL, apiKey string, taskIDs []string) ([]SunoTaskData, error) + func (c *Client) FetchSunoTaskByID(ctx context.Context, baseURL, apiKey, taskID string) (*SunoTaskData, error) + func (c *Client) FetchTask(ctx context.Context, tp TaskProvider, baseURL, key string, body map[string]any, ...) (*common.TaskInfo, error) + func (c *Client) GeminiChat(ctx context.Context, req *GeminiChatRequest, model string) (*GeminiChatResponse, error) + func (c *Client) GeminiChatStream(ctx context.Context, req *GeminiChatRequest, model string) (*ChatStreamResult, error) + func (c *Client) Image(ctx context.Context, req *ImageRequest) (*ImageResponse, error) + func (c *Client) ImageEdit(ctx context.Context, req *ImageEditRequest) (*ImageResponse, error) + func (c *Client) Meter() meter.Meter + func (c *Client) MidjourneyFetch(ctx context.Context, baseURL, apiKey, taskID string) (*MidjourneyTask, error) + func (c *Client) MidjourneyFetchByCondition(ctx context.Context, baseURL, apiKey string, condition map[string]any) ([]MidjourneyTask, error) + func (c *Client) MidjourneyImageSeed(ctx context.Context, baseURL, apiKey, taskID string) (json.RawMessage, error) + func (c *Client) MidjourneyNotify(ctx context.Context, body io.Reader) (*MidjourneyNotifyRequest, error) + func (c *Client) MidjourneySubmit(ctx context.Context, baseURL, apiKey string, mode int, req *MidjourneyRequest) (*MidjourneyResponse, error) + func (c *Client) Moderations(ctx context.Context, req *ModerationsRequest) (*dto.ModerationResponse, error) + func (c *Client) Provider() Provider + func (c *Client) Rerank(ctx context.Context, req *RerankRequest) (*RerankResponse, error) + func (c *Client) Responses(ctx context.Context, req *ResponsesRequest) (*ResponsesResponse, error) + func (c *Client) ResponsesCompact(ctx context.Context, req *ResponsesRequest) (*ResponsesResponse, error) + func (c *Client) RichChat(ctx context.Context, req *RichChatRequest) (*RichResponse, error) + func (c *Client) RichChatStream(ctx context.Context, req *RichChatRequest) (*RichChatResult, error) + func (c *Client) SetMeter(m meter.Meter) + func (c *Client) SetProvider(p Provider) + func (c *Client) SubmitSunoTask(ctx context.Context, baseURL, apiKey, action string, req *SunoSubmitRequest) (*SunoSubmitResponse, error) + func (c *Client) SubmitTask(ctx context.Context, tp TaskProvider, body io.Reader) (*TaskSubmitResult, error) + type CompletionsRequest struct + MaxTokens *int + Model string + N *int + Prompt json.RawMessage + Stop json.RawMessage + Stream bool + Temperature *float64 + TopP *float64 + User string + type CompletionsResponse struct + Choices []json.RawMessage + ID string + Model string + Provider string + Usage meter.Usage + type ConfiguredProvider interface + APIKey func() string + BaseURL func() string + type ContentBlock struct + CacheControl json.RawMessage + Content json.RawMessage + ID string + Input json.RawMessage + IsError bool + Name string + Signature string + Source *ImageSource + Text string + Thinking string + ToolUseID string + Type string + func NewImageBlock(mediaType, base64Data string) ContentBlock + func NewTextBlock(text string) ContentBlock + func NewThinkingBlock(thinking, signature string) ContentBlock + func NewToolResultBlock(toolUseID string, content string, isError bool) ContentBlock + func NewToolResultBlockRaw(toolUseID string, content json.RawMessage, isError bool) ContentBlock + func NewToolUseBlock(id, name string, input json.RawMessage) ContentBlock + func (b ContentBlock) GetText() string + func (b ContentBlock) GetToolResultText() string + func (b ContentBlock) IsImage() bool + func (b ContentBlock) IsText() bool + func (b ContentBlock) IsThinking() bool + func (b ContentBlock) IsToolResult() bool + func (b ContentBlock) IsToolUse() bool + func (b ContentBlock) WithCacheControl() ContentBlock + type EditRequest struct + Input string + Instruction string + Model string + N *int + Temperature *float64 + TopP *float64 + type EmbedData struct + Embedding []float32 + Index int + type EmbedRequest struct + Input json.RawMessage + Model string + User string + type EmbedResponse struct + Data []EmbedData + Model string + Provider string + Usage meter.Usage + type FallbackConfig struct + FallbackModels []string + RetryOnErrors func(err error) bool + type GeminiChatRequest = dto.GeminiChatRequest + type GeminiChatResponse = dto.GeminiChatResponse + type GenericProvider struct + func NewProvider(name string, apiType int, adaptor common.Adaptor, baseURL string, ...) *GenericProvider + func (p *GenericProvider) APIKey() string + func (p *GenericProvider) Adaptor() common.Adaptor + func (p *GenericProvider) ApiType() int + func (p *GenericProvider) BaseURL() string + func (p *GenericProvider) Name() string + type ImageData struct + B64JSON string + RevisedPrompt string + URL string + type ImageEditRequest struct + Image []byte + Mask []byte + Model string + N *int + Prompt string + Size string + User string + type ImageRequest struct + Model string + N *int + Prompt string + Quality string + ResponseFormat string + Size string + Style string + User string + type ImageResponse struct + Created int64 + Data []ImageData + Provider string + Usage meter.Usage + type ImageSource struct + Data string + MediaType string + Type string + type Message = dto.Message + type MidjourneyNotifyRequest struct + ImageUrl string + MjId string + Progress string + PromptEn string + State string + Status string + type MidjourneyRequest struct + Action string + Base64Array []string + BotType string + Content string + CustomId string + Index int + MaskBase64 string + NotifyHook string + Prompt string + State string + TaskId string + type MidjourneyResponse struct + Code int + Description string + Properties map[string]any + Result string + type MidjourneyTask struct + Action string + Buttons []map[string]any + FailReason string + FinishTime int64 + ID string + ImageUrl string + Progress string + Prompt string + PromptEn string + Properties map[string]any + StartTime int64 + Status string + SubmitTime int64 + VideoUrl string + type ModerationsRequest struct + Input any + Model string + type Option func(*Client) + func WithCircuitBreaker(cb *circuitbreaker.CircuitBreaker) Option + func WithFallback(cfg FallbackConfig) Option + func WithHTTPClient(hc *http.Client) Option + func WithMaxIdleConns(n int) Option + func WithMeter(m meter.Meter) Option + func WithProvider(p Provider) Option + func WithRequestHook(h RequestHook) Option + func WithRetry(opts ...retry.Option) Option + func WithTimeout(d time.Duration) Option + type Provider interface + Adaptor func() common.Adaptor + ApiType func() int + Name func() string + type RelayError struct + Code string + Err error + Message string + Model string + Provider string + StatusCode int + func (e *RelayError) Error() string + func (e *RelayError) IsRetryable() bool + func (e *RelayError) Unwrap() error + type RequestHook func(ctx context.Context, provider, model string, mode int) func(err error) + type RerankRequest struct + Documents []string + Model string + Query string + TopN *int + type RerankResponse struct + Results []dto.RerankResponseResult + Usage meter.Usage + type ResponsesRequest struct + Input json.RawMessage + Model string + Options json.RawMessage + Stream bool + Tools json.RawMessage + type ResponsesResponse struct + Data []byte + Usage meter.Usage + type RichChatRequest struct + Betas []string + MaxTokens int + Messages []RichMessage + Model string + ReasoningEffort string + Stream bool + System string + Temperature *float64 + ToolChoice json.RawMessage + Tools []RichTool + type RichChatResult struct + Ch chan RichStreamChunk + Final RichResponse + type RichMessage struct + Content []ContentBlock + Role string + func NewAssistantMessageBlocks(blocks ...ContentBlock) RichMessage + func NewSystemMessage(text string) RichMessage + func NewUserMessage(text string) RichMessage + func NewUserMessageBlocks(blocks ...ContentBlock) RichMessage + type RichResponse struct + CacheCreationInputTokens int64 + CacheReadInputTokens int64 + Content []ContentBlock + ID string + InputTokens int64 + Model string + OutputTokens int64 + Role string + StopReason string + func (r RichResponse) Text() string + func (r RichResponse) ToolUses() []ContentBlock + type RichStreamChunk struct + CacheCreationInputTokens int64 + CacheReadInputTokens int64 + Done bool + Err error + FinishReason string + InputFragment string + InputTokens int64 + OutputTokens int64 + Text string + Thinking string + ToolUseID string + ToolUseIndex int + ToolUseName string + Type string + type RichTool struct + Description string + InputSchema json.RawMessage + Name string + Type string + type SunoSubmitRequest struct + ContinueAt float64 + ContinueClipId string + GptDescriptionPrompt string + MakeInstrumental bool + Mv string + Prompt string + Tags string + TaskID string + Title string + type SunoSubmitResponse struct + Code int + Data string + Message string + type SunoTaskData struct + Action string + Data json.RawMessage + FailReason string + FinishTime int64 + StartTime int64 + Status string + SubmitTime int64 + TaskID string + type TaskProvider interface + ApiType func() int + Name func() string + TaskAdaptor func() common.TaskAdaptor + type TaskSubmitResult struct + TaskData []byte + TaskID string + type Tool = dto.ToolCallRequest + type ToolCall = dto.ToolCallRequest