kling

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 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 DefaultProvider added in v0.15.0

func DefaultProvider() engine.Provider

DefaultProvider returns preset engine configurations for kling.

func ModelInfos added in v0.16.0

func ModelInfos() []engine.ModelInfo

ModelInfos returns i18n metadata for all Kling models.

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