runware

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package runware implements the Runware provider for Bifrost. Runware exposes a single synchronous endpoint that accepts an array of tasks; this provider supports its image operations (text-to-image, image-to-image, inpainting, outpainting), all of which use the "imageInference" task type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBifrostImageGenerationResponse

func ToBifrostImageGenerationResponse(resp *RunwareResponse) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)

ToBifrostImageGenerationResponse converts a Runware response envelope to a Bifrost image response.

func ToBifrostVideoGenerationResponse

func ToBifrostVideoGenerationResponse(result *RunwareResult) *schemas.BifrostVideoGenerationResponse

ToBifrostVideoGenerationResponse converts a Runware video task result to a Bifrost video response.

Types

type RunwareError

type RunwareError struct {
	Code      string `json:"code,omitempty"`
	Message   string `json:"message,omitempty"`
	Parameter string `json:"parameter,omitempty"`
	TaskType  string `json:"taskType,omitempty"`
	TaskUUID  string `json:"taskUUID,omitempty"`
}

RunwareError describes a single task failure returned by the Runware API.

type RunwareFrameImage

type RunwareFrameImage struct {
	InputImage string  `json:"inputImage"`      // image UUID, URL, or base64/data-URI string
	Frame      *string `json:"frame,omitempty"` // "first" | "last"
}

RunwareFrameImage anchors an input image to a video frame for image-to-video generation.

type RunwareGetResponseRequest

type RunwareGetResponseRequest struct {
	TaskType string `json:"taskType"`
	TaskUUID string `json:"taskUUID"`
}

RunwareGetResponseRequest polls an async task by its UUID.

type RunwareInferenceRequest

type RunwareInferenceRequest struct {
	// Common
	TaskType       string  `json:"taskType"`
	TaskUUID       string  `json:"taskUUID"`
	Model          string  `json:"model"`
	PositivePrompt *string `json:"positivePrompt,omitempty"`
	NegativePrompt *string `json:"negativePrompt,omitempty"`
	Width          *int    `json:"width,omitempty"`
	Height         *int    `json:"height,omitempty"`
	Seed           *int    `json:"seed,omitempty"`
	NumberResults  *int    `json:"numberResults,omitempty"`
	OutputType     *string `json:"outputType,omitempty"`   // "URL" | "base64Data" | "dataURI"
	OutputFormat   *string `json:"outputFormat,omitempty"` // image: "PNG"/"JPG"/"WEBP"; video: "MP4"/"WEBM"

	// Image-only
	Steps     *int    `json:"steps,omitempty"`
	SeedImage *string `json:"seedImage,omitempty"` // image-to-image / inpainting / outpainting base image
	MaskImage *string `json:"maskImage,omitempty"` // inpainting mask

	// Video-only
	DeliveryMethod  *string             `json:"deliveryMethod,omitempty"`
	Duration        *float64            `json:"duration,omitempty"`
	FrameImages     []RunwareFrameImage `json:"frameImages,omitempty"` // image-to-video
	ReferenceImages []string            `json:"referenceImages,omitempty"`

	// ExtraParams carries provider-native fields with no Bifrost equivalent
	// (CFGScale, scheduler, strength, maskMargin, outpaint, fps, lora, ...). Merged into
	// the request body by the transport layer when passthrough is enabled.
	ExtraParams map[string]interface{} `json:"-"`
}

RunwareInferenceRequest is a single Runware task. taskType selects the operation; each operation populates only the subset of fields it needs. Runware accepts an array of these objects per request; the provider wraps a single task in an array before sending.

func ToRunwareImageEditRequest

func ToRunwareImageEditRequest(bifrostReq *schemas.BifrostImageEditRequest) (*RunwareInferenceRequest, error)

ToRunwareImageEditRequest converts a Bifrost image edit request to a Runware imageInference task. The first input image is the seed image; an optional mask enables inpainting. Outpainting, strength, maskMargin and other operation-specific fields flow through via extra params.

func ToRunwareImageGenerationRequest

func ToRunwareImageGenerationRequest(bifrostReq *schemas.BifrostImageGenerationRequest) (*RunwareInferenceRequest, error)

ToRunwareImageGenerationRequest converts a Bifrost image generation request to a Runware imageInference task. A "seedImage" supplied via extra params (a Runware image UUID, a public URL, or a base64/data-URI string) turns the request into an image-to-image generation.

func ToRunwareVideoGenerationRequest

func ToRunwareVideoGenerationRequest(bifrostReq *schemas.BifrostVideoGenerationRequest) (*RunwareInferenceRequest, error)

ToRunwareVideoGenerationRequest converts a Bifrost video generation request to a Runware videoInference task. An input reference image turns it into image-to-video generation.

func (*RunwareInferenceRequest) GetExtraParams

func (r *RunwareInferenceRequest) GetExtraParams() map[string]interface{}

type RunwareProvider

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

RunwareProvider implements the Provider interface for Runware's API.

func NewRunwareProvider

func NewRunwareProvider(config *schemas.ProviderConfig, logger schemas.Logger) (*RunwareProvider, error)

NewRunwareProvider creates a new Runware provider instance.

func (*RunwareProvider) BatchCancel

BatchCancel is not supported by Runware provider.

func (*RunwareProvider) BatchCreate

BatchCreate is not supported by Runware provider.

func (*RunwareProvider) BatchDelete

BatchDelete is not supported by Runware provider.

func (*RunwareProvider) BatchList

BatchList is not supported by Runware provider.

func (*RunwareProvider) BatchResults

BatchResults is not supported by Runware provider.

func (*RunwareProvider) BatchRetrieve

BatchRetrieve is not supported by Runware provider.

func (*RunwareProvider) CachedContentCreate

CachedContentCreate is unsupported on RunwareProvider. Only Gemini and Vertex AI support the named cache lifecycle.

func (*RunwareProvider) CachedContentDelete

CachedContentDelete is unsupported on RunwareProvider (see CachedContentCreate).

func (*RunwareProvider) CachedContentList

CachedContentList is unsupported on RunwareProvider (see CachedContentCreate).

func (*RunwareProvider) CachedContentRetrieve

CachedContentRetrieve is unsupported on RunwareProvider (see CachedContentCreate).

func (*RunwareProvider) CachedContentUpdate

CachedContentUpdate is unsupported on RunwareProvider (see CachedContentCreate).

func (*RunwareProvider) ChatCompletion

ChatCompletion is not supported by the Runware provider.

func (*RunwareProvider) ChatCompletionStream

func (provider *RunwareProvider) ChatCompletionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostChatRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

ChatCompletionStream is not supported by the Runware provider.

func (*RunwareProvider) Compaction

Compaction is not supported by the Runware provider.

func (*RunwareProvider) ContainerCreate

ContainerCreate is not supported by the Runware provider.

func (*RunwareProvider) ContainerDelete

ContainerDelete is not supported by the Runware provider.

func (*RunwareProvider) ContainerFileContent

ContainerFileContent is not supported by the Runware provider.

func (*RunwareProvider) ContainerFileCreate

ContainerFileCreate is not supported by the Runware provider.

func (*RunwareProvider) ContainerFileDelete

ContainerFileDelete is not supported by the Runware provider.

func (*RunwareProvider) ContainerFileList

ContainerFileList is not supported by the Runware provider.

func (*RunwareProvider) ContainerFileRetrieve

ContainerFileRetrieve is not supported by the Runware provider.

func (*RunwareProvider) ContainerList

ContainerList is not supported by the Runware provider.

func (*RunwareProvider) ContainerRetrieve

ContainerRetrieve is not supported by the Runware provider.

func (*RunwareProvider) CountTokens

CountTokens is not supported by the Runware provider.

func (*RunwareProvider) Embedding

Embedding is not supported by the Runware provider.

func (*RunwareProvider) FileContent

FileContent is not supported by Runware provider.

func (*RunwareProvider) FileDelete

FileDelete is not supported by Runware provider.

func (*RunwareProvider) FileList

FileList is not supported by Runware provider.

func (*RunwareProvider) FileRetrieve

FileRetrieve is not supported by Runware provider.

func (*RunwareProvider) FileUpload

FileUpload is not supported by Runware provider.

func (*RunwareProvider) GetProviderKey

func (provider *RunwareProvider) GetProviderKey() schemas.ModelProvider

GetProviderKey returns the provider identifier for Runware.

func (*RunwareProvider) ImageEdit

ImageEdit performs an image edit (image-to-image, inpainting, or outpainting) request to Runware's API.

func (*RunwareProvider) ImageEditStream

func (provider *RunwareProvider) ImageEditStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostImageEditRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

ImageEditStream is not supported by the Runware provider.

func (*RunwareProvider) ImageGeneration

ImageGeneration performs a text-to-image (or image-to-image) request to Runware's API.

func (*RunwareProvider) ImageGenerationStream

func (provider *RunwareProvider) ImageGenerationStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostImageGenerationRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

ImageGenerationStream is not supported by the Runware provider.

func (*RunwareProvider) ImageVariation

ImageVariation is not supported by the Runware provider.

func (*RunwareProvider) ListModels

ListModels is not supported by the Runware provider.

func (*RunwareProvider) OCR

OCR is not supported by the Runware provider.

func (*RunwareProvider) Passthrough

Passthrough is not supported by the Runware provider.

func (*RunwareProvider) PassthroughStream

PassthroughStream is not supported by the Runware provider.

func (*RunwareProvider) Rerank

Rerank is not supported by the Runware provider.

func (*RunwareProvider) Responses

Responses is not supported by the Runware provider.

func (*RunwareProvider) ResponsesStream

func (provider *RunwareProvider) ResponsesStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostResponsesRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

ResponsesStream is not supported by the Runware provider.

func (*RunwareProvider) Speech

Speech is not supported by the Runware provider.

func (*RunwareProvider) SpeechStream

func (provider *RunwareProvider) SpeechStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostSpeechRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

SpeechStream is not supported by the Runware provider.

func (*RunwareProvider) TextCompletion

TextCompletion is not supported by the Runware provider.

func (*RunwareProvider) TextCompletionStream

func (provider *RunwareProvider) TextCompletionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostTextCompletionRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

TextCompletionStream is not supported by the Runware provider.

func (*RunwareProvider) Transcription

Transcription is not supported by the Runware provider.

func (*RunwareProvider) TranscriptionStream

func (provider *RunwareProvider) TranscriptionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostTranscriptionRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)

TranscriptionStream is not supported by the Runware provider.

func (*RunwareProvider) VideoDelete

VideoDelete is not supported by the Runware provider.

func (*RunwareProvider) VideoDownload

VideoDownload retrieves the task, then downloads the finished video from its URL.

func (*RunwareProvider) VideoGeneration

VideoGeneration submits an async videoInference task and returns the queued job. The caller polls VideoRetrieve to fetch the finished video.

func (*RunwareProvider) VideoList

VideoList is not supported by the Runware provider.

func (*RunwareProvider) VideoRemix

VideoRemix is not supported by the Runware provider.

func (*RunwareProvider) VideoRetrieve

VideoRetrieve polls a previously submitted videoInference task via a getResponse task.

type RunwareResponse

type RunwareResponse struct {
	Data   []RunwareResult `json:"data,omitempty"`
	Errors []RunwareError  `json:"errors,omitempty"`
}

RunwareResponse is the universal Runware envelope: successful task outputs land in Data, per-task failures land in Errors (which can be present on a 200 response).

type RunwareResult

type RunwareResult struct {
	// Common
	TaskType string  `json:"taskType"`
	TaskUUID string  `json:"taskUUID"`
	Status   string  `json:"status,omitempty"` // video: "processing" | "success" | "error"
	Seed     *int    `json:"seed,omitempty"`
	Cost     float64 `json:"cost,omitempty"`

	// Image
	ImageUUID       string `json:"imageUUID,omitempty"`
	ImageURL        string `json:"imageURL,omitempty"`
	ImageBase64Data string `json:"imageBase64Data,omitempty"`
	ImageDataURI    string `json:"imageDataURI,omitempty"`
	NSFWContent     *bool  `json:"NSFWContent,omitempty"`

	// Video
	VideoUUID string `json:"videoUUID,omitempty"`
	VideoURL  string `json:"videoURL,omitempty"`
}

RunwareResult is a single task result. Fields are populated per modality: image tasks fill the image* fields, video tasks fill the video* fields; the rest are shared.

Jump to

Keyboard shortcuts

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