Categorygithub.com/Runware/sdk-go
modulepackage
0.0.0-20240520144917-30ec3ad47830
Repository: https://github.com/runware/sdk-go.git
Documentation: pkg.go.dev

# README

Golang Runware SDK

The SDK is used to run image inference with the Runware API, powered by the RunWare inference platform. It can be used to generate imaged with text-to-image and image-to-image. It also allows the use of an existing gallery of models or selecting any model or LoRA from the CivitAI gallery.

Get API access

For an API Key and trial credits, Create a free account with Runware

NB: Please keep your API key private

Usage

go get github.com/Runware/sdk-go

Basic image task


import (
    runware "github.com/Runware/sdk-go"
)


func main() {
    sdk, err := runware.NewSDK(picfinder.SDKConfig{
        APIKey:    os.Getenv("RUNWARE_API"),
        KeepAlive: true,
    })
    if err != nil {
        panic(err)
    }

    imagesRes, err := sdk.NewImage(ctx, runware.NewTaskReq{
        PromptText:    "Prompt text",
        NumberResults: 12,
    })
    if err != nil {
        panic(err)
    }
    
    prettyJSON, _ := json.MarshalIndent(imagesRes, "", "  ")
    log.Println(string(prettyJSON), "Count", len(imagesRes.Images))
}

For advanced requests refer to types.go file

Sample

req := runware.NewTaskReq{
    TaskUUID:           "",
    ImageInitiatorUUID: "",
    PromptText:         "",
    NumberResults:      0,
    ModelId:            "",
    SizeId:             0,
    TaskType:           0,
    PromptLanguageId:   nil,
    Offset:             0,
    Lora:               nil,
    ControlNet:         nil,
}

Advanced settings

Context adjustments

By default, all tasks have a 30-second timeout, but sometimes you might want a fast expiry. This can be passed via context

ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), 5000*time.Millisecond)
defer cancel()

imagesRes, err := sdk.NewImage(ctx, picfinder.NewTaskReq{
    PromptText:    "Some prompt text",
    NumberResults: 1,
})

to close this request after 5 seconds.

Custom UUID for Requests

If at some point you need to group your execution your self and you need to do something with them based on your business needs you can pass your own UUID v4 to any sdk request via TaskUUID

Roadmap

  • Add custom handler support for API events

# Packages

No description provided by the author

# Functions

No description provided by the author
New create a new client and initiate connection.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewTaskReqDefaults set requests defaults TODO: Add task type determination function helper.
No description provided by the author

# Constants

Task types.
Task types.
Task types.
No description provided by the author
Task types.
Task types.
Task types.
Task types.
Task types.
Available models.
Available models.
Available models.
Available models.
Available models.
Available models.
Available models.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
Available processors.
No description provided by the author
Task types.
Task types.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Available sizes.
Task types.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Base64 Err validations.
Base64 Err validations.
Base64 Err validations.
Base64 Err validations.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

OutgoingMessageHandler interface implementation for outgoing messages.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author