Versions in this module Expand all Collapse all v0 v0.3.0 Oct 23, 2026 Changes in this version + const AssetSortName + const AssetSortOldest + const AssetSortRecent + const AssetSortSize + const AssetSourceTaskOutput + const AssetSourceURL + const AssetSourceUpload + const AssetURIPrefix + const ReasonAssetDailyLimit + const ReasonAssetEntityNameTaken + const ReasonAssetFileTooLarge + const ReasonAssetLibraryFull + const ReasonAssetLibraryLocked + const ReasonAssetPermissionDenied + const ReasonAssetStorageFull + const ReasonAssetWorkspaceForbidden + func AssetErrorReasons() []string + func IsAssetErrorReason(reason string) bool type APIError + Reason string + type AssetCharacter struct + Assets []LibraryAsset + Count int + Cover *LibraryAsset + CoverAssetID string + CreatedAt time.Time + ID string + Kind string + Name string + Note string + UpdatedAt time.Time + func (c *AssetCharacter) URIs() []string + type AssetCharacterList struct + Items []AssetCharacter + NextCursor string + type AssetLimits struct + GlobalMaxBytes int64 + MaxBytes int64 + MaxCount int + MaxFileBytes int64 + NameMaxChars int + Tier string + type AssetList struct + Items []LibraryAsset + NextCursor string + type AssetPlan struct + ID string + MaxBytes int64 + MaxCount int + MaxFileBytes int64 + MinTopupUSD string + Name string + type AssetScope struct + CanTopUp bool + CanWrite bool + Personal bool + Role string + WorkspaceID string + type AssetUsage struct + CreatedToday int + DailyCreateLimit int + Full bool + LifetimeTopupUSD string + Limits AssetLimits + NextTier *AssetPlan + Scope AssetScope + Tier AssetPlan + Tiers []AssetPlan + TopupToNextTierUSD string + Usage AssetUsageTotals + type AssetUsageTotals struct + Bytes int64 + Count int type Client + func (c *Client) DeleteAsset(ctx context.Context, assetID string) (*DeletedAsset, error) + func (c *Client) EachAsset(ctx context.Context, opts ListAssetsOptions, fn func(LibraryAsset) bool) error + func (c *Client) EachCharacter(ctx context.Context, opts ListCharactersOptions, fn func(AssetCharacter) bool) error + func (c *Client) GetAsset(ctx context.Context, assetID string) (*LibraryAsset, error) + func (c *Client) GetAssetUsage(ctx context.Context) (*AssetUsage, error) + func (c *Client) GetCharacter(ctx context.Context, characterID string) (*AssetCharacter, error) + func (c *Client) ListAssets(ctx context.Context, opts ListAssetsOptions) (*AssetList, error) + func (c *Client) ListCharacters(ctx context.Context, opts ListCharactersOptions) (*AssetCharacterList, error) + func (c *Client) SaveAsset(ctx context.Context, input SaveAssetInput, idempotencyKey string) (*LibraryAsset, error) + func (c *Client) UpdateAsset(ctx context.Context, assetID string, input UpdateAssetInput) (*LibraryAsset, error) + func (c *Client) UploadAssetFile(ctx context.Context, path string, opts UploadAssetOptions) (*LibraryAsset, error) + type DeletedAsset struct + Deleted bool + ID string + type LibraryAsset struct + Bytes int64 + ContentType string + CreatedAt time.Time + DurationSeconds float64 + Favorite bool + Height int + ID string + Kind string + Model string + ModelName string + Name string + PreviewURL string + PreviewURLExpiresAt *time.Time + Source string + SourceID string + URI string + UpdatedAt time.Time + Width int + type ListAssetsOptions struct + CollectionID string + Cursor string + EntityID string + Favorite *bool + Kind string + Limit int + Q string + Sort string + Source []string + type ListCharactersOptions struct + AssetID string + Cursor string + Limit int + type SaveAssetInput struct + FileID string + Index *int + Key string + Name string + Source string + TaskID string + URL string + type UpdateAssetInput struct + Favorite *bool + Name string + type UploadAssetOptions struct + ContentType string + Name string v0.2.0 Oct 5, 2026 Changes in this version + const APIBaseURL + const CodeDependencyUnavailable + const CodeEmailNotVerified + const CodeGenerationRefunded + const CodeInsufficientBalance + const CodeModelUnavailable + const CodeQuoteRejected + const CodeSpendCapReached + const CodeSuccess + const CodeUnsupportedCombination + const CodeUploadMismatch + const DefaultMaxRetries + const DefaultPollInterval + const DefaultRequestTimeout + const DefaultUploadTimeout + const DefaultWaitTimeout + const ErrorCodeContentRejected + const ErrorCodeGenerationFailed + const ErrorCodeInvalidAsset + const ErrorCodeInvalidRequest + const ErrorCodeRateLimited + const ErrorCodeTimeout + const ErrorCodeUnsupportedCombination + const ErrorCodeUpstreamFailed + const ErrorCodeUpstreamUnavailable + const MaxPollInterval + const StateCanceled + const StateExpired + const StateFailed + const StateQueued + const StateRunning + const StateSucceeded + const UserAgent + const Version + const WebhookTolerance + var ErrWebhookRejected = errors.New("spicy: webhook rejected") + var ErrWebhookSignature = fmt.Errorf("%w: signature mismatch", ErrWebhookRejected) + var ErrWebhookStale = fmt.Errorf("%w: timestamp outside the tolerance window", ErrWebhookRejected) + func NewIdempotencyKey() (string, error) + func VerifyWebhook(secret string, header http.Header, rawBody []byte, tolerance time.Duration) (string, error) + type APIError struct + Code int + Message string + RequestID string + RetryAfter time.Duration + Status int + func (e *APIError) Error() string + func (e *APIError) Refunded() bool + func (e *APIError) Retryable() bool + type Asset struct + Bytes int64 + DurationSeconds float64 + ExpiresAt *time.Time + Height int + Key string + Layer *AssetLayer + MIME string + NSFW bool + Pending bool + Role string + URL string + Unavailable bool + Width int + type AssetLayer struct + BoundingBox []int + Name string + ZIndex int + type Balance struct + Available string + Funding *FundingOverview + Held string + Total string + type Client struct + func New(opts Options) (*Client, error) + func (c *Client) CommitUpload(ctx context.Context, fileID string) (*UploadedFile, error) + func (c *Client) CreateDownloadURL(ctx context.Context, taskID, key string) (*DownloadTicket, error) + func (c *Client) CreateTask(ctx context.Context, input CreateTaskInput, idempotencyKey string, ...) (*CreateTaskResult, error) + func (c *Client) CreateUploadURL(ctx context.Context, contentType string, size int64) (*UploadTicket, error) + func (c *Client) EachTask(ctx context.Context, opts ListTasksOptions, fn func(TaskListItem) bool) error + func (c *Client) GetBalance(ctx context.Context) (*Balance, error) + func (c *Client) GetModel(ctx context.Context, model string) (*Model, error) + func (c *Client) GetTask(ctx context.Context, taskID string) (*Task, error) + func (c *Client) GetUsage(ctx context.Context, opts UsageOptions) (*UsageReport, error) + func (c *Client) ListModels(ctx context.Context, opts ListModelsOptions) (*ModelList, error) + func (c *Client) ListTasks(ctx context.Context, opts ListTasksOptions) (*TaskList, error) + func (c *Client) PurgeTask(ctx context.Context, taskID string) (*PurgeResult, error) + func (c *Client) Quote(ctx context.Context, input CreateTaskInput) (*Quote, error) + func (c *Client) RetryTask(ctx context.Context, taskID, idempotencyKey string) (*RetryTaskResult, error) + func (c *Client) Upload(ctx context.Context, data []byte, contentType string) (*UploadedFile, error) + func (c *Client) UploadFile(ctx context.Context, path, contentType string) (*UploadedFile, error) + func (c *Client) WaitForTerminal(ctx context.Context, taskID string, opts WaitOptions) (*Task, error) + type CreateTaskInput struct + CallBackURL string + ExpectedCost string + Input map[string]any + Model string + QuoteID string + type CreateTaskOptions struct + RetentionSeconds *int + WaitSeconds *int + type CreateTaskResult struct + DeadlineAt time.Time + EstimatedCost string + State string + Task *Task + TaskID string + func (r *CreateTaskResult) InFlight() bool + type CreditFacility struct + AvailableUsd string + Enabled bool + ExpiresAt *time.Time + HeldUsd string + LimitUsd string + Status string + UsedUsd string + Version int64 + type DownloadTicket struct + ExpiresAt time.Time + Key string + URL string + type FundingGrant struct + AmountUsd string + AvailableUsd string + CreatedAt time.Time + CustomerMemo string + ExpiresAt *time.Time + HeldUsd string + ID string + ModelSlugs []string + Name string + SpentUsd string + StartsAt time.Time + Status string + type FundingOverview struct + BalanceUsd string + CashShortfallUsd string + Credit *CreditFacility + GrantAvailableUsd string + Grants []FundingGrant + GrantsHasMore bool + HeldUsd string + PrepaidAvailableUsd string + type HTTPDoer interface + Do func(req *http.Request) (*http.Response, error) + type ListModelsOptions struct + IncludeExamples bool + IncludeSchema bool + Modality string + Provider string + Search string + Task string + type ListTasksOptions struct + Cursor string + From string + Limit int + Model string + State string + To string + type Model struct + Async bool + Availability string + Available bool + Badges []string + DisplayName string + Enabled bool + Examples []ModelExample + Family string + InputSchema json.RawMessage + Mature bool + Modality string + Model string + PolicyTier string + Pricing []ModelPrice + Provider string + QuantityField string + RelatedModels []string + StartingPrice *ModelPrice + TaskTimeoutSeconds int + Tasks []string + Toolkit string + UpdatedAt time.Time + Version string + type ModelExample struct + ID string + Input map[string]any + SortWeight int + type ModelList struct + Items []Model + Total int + type ModelPrice struct + Currency string + OfferEndsAt *time.Time + OfferLabel string + OfferPercent string + Price string + RegularPrice string + Unit string + Variant string + type Options struct + APIKey string + BaseURL string + HTTPClient HTTPDoer + MaxRetries int + Now func() time.Time + Rand func() float64 + RequestTimeout time.Duration + Sleep func(ctx context.Context, d time.Duration) error + UploadTimeout time.Duration + WaitTimeout time.Duration + type PurgeResult struct + BillingRetained bool + ContentRemovedBy string + ContentState string + MediaDeletionPending bool + PurgedAt *time.Time + TaskID string + type Quote struct + Currency string + EstimatedCost string + ExpiresAt time.Time + MaxCharge string + Model string + Quantity string + QuoteID string + Unit string + type RetryTaskResult struct + SourceTaskID string + type Task struct + CompletedAt *time.Time + ContentRemovedBy string + ContentState string + Cost string + CreatedAt time.Time + DeadlineAt *time.Time + ErrorCode string + ErrorMessage string + Input map[string]any + Model string + Output *TaskOutput + PurgedAt *time.Time + Retention *TaskRetention + Settled bool + SourceTaskID string + State string + TaskID string + func (t *Task) HasPendingAssets() bool + func (t *Task) InFlight() bool + func (t *Task) ReadyAssets() []Asset + type TaskList struct + HasMore bool + Items []TaskListItem + NextCursor string + type TaskListItem struct + CompletedAt *time.Time + Cost string + CreatedAt time.Time + DeadlineAt time.Time + Model string + RequestID string + Settled bool + State string + TaskID string + type TaskOutput struct + Assets []Asset + Text string + Transcript *TaskTranscript + type TaskRetention struct + OutputsExpireAt time.Time + PromptsExpireAt time.Time + Source string + type TaskTranscript struct + Channels []TaskTranscriptChannel + DurationSeconds float64 + Language string + LanguageCode string + LanguageProbability *float64 + Text string + Words []TaskTranscriptWord + type TaskTranscriptChannel struct + Index int + Language string + LanguageCode string + Text string + Words []TaskTranscriptWord + type TaskTranscriptWord struct + End float64 + SpeakerID string + Start float64 + Text string + Type string + type UploadTicket struct + ExpiresAt time.Time + FileID string + Headers map[string]string + Key string + MaxBytes int64 + Method string + UploadURL string + type UploadedFile struct + Bytes int64 + ContentType string + DurationSeconds string + ExpiresAt time.Time + FileID string + Height int + SHA256 string + Status string + URI string + Width int + type UsageDay struct + Calls int64 + Day string + Failed int64 + Spend string + Succeeded int64 + type UsageModel struct + Calls int64 + Failed int64 + Model string + Spend string + Succeeded int64 + type UsageOptions struct + From string + To string + type UsageReport struct + Currency string + Days []UsageDay + From string + Models []UsageModel + To string + TotalCalls int64 + TotalSpend string + type WaitOptions struct + AcceptPendingAssets bool + Interval time.Duration + MaxInterval time.Duration + Timeout time.Duration + type WaitTimeoutError struct + LastState string + TaskID string + Timeout time.Duration + func (e *WaitTimeoutError) Error() string + func (e *WaitTimeoutError) Unwrap() error