Documentation
¶
Overview ¶
Package videoupscaler provides the official Go client SDK for the VideoUpscaler AI API (https://videoupscaler.co).
VideoUpscaler enables developers to upscale and enhance videos up to 1080p, 2K, and 4K resolution with AI-powered super-resolution, denoising, frame interpolation, and video stabilization.
Key Capabilities & Documentation ¶
- AI Video Upscaler Platform: https://videoupscaler.co
- 4K Video Upscaler (1080p, 2K & 4K AI Super-Resolution): https://videoupscaler.co/4k-video-upscaler
- Batch Video Upscaler (Concurrent Multi-Clip Pipelines): https://videoupscaler.co/batch-video-upscaler
- Workflow Integrations (n8n, Make, Zapier & MCP): https://videoupscaler.co/integrations
- API & Workflow Documentation: https://videoupscaler.co/docs/workflows
Quickstart ¶
client := videoupscaler.NewClient(os.Getenv("VIDEOUPSCALER_API_KEY"))
task, err := client.Upscale(ctx, videoupscaler.UpscaleRequest{
VideoURL: "https://example.com/input.mp4",
Resolution: videoupscaler.Resolution4K,
})
if err != nil {
log.Fatal(err)
}
completed, err := client.WaitForCompletion(ctx, task.ID)
if err != nil {
log.Fatal(err)
}
fmt.Println("4K Video URL:", completed.OutputURL)
Index ¶
- Constants
- type APIError
- type Account
- type Client
- func (c *Client) GetAccount(ctx context.Context) (*Account, error)
- func (c *Client) GetTask(ctx context.Context, taskID string, waitSeconds int) (*Task, error)
- func (c *Client) ListTasks(ctx context.Context, page, limit int) (*TaskList, error)
- func (c *Client) Upscale(ctx context.Context, req UpscaleRequest) (*Task, error)
- func (c *Client) WaitForCompletion(ctx context.Context, taskID string) (*Task, error)
- type Option
- type Task
- type TaskList
- type UpscaleOps
- type UpscaleRequest
Constants ¶
const ( // DefaultBaseURL is the default endpoint for the VideoUpscaler v1 REST API. DefaultBaseURL = "https://videoupscaler.co/api/v1" // DefaultPollInterval is the default interval between polling requests in WaitForCompletion // when long-polling returns immediately. DefaultPollInterval = 2 * time.Second // DefaultWaitChunkSeconds is the default server-side long-poll duration per GetTask call during WaitForCompletion. DefaultWaitChunkSeconds = 45 // Resolution1080p upscales video to Full HD (1920x1080). Resolution1080p = "1080p" // Resolution2K upscales video to 2K QHD (2560x1440). Resolution2K = "2k" // Resolution4K upscales video to 4K Ultra HD (3840x2160). Resolution4K = "4k" // StatusQueued indicates the task is waiting for a GPU worker. StatusQueued = "queued" // StatusProcessing indicates the task is actively being processed. StatusProcessing = "processing" // StatusCompleted indicates the task finished and OutputURL is ready. StatusCompleted = "completed" // StatusFailed indicates the task failed; check Task.Error for details. StatusFailed = "failed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError is returned when the VideoUpscaler API responds with a non-2xx HTTP status.
type Account ¶
type Account struct {
Credits float64 `json:"credits"`
CreditsPerSecond float64 `json:"credits_per_second"`
Plan string `json:"plan,omitempty"`
}
Account represents the current user's credit balance and pricing tier.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an idiomatic, zero-dependency HTTP client for the VideoUpscaler AI API (https://videoupscaler.co).
func NewClient ¶
NewClient creates a new VideoUpscaler API client. Obtain an API key from https://videoupscaler.co/settings/apikeys.
func (*Client) GetAccount ¶
GetAccount retrieves the credit balance and per-second rate for the authenticated account (GET /account).
func (*Client) GetTask ¶
GetTask retrieves the current status of a task by ID (GET /tasks/{id}). When waitSeconds > 0 (up to 45), the server long-polls until the task completes or the timeout expires.
func (*Client) ListTasks ¶
ListTasks returns a paginated list of recent upscaling tasks (GET /tasks?page=&limit=).
func (*Client) Upscale ¶
Upscale submits a new video upscaling job (POST /upscale). If req.Resolution is empty, it defaults to "4k" (https://videoupscaler.co/4k-video-upscaler). If req.IdempotencyKey is empty, a random UUIDv4 key is generated automatically.
func (*Client) WaitForCompletion ¶
WaitForCompletion polls GetTask until the task reaches StatusCompleted or StatusFailed, or until ctx is canceled. If the task fails, an error is returned alongside the failed *Task.
type Option ¶
type Option func(*Client)
Option configures a Client instance.
func WithBaseURL ¶
WithBaseURL overrides the default API base URL (https://videoupscaler.co/api/v1).
func WithHTTPClient ¶
WithHTTPClient provides a custom *http.Client for API requests.
func WithPollInterval ¶
WithPollInterval configures the delay between poll attempts in WaitForCompletion.
func WithUserAgent ¶
WithUserAgent sets a custom User-Agent header on outgoing requests.
func WithWaitChunkSeconds ¶
WithWaitChunkSeconds configures the long-poll wait parameter (0-45 seconds) used by WaitForCompletion.
type Task ¶
type Task struct {
ID string `json:"id"`
Status string `json:"status"`
Resolution string `json:"resolution,omitempty"`
VideoURL string `json:"video_url,omitempty"`
OutputURL string `json:"output_url,omitempty"`
CreditsUsed float64 `json:"credits_used,omitempty"`
DurationSec float64 `json:"duration_seconds,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
CompletedAt string `json:"completed_at,omitempty"`
Ops *UpscaleOps `json:"ops,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
}
Task represents an asynchronous video upscaling job.
func (*Task) IsTerminal ¶
IsTerminal reports whether the task has reached a final state ("completed" or "failed").
type TaskList ¶
type TaskList struct {
Tasks []Task `json:"tasks"`
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Total int `json:"total,omitempty"`
}
TaskList contains a paginated list of tasks returned by ListTasks.
type UpscaleOps ¶
type UpscaleOps struct {
// Engine selects the AI model ("flashvsr", "real-esrgan", " anime"). Defaults to "flashvsr".
Engine string `json:"engine,omitempty"`
// Denoise strength from 0.0 to 1.0 (https://videoupscaler.co/denoise-video).
Denoise float64 `json:"denoise,omitempty"`
// Deinterlace removes interlacing artifacts from legacy footage.
Deinterlace bool `json:"deinterlace,omitempty"`
// Deflicker smooths temporal luminance flicker.
Deflicker bool `json:"deflicker,omitempty"`
// Stabilize applies AI motion stabilization (https://videoupscaler.co/stabilize-video).
Stabilize bool `json:"stabilize,omitempty"`
// FaceRestore enhances facial details during upscaling.
FaceRestore bool `json:"faceRestore,omitempty"`
// FPSMultiplier increases frame rate (e.g. 2 for 60fps interpolation: https://videoupscaler.co/frame-interpolation).
FPSMultiplier int `json:"fpsMultiplier,omitempty"`
// SlowMotion outputs interpolated frames as smooth slow-motion video.
SlowMotion bool `json:"slowMotion,omitempty"`
// HDR tone-mapping or PQ/HLG output mode ("none", "hdr10", "hlg").
HDR string `json:"hdr,omitempty"`
}
UpscaleOps specifies optional AI video enhancement filters to run alongside upscaling. Learn more at https://videoupscaler.co/docs/workflows.
type UpscaleRequest ¶
type UpscaleRequest struct {
// VideoURL is the publicly accessible HTTP(S) URL of the source video (.mp4, .mov, .webm).
VideoURL string `json:"video_url"`
// Resolution is the target output resolution: "1080p", "2k", or "4k" (default "4k").
Resolution string `json:"resolution"`
// Ops configures optional AI enhancement stages (denoise, frame interpolation, stabilization, etc.).
Ops *UpscaleOps `json:"ops,omitempty"`
// WebhookURL is an optional HTTPS endpoint that receives a POST callback when the task finishes.
WebhookURL string `json:"webhook_url,omitempty"`
// IdempotencyKey prevents duplicate billing if a request is retried. Auto-generated if empty.
IdempotencyKey string `json:"-"`
}
UpscaleRequest defines parameters for submitting a video upscaling job via POST /upscale.