kling

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package kling implements engine.Engine for the Kling (快手可灵) API.

Video generation is async: POST /v1/videos/text2video or /v1/videos/image2video creates a task, then GET /v1/videos/{task_id} polls for completion. Image generation: POST /v1/images/generations, GET /v1/images/{task_id}. Auth: Authorization: Bearer {key}, env KLING_API_KEY.

Index

Constants

View Source
const (
	ModelKlingV2       = "kling-v2"
	ModelKlingV2Master = "kling-v2-master"
	ModelKlingV1       = "kling-v1"
)

Model constants.

View Source
const (
	EndpointText2Video  = "text2video"
	EndpointImage2Video = "image2video"
	EndpointImage       = "image"
)

Endpoint selects the generation mode.

Variables

View Source
var ErrMissingPrompt = fmt.Errorf("kling: missing prompt in workflow graph")

Functions

func ConfigSchema

func ConfigSchema() []engine.ConfigField

ConfigSchema returns the configuration fields required by the Kling engine.

func ModelsByCapability

func ModelsByCapability() map[string][]string

ModelsByCapability returns all known Kling models grouped by capability.

Types

type Config

type Config struct {
	APIKey            string
	BaseURL           string
	Model             string
	Endpoint          string // "text2video", "image2video", or "image"
	HTTPClient        *http.Client
	WaitForCompletion bool
	PollInterval      time.Duration
	OnProgress        epoll.OnProgress
}

Config configures the Kling engine.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine implements engine.Engine for Kling.

func New

func New(cfg Config) *Engine

New creates a Kling engine instance.

func (*Engine) Capabilities

func (e *Engine) Capabilities() engine.Capability

Capabilities implements engine.Describer.

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, g workflow.Graph) (engine.Result, error)

Execute generates a video or image via the Kling API.

func (*Engine) Resume

func (e *Engine) Resume(ctx context.Context, remoteID string) (engine.Result, error)

Resume implements engine.Resumer -- resumes polling a previously submitted task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL