Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to run models and upload files.
func NewClient ¶
func NewClient(apiKey string, opts *ClientOptions) (*Client, error)
NewClient creates a new WaveSpeed client. If apiKey is empty, it reads WAVESPEED_API_KEY from the environment.
func (*Client) Run ¶
func (c *Client) Run(modelID string, input map[string]any, opts *RunOptions) (*Prediction, error)
Run submits a model and waits for completion.
type ClientOptions ¶
type ClientOptions struct {
BaseURL string // API base URL without path (default: https://api.wavespeed.ai)
APIKey string // overrides provided apiKey or env
PollIntervalSeconds *float64 // default: 1
TimeoutSeconds *float64 // overall wait timeout, default: 36000
HTTPClient *http.Client
MaxRetries *int // task-level retries (default: 0)
MaxConnectionRetries *int // HTTP connection retries (default: 5)
RetryInterval *float64 // base delay between retries in seconds (default: 1)
}
ClientOptions configures the client at construction time.
type Prediction ¶
type Prediction struct {
ID string `json:"id"`
Model string `json:"model"`
Status string `json:"status"`
Input any `json:"input"`
Outputs []string `json:"outputs"`
Error string `json:"error"`
}
Prediction matches the API response data for a prediction.
type RunOptions ¶
type RunOptions struct {
TimeoutSeconds *float64 // overall wait timeout for this call
PollIntervalSeconds *float64 // poll interval for this call
EnableSyncMode *bool // if true, use synchronous mode (single request)
MaxRetries *int // maximum retries for this request (overrides client default)
}
RunOptions applies to a single Run call.
Click to show internal directories.
Click to hide internal directories.