Versions in this module Expand all Collapse all v0 v0.3.0 Nov 3, 2026 Changes in this version + type EmbeddingBatch struct + Data []EmbeddingVector + InputTokens int64 + type EmbeddingVector struct + Embedding []float64 + Index int type ModelUsd + PerMillionTokens json.RawMessage type TaskOutput + Embeddings *EmbeddingBatch v0.2.0 Nov 1, 2026 Changes in this version + const CodeInsufficientBalance type Balance + AvailableUsd string + HeldUsd string + TotalUsd string type CreateTaskInput + ExpectedCostUsd string + func (in CreateTaskInput) WithQuote(quote *Quote) CreateTaskInput type CreateTaskResult + EstimatedCostUsd string type Model + Usd *ModelUsd + type ModelPriceBlocks struct + Cap int + Min int + Seconds int + type ModelUsd struct + Blocks *ModelPriceBlocks + CacheWrite string + CachedInput string + Currency string + Input string + LongContext *ModelUsdLongContext + Output string + PerUnit string + Rules []ModelUsdRule + Unit string + type ModelUsdLongContext struct + CacheWrite string + CachedInput string + Inclusive bool + Input string + Output string + ThresholdTokens int + type ModelUsdRule struct + PerUnit string + Unit string + When map[string]any type Quote + ExpectedCharge string + ExpectedChargeUsd string + MaxChargeUsd string type Task + CostUsd string v0.1.0 Oct 18, 2026 Changes in this version + const APIBaseURL + const APIKeyEnv + const AssetSourceTaskOutput + const AssetSourceURL + const AssetSourceUpload + const CodeBadRequest + const CodeConflict + const CodeDependencyUnavailable + const CodeEmailNotVerified + const CodeForbidden + const CodeGenerationRefunded + const CodeIPNotAllowed + const CodeInsufficientCredits + const CodeModelNotAllowed + const CodeModelUnavailable + const CodeNotFound + const CodePayloadTooLarge + const CodeQuoteRejected + const CodeRateLimited + const CodeRegionUnavailable + const CodeServerError + const CodeSpendCapReached + const CodeSuccess + const CodeUnauthorized + const CodeUnsupportedCombination + const CodeUploadMismatch + const ContentTypeLoRA + 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("popnow: 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) + type APIError struct + Code int + Message string + Reason 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 + 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 AssetDeleted struct + Deleted bool + ID string + type AssetLayer struct + BoundingBox []int + Name string + ZIndex int + type AssetList struct + Items []Asset + NextCursor string + type AssetPlan struct + ID string + MaxBytes int64 + MaxCount int64 + MaxFileBytes int64 + MinTopupUsd string + Name string + type AssetQuota struct + CreatedToday int64 + DailyCreateLimit int64 + Full bool + LifetimeTopupUsd string + Limits struct{ ... } + NextTier *AssetPlan + Scope AssetScope + Tier AssetPlan + Tiers []AssetPlan + TopupToNextTierUsd string + Usage struct{ ... } + type AssetScope struct + CanTopUp bool + CanWrite bool + Personal bool + Role string + WorkspaceID string + type Balance struct + Available string + AvailableCredits int64 + Funding *FundingOverview + Held string + HeldCredits int64 + Total string + TotalCredits int64 + type Character struct + Assets []Asset + Count int + Cover *Asset + CoverAssetID string + CreatedAt time.Time + ID string + Kind string + Name string + Note string + UpdatedAt time.Time + type CharacterList struct + Items []Character + NextCursor string + type Client struct + func New(opts Options) (*Client, error) + func (c *Client) Assets(ctx context.Context, opts ListAssetsOptions) iter.Seq2[Asset, error] + func (c *Client) CommitUpload(ctx context.Context, fileID string) (*UploadedFile, error) + func (c *Client) CreateAsset(ctx context.Context, input CreateAssetInput, idempotencyKey string) (*Asset, 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) DeleteAsset(ctx context.Context, assetID string) (*AssetDeleted, error) + func (c *Client) EachAsset(ctx context.Context, opts ListAssetsOptions, fn func(Asset) bool) error + func (c *Client) EachTask(ctx context.Context, opts ListTasksOptions, fn func(TaskListItem) bool) error + func (c *Client) GetAsset(ctx context.Context, assetID string) (*Asset, error) + func (c *Client) GetAssetUsage(ctx context.Context) (*AssetQuota, error) + func (c *Client) GetBalance(ctx context.Context) (*Balance, error) + func (c *Client) GetCharacter(ctx context.Context, characterID string) (*Character, 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) ImportLoRA(ctx context.Context, input LoRAImport) (*UploadedFile, error) + func (c *Client) ListAssets(ctx context.Context, opts ListAssetsOptions) (*AssetList, error) + func (c *Client) ListCharacters(ctx context.Context, opts ListCharactersOptions) (*CharacterList, 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) Tasks(ctx context.Context, opts ListTasksOptions) iter.Seq2[TaskListItem, error] + func (c *Client) UpdateAsset(ctx context.Context, assetID string, input UpdateAssetInput) (*Asset, 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) UploadReader(ctx context.Context, r io.Reader, size int64, contentType string) (*UploadedFile, error) + func (c *Client) WaitForTerminal(ctx context.Context, taskID string, opts WaitOptions) (*Task, error) + type CreateAssetInput struct + FileID string + Index *int + Key string + Name string + Source string + TaskID string + URL string + type CreateTaskInput struct + CallBackURL string + ExpectedCost string + ExpectedCredits *int64 + Input map[string]any + Model string + QuoteID string + type CreateTaskOptions struct + RetentionSeconds *int + WaitSeconds *int + type CreateTaskResult struct + DeadlineAt time.Time + EstimatedCost string + EstimatedCredits int64 + 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 EndpointEvent struct + Data struct{ ... } + ID string + Raw json.RawMessage + Type string + func VerifyEndpointWebhook(secret string, header http.Header, rawBody []byte, tolerance time.Duration) (*EndpointEvent, error) + 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 ListAssetsOptions struct + CollectionID string + Cursor string + EntityID string + Favorite *bool + Kind string + Limit int + Q string + Sort string + Sources []string + type ListCharactersOptions struct + AssetID string + Cursor string + Limit int + 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 LoRAImport struct + Token string + URL string + type Model struct + Async bool + Availability string + Available bool + Badges []string + Credits *ModelCredits + DisplayName string + Enabled bool + Examples []ModelExample + Family string + InputSchema json.RawMessage + MaxOutputDurationSeconds int + Modality string + Model string + Provider string + QuantityField string + RelatedModels []string + TaskTimeoutSeconds int + Tasks []string + Toolkit string + UpdatedAt time.Time + Version string + type ModelCreditRule struct + PerUnit float64 + Unit string + When map[string]any + type ModelCredits struct + PerUnit float64 + Rules []ModelCreditRule + Unit string + type ModelExample struct + ID string + Input map[string]any + SortWeight int + type ModelList struct + Items []Model + Total int + type Options struct + APIKey string + AcceptLanguage 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 + UserAgent string + WaitTimeout time.Duration + type OutputAsset struct + Bytes int64 + Deleted bool + DurationSeconds float64 + ExpiresAt *time.Time + Height int + Key string + Layer *AssetLayer + MIME string + Pending bool + Role string + URL string + Unavailable bool + Width int + type PurgeResult struct + BillingRetained bool + ContentRemovedBy string + ContentState string + MediaDeletionPending bool + PurgedAt *time.Time + TaskID string + type Quote struct + Currency string + EstimatedCost string + ExpectedCredits int64 + ExpiresAt time.Time + MaxCharge string + MaxCredits int64 + 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 + Credits int64 + 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() []OutputAsset + type TaskList struct + HasMore bool + Items []TaskListItem + NextCursor string + type TaskListItem struct + CompletedAt *time.Time + Cost string + CreatedAt time.Time + Credits int64 + DeadlineAt time.Time + Model string + RequestID string + Settled bool + State string + TaskID string + type TaskOutput struct + Assets []OutputAsset + 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 UpdateAssetInput struct + Favorite *bool + Name *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 + Credits int64 + Day string + Failed int64 + Spend string + Succeeded int64 + type UsageModel struct + Calls int64 + Credits 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 + TotalCredits 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 + type WebhookDelivery struct + DeliveryID string + PayloadVersion string + Task *Task + TaskID string + func VerifyWebhook(secret string, header http.Header, rawBody []byte, tolerance time.Duration) (*WebhookDelivery, error)