apiframe

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 9 Imported by: 0

README

Apiframe Go SDK

Official Go SDK for Apiframe - The ultimate platform for AI image and video generation APIs.

Go Reference

Features

  • 🎨 Midjourney API (Original) - Generate, upscale, vary, blend, inpaint, face swap
  • 🚀 Midjourney Pro API - Fast & Turbo modes, better stability
  • ⚡ Flux AI - Fast and high-quality image generation
  • 🎭 Ideogram - Creative image generation with text rendering
  • 🎬 Luma AI - Text and image to video generation
  • 🎵 Suno AI - AI music generation
  • 🎶 Udio AI - Advanced music creation
  • 🎥 Runway ML - Gen-3 video generation
  • 🎪 Kling AI - Video generation and manipulation
  • 📸 AI Photos - Headshots, face swap, and photo enhancement
  • 📤 Media Upload - Upload and manage media files

Installation

go get github.com/apiframe-ai/apiframe-go-sdk

Quick Start

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/apiframe-ai/apiframe-go-sdk"
)

func main() {
	// Create a new Apiframe client
	client, err := apiframe.NewClient(apiframe.Config{
		APIKey: os.Getenv("APIFRAME_API_KEY"),
	})
	if err != nil {
		log.Fatal(err)
	}

	// Create an image generation task
	task, err := client.Midjourney.Imagine(apiframe.MidjourneyImagineParams{
		Prompt:      "a serene mountain landscape at sunset, photorealistic",
		AspectRatio: "16:9",
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Task created: %s\n", task.ID)

	// Wait for completion with progress updates
	result, err := client.Tasks.WaitFor(task.ID, &apiframe.WaitForOptions{
		OnProgress: func(progress int) {
			fmt.Printf("Progress: %d%%\n", progress)
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Images ready: %v\n", result.ImageURLs)
}

API Reference

Configuration
client, err := apiframe.NewClient(apiframe.Config{
	APIKey:  "your_api_key",                    // Required: Your Apiframe API key
	BaseURL: "https://api.apiframe.ai",         // Optional: Custom API endpoint
	Timeout: 300000,                            // Optional: Request timeout in ms (default: 300000)
})
Midjourney (Original API)

The original Midjourney API with comprehensive features.

Imagine

Create a new image generation task.

task, err := client.Midjourney.Imagine(apiframe.MidjourneyImagineParams{
	Prompt:        "a serene mountain landscape",
	AspectRatio:   "16:9",
	WebhookURL:    "https://your-domain.com/webhook",    // Optional
	WebhookSecret: "your-secret",                         // Optional
})
ImagineVideo

Generate videos using a text prompt and an image URL.

task, err := client.Midjourney.ImagineVideo(apiframe.MidjourneyImagineVideoParams{
	Prompt:   "cinematic mountain landscape",
	ImageURL: "https://example.com/start-frame.jpg",
	Motion:   "high", // Optional: 'low' or 'high'
})
Reroll

Reroll to create new images from a previous Imagine task.

task, err := client.Midjourney.Reroll(apiframe.MidjourneyRerollParams{
	ParentTaskID: "original_task_id",
	Prompt:       "optional new prompt", // Optional
})
Variations

Create 4 new variations of one of the 4 generated images.

task, err := client.Midjourney.Variations(apiframe.MidjourneyVariationsParams{
	ParentTaskID: "original_task_id",
	Index:        "1", // '1', '2', '3', '4', 'strong', or 'subtle'
})
FaceSwap

Swap the face on a target image with the face on a provided image.

task, err := client.Midjourney.FaceSwap(apiframe.MidjourneyFaceSwapParams{
	TargetImageURL: "https://example.com/target.jpg",
	SwapImageURL:   "https://example.com/face.jpg",
})
Upscale1x

Upscale one of the 4 generated images to get a single image.

task, err := client.Midjourney.Upscale1x(apiframe.MidjourneyUpscale1xParams{
	ParentTaskID: "original_task_id",
	Index:        "1", // '1', '2', '3', or '4'
})
UpscaleAlt

Upscale with Subtle or Creative mode.

task, err := client.Midjourney.UpscaleAlt(apiframe.MidjourneyUpscaleAltParams{
	ParentTaskID: "upscale1x_task_id",
	Type:         "subtle", // 'subtle' or 'creative'
})
UpscaleHighres

Upscale any image to higher resolution (2x or 4x).

task, err := client.Midjourney.UpscaleHighres(apiframe.MidjourneyUpscaleHighresParams{
	ParentTaskID: "task_id", // Or use ImageURL instead
	Type:         "2x",      // '2x' or '4x'
	Index:        "1",       // Optional: only if it's a 4 generated images task
})
Inpaint

Redraw a selected area of an image (Vary Region).

task, err := client.Midjourney.Inpaint(apiframe.MidjourneyInpaintParams{
	ParentTaskID: "upscale1x_task_id",
	Mask:         "base64_encoded_mask_image",
	Prompt:       "a red sports car",
})
Outpaint

Enlarges an image's canvas beyond its original size (Zoom Out).

task, err := client.Midjourney.Outpaint(apiframe.MidjourneyOutpaintParams{
	ParentTaskID: "upscale1x_task_id",
	ZoomRatio:    1.5, // 1.5, 2, or 1 for custom zoom
	AspectRatio:  "1:1",
	Prompt:       "mountain landscape", // Optional
})
Pan

Broadens the image canvas in a specific direction.

task, err := client.Midjourney.Pan(apiframe.MidjourneyPanParams{
	ParentTaskID: "upscale1x_task_id",
	Direction:    "up", // 'up', 'down', 'left', or 'right'
})
Describe

Writes four example prompts based on an image.

task, err := client.Midjourney.Describe(apiframe.MidjourneyDescribeParams{
	ImageURL: "https://example.com/image.jpg",
})
Blend

Blend multiple images into one image (2-5 images).

task, err := client.Midjourney.Blend(apiframe.MidjourneyBlendParams{
	ImageURLs: []string{
		"https://example.com/image1.jpg",
		"https://example.com/image2.jpg",
	},
	Dimension: "square", // 'square', 'portrait', or 'landscape'
})
Shorten

Analyzes your prompt and suggests optimizations.

task, err := client.Midjourney.Shorten(apiframe.MidjourneyShortenParams{
	Prompt: "a very beautiful and amazing sunset over the mountains with clouds",
})
Seed

Get the seed of a generated image.

task, err := client.Midjourney.Seed(apiframe.MidjourneySeedParams{
	TaskID: "original_task_id",
})
Midjourney Pro API (MidjourneyAlt)

The Pro Midjourney API with Fast & Turbo modes.

Imagine

Create a new image with Pro API (supports Fast and Turbo modes).

task, err := client.MidjourneyAlt.Imagine(apiframe.MidjourneyAltImagineParams{
	Prompt: "a serene mountain landscape",
	Mode:   "turbo", // 'fast' or 'turbo'
})
Upscale

Upscale a specific image from a Pro API generation.

task, err := client.MidjourneyAlt.Upscale(apiframe.MidjourneyAltUpscaleParams{
	ParentTaskID: "parent_task_id",
	Index:        "1",
	Type:         "subtle", // 'subtle' or 'creative'
})
Vary

Create variations with strong/subtle control.

task, err := client.MidjourneyAlt.Vary(apiframe.MidjourneyAltVaryParams{
	ParentTaskID: "parent_task_id",
	Index:        "1",
	Type:         "subtle", // 'subtle' or 'strong'
})
Other Pro API Methods
  • Variations(params) - Generate 4 variations of an image
  • Pan(params) - Pan in a specific direction
  • Zoom(params) - Zoom out from an image
  • GetGeneration(generationID) - Get generation info
  • GetAccountInfo() - Get Pro API account info
Flux
// Generate with Flux Pro
width := 1024
height := 1024
steps := 50
guidance := 7.5

task, err := client.Flux.Generate(apiframe.FluxGenerateParams{
	Model:    "flux-pro", // 'flux-schnell', 'flux-pro', 'flux-dev', 'flux-pro-1.1', 'flux-pro-1.1-ultra'
	Prompt:   "a futuristic cityscape",
	Width:    &width,
	Height:   &height,
	Steps:    &steps,
	Guidance: &guidance,
})

// Convenience methods
task, err := client.Flux.GeneratePro(apiframe.FluxGenerateParams{...})
task, err := client.Flux.GenerateDev(apiframe.FluxGenerateParams{...})
task, err := client.Flux.GenerateSchnell(apiframe.FluxGenerateParams{...})
Ideogram
// Generate image
task, err := client.Ideogram.Generate(apiframe.IdeogramGenerateParams{
	Prompt:      "a logo design",
	AspectRatio: "ASPECT_1_1",
	StyleType:   "DESIGN",
})

// Upscale image
task, err := client.Ideogram.Upscale(apiframe.IdeogramUpscaleParams{
	ImageURL:    "https://...",
	Prompt:      "enhance this image",
	Resemblance: 80,
	Detail:      &detail,
})

// Describe image
task, err := client.Ideogram.Describe(apiframe.IdeogramDescribeParams{
	ImageURL: "https://...",
})

// Remix (image-to-image)
task, err := client.Ideogram.Remix(apiframe.IdeogramRemixParams{
	ImageURL:    "https://...",
	Prompt:      "transform this image...",
	ImageWeight: 70,
})
Luma AI (Video)
// Generate video from text prompt
enhancePrompt := true
loop := false

task, err := client.Luma.Generate(apiframe.LumaGenerateParams{
	Prompt:        "a serene beach with waves",
	AspectRatio:   "16:9",
	EnhancePrompt: &enhancePrompt,
	Loop:          &loop,
})

// Generate with start and end images
task, err := client.Luma.Generate(apiframe.LumaGenerateParams{
	Prompt:      "a smooth transition",
	ImageURL:    "https://start-image.jpg",
	EndImageURL: "https://end-image.jpg",
})

// Extend a previously generated video
task, err := client.Luma.Extend(apiframe.LumaExtendParams{
	ParentTaskID: "previous_task_id",
	Prompt:       "continue the scene with more action",
})
Suno AI (Music)
// Generate song with lyrics (creates TWO songs)
task, err := client.Suno.Generate(apiframe.SunoGenerateParams{
	Prompt: "an upbeat electronic track",
	Lyrics: "[Verse 1]\nDancing through the night...",
	Model:  "chirp-v4",
	Tags:   "electronic, dance, upbeat",
	Title:  "Digital Dreams",
})

// Generate lyrics only
task, err := client.Suno.GenerateLyrics(apiframe.SunoLyricsParams{
	Prompt: "a song about summer adventures",
})

// Upload audio
task, err := client.Suno.Upload(apiframe.SunoUploadParams{
	AudioURL: "https://your-audio-url.mp3",
})

// Extend a song
fromUpload := true
task, err := client.Suno.Extend(apiframe.SunoExtendParams{
	SongID:     "song_id",
	ContinueAt: 30,
	FromUpload: &fromUpload,
	Prompt:     "continue with more energy",
})
Udio AI (Music)
// Generate music (creates TWO songs)
promptStrength := 0.8
task, err := client.Udio.Generate(apiframe.UdioGenerateParams{
	Prompt:         "a calm ambient soundtrack",
	Lyrics:         "Verse 1: Under the stars...",
	Model:          "udio32-v1.5",
	Tags:           "ambient, calm, instrumental",
	PromptStrength: &promptStrength,
})
Runway ML (Video)
// Generate video
duration := 10
task, err := client.Runway.Generate(apiframe.RunwayGenerateParams{
	Prompt:         "a drone shot flying over mountains",
	GenerationType: "text2video",
	Model:          "gen3",
	AspectRatio:    "16:9",
	Duration:       &duration,
})

// Convenience methods
task, err := client.Runway.TextToVideo("prompt", "16:9", "gen3", 5)
task, err := client.Runway.ImageToVideo("image_url", "prompt", "gen3", 10)
task, err := client.Runway.VideoToVideo("video_url", "prompt", "gen3", 5)
Kling AI (Video)
// Generate video
duration := 10
task, err := client.Kling.Generate(apiframe.KlingGenerateParams{
	Prompt:         "a time-lapse of a flower blooming",
	GenerationType: "text2video",
	Model:          "kling-v1-5",
	Mode:           "pro",
	AspectRatio:    "16:9",
	Duration:       &duration,
})

// Convenience methods
task, err := client.Kling.TextToVideo("prompt", "16:9", "kling-v1-5", 10)
task, err := client.Kling.ImageToVideo("image_url", "prompt", "kling-v1-5", "pro", 5)

// Virtual Try On
task, err := client.Kling.Tryon(apiframe.KlingTryonParams{
	HumanImageURL: "https://person-image.jpg",
	ClothImageURL: "https://clothing-image.jpg",
	Model:         "kolors-virtual-try-on-v1-5",
})
AI Photos
// Step 1: Upload 10-30 images for training
task, err := client.AIPhotos.Upload(apiframe.AIPhotosUploadParams{
	Images:    []string{"base64_1", "base64_2", "..."}, // 10-30 images
	Ethnicity: "white",
	Gender:    "male",
	Age:       30,
})

uploadResult, err := client.Tasks.WaitFor(task.ID, nil)

// Step 2: Train AI on the subject
trainTask, err := client.AIPhotos.Train(apiframe.AIPhotosTrainParams{
	TrainingImagesID: task.ID,
	TriggerWord:      "TOKMSN",
})

trainResult, err := client.Tasks.WaitFor(trainTask.ID, nil)

// Step 3: Generate photos
generateTask, err := client.AIPhotos.Generate(apiframe.AIPhotosGenerateParams{
	TrainingID:     trainTask.ID,
	Prompt:         "a portrait of TOKMSN wearing a suit",
	AspectRatio:    "1:1",
	NumberOfImages: "4",
})

result, err := client.Tasks.WaitFor(generateTask.ID, nil)
Media Upload
// Upload image from file
upload, err := client.Media.Upload("./path/to/image.jpg", nil)
fmt.Println("Uploaded:", upload.ImageURL)

// Upload image from bytes
imageBytes, _ := os.ReadFile("image.jpg")
upload, err := client.Media.Upload("", imageBytes)

// Upload audio
audioUpload, err := client.Media.UploadAudio("./path/to/audio.mp3", nil)
fmt.Println("Uploaded audio:", audioUpload.AudioURL)

// Use uploaded media
task, err := client.Midjourney.Blend(apiframe.MidjourneyBlendParams{
	ImageURLs: []string{upload.ImageURL, anotherURL},
})
Tasks

General task management methods.

Get

Get the result/status of a submitted task.

task, err := client.Tasks.Get(taskID)
fmt.Printf("Status: %s\n", task.Status)
GetMany

Get the results/statuses of multiple tasks (min 2, max 20).

result, err := client.Tasks.GetMany([]string{"task_id_1", "task_id_2"})
fmt.Printf("Tasks: %v\n", result.Tasks)
WaitFor

Wait for a task to complete with progress tracking.

result, err := client.Tasks.WaitFor(taskID, &apiframe.WaitForOptions{
	OnProgress: func(progress int) {
		fmt.Printf("Progress: %d%%\n", progress)
	},
	Interval: 3000,  // Polling interval in ms (default: 3000)
	Timeout:  300000, // Max wait time in ms (default: 300000)
})
GetAccountInfo

Get account details including credits, usage, plan, etc.

account, err := client.Tasks.GetAccountInfo()
fmt.Printf("Email: %s\n", account.Email)
fmt.Printf("Credits: %d\n", account.Credits)
fmt.Printf("Plan: %s\n", account.Plan)

Error Handling

import "github.com/apiframe-ai/apiframe-go-sdk"

task, err := client.Midjourney.Imagine(apiframe.MidjourneyImagineParams{
	Prompt: "...",
})
if err != nil {
	switch e := err.(type) {
	case *apiframe.AuthenticationError:
		fmt.Println("Invalid API key")
	case *apiframe.RateLimitError:
		fmt.Println("Rate limit exceeded")
	case *apiframe.TimeoutError:
		fmt.Println("Request timed out")
	case *apiframe.Error:
		fmt.Printf("API error: %s (status: %d)\n", e.Message, e.Status)
	default:
		fmt.Printf("Error: %v\n", err)
	}
	return
}

Environment Variables

You can set your API key using an environment variable:

export APIFRAME_API_KEY=your_api_key_here

Then in your code:

import "os"

client, err := apiframe.NewClient(apiframe.Config{
	APIKey: os.Getenv("APIFRAME_API_KEY"),
})

Examples

Check the /examples directory for complete examples:

  • quickstart/ - Quick start example
  • midjourney/ - Midjourney Original API usage
  • flux/ - Flux AI image generation
  • luma_video/ - Luma video generation
  • suno_music/ - Suno music generation
  • media_upload/ - Media upload and usage
  • comprehensive/ - All features demo

To run an example:

cd examples/quickstart
export APIFRAME_API_KEY=your_api_key
go run main.go

Requirements

  • Go 1.21 or higher
  • An Apiframe API key (get one at apiframe.ai)

Documentation

For detailed API documentation, visit docs.apiframe.ai

Support

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Made with ❤️ by the Apiframe team

Documentation

Overview

Package apiframe provides a Go client library for the Apiframe API.

Apiframe is the ultimate platform for AI image and video generation APIs, supporting multiple AI services including Midjourney, Flux, Ideogram, Luma, Suno, Udio, Runway, Kling, and AI Photos.

Installation

go get github.com/apiframe-ai/apiframe-go-sdk

Quick Start

Create a client and generate an image:

package main

import (
    "fmt"
    "log"
    "os"

    "github.com/apiframe-ai/apiframe-go-sdk"
)

func main() {
    // Create client
    client, err := apiframe.NewClient(apiframe.Config{
        APIKey: os.Getenv("APIFRAME_API_KEY"),
    })
    if err != nil {
        log.Fatal(err)
    }

    // Generate an image
    task, err := client.Midjourney.Imagine(apiframe.MidjourneyImagineParams{
        Prompt:      "a beautiful sunset over mountains",
        AspectRatio: "16:9",
    })
    if err != nil {
        log.Fatal(err)
    }

    // Wait for completion
    result, err := client.Tasks.WaitFor(task.ID, &apiframe.WaitForOptions{
        OnProgress: func(progress int) {
            fmt.Printf("Progress: %d%%\n", progress)
        },
    })
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Images: %v\n", result.ImageURLs)
}

Services

The SDK provides access to the following services:

  • Tasks: Task management (Get, GetMany, WaitFor, GetAccountInfo)
  • Midjourney: Original Midjourney API (Imagine, Upscale, Variations, Blend, etc.)
  • MidjourneyAlt: Pro Midjourney API with Fast & Turbo modes
  • Flux: Flux AI image generation (Pro, Dev, Schnell models)
  • Ideogram: Creative image generation (Generate, Upscale, Describe, Remix)
  • Luma: Video generation (Generate, Extend)
  • Suno: Music generation (Generate, Upload, Extend, Generate Lyrics)
  • Udio: Advanced music creation
  • Runway: Gen-3 video generation (Text2Video, Image2Video, Video2Video)
  • Kling: Video generation and virtual try-on
  • AIPhotos: AI headshots and photo generation
  • Media: Image and audio upload

Error Handling

The SDK provides custom error types for different failure scenarios:

task, err := client.Midjourney.Imagine(params)
if err != nil {
    switch e := err.(type) {
    case *apiframe.AuthenticationError:
        fmt.Println("Invalid API key")
    case *apiframe.RateLimitError:
        fmt.Println("Rate limit exceeded")
    case *apiframe.TimeoutError:
        fmt.Println("Request timed out")
    case *apiframe.Error:
        fmt.Printf("API error: %s\n", e.Message)
    }
    return
}

Configuration

Configure the client with custom settings:

client, err := apiframe.NewClient(apiframe.Config{
    APIKey:  "your_api_key",
    BaseURL: "https://api.apiframe.ai", // Optional
    Timeout: 300000,                    // Optional (milliseconds)
})

Progress Tracking

Track task progress with callbacks:

result, err := client.Tasks.WaitFor(taskID, &apiframe.WaitForOptions{
    OnProgress: func(progress int) {
        fmt.Printf("Progress: %d%%\n", progress)
    },
    Interval: 3000,  // Polling interval in ms
    Timeout:  300000, // Max wait time in ms
})

Documentation

For more information, visit:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthenticationError

func NewAuthenticationError(message string) error

NewAuthenticationError creates a new authentication error

func NewRateLimitError

func NewRateLimitError(message string) error

NewRateLimitError creates a new rate limit error

func NewTimeoutError

func NewTimeoutError(message string) error

NewTimeoutError creates a new timeout error

Types

type AIPhotos

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

AIPhotos provides methods for AI Photos generation

func NewAIPhotos

func NewAIPhotos(httpClient *HTTPClient) *AIPhotos

NewAIPhotos creates a new AIPhotos service

func (*AIPhotos) Generate

func (a *AIPhotos) Generate(params AIPhotosGenerateParams) (*TaskResponse, error)

Generate generates realistic photos of the subject using the trained model

func (*AIPhotos) Train

func (a *AIPhotos) Train(params AIPhotosTrainParams) (*TaskResponse, error)

Train trains AI on a human subject using previously uploaded and prepared images

func (*AIPhotos) Upload

func (a *AIPhotos) Upload(params AIPhotosUploadParams) (*TaskResponse, error)

Upload uploads 10 to 30 images of the subject and prepares them for AI training

type AIPhotosGenerateParams

type AIPhotosGenerateParams struct {
	TrainingID     string `json:"training_id"`
	Prompt         string `json:"prompt"`
	AspectRatio    string `json:"aspect_ratio,omitempty"`
	Width          string `json:"width,omitempty"`
	Height         string `json:"height,omitempty"`
	NumberOfImages string `json:"number_of_images,omitempty"` // 1-4
	Seed           *int   `json:"seed,omitempty"`
}

AIPhotosGenerateParams represents parameters for AI Photos generation

type AIPhotosTrainParams

type AIPhotosTrainParams struct {
	TrainingImagesID string `json:"training_images_id"`
	TriggerWord      string `json:"trigger_word,omitempty"` // Default: 'TOKMSN'
	WebhookURL       string `json:"webhook_url,omitempty"`
	WebhookSecret    string `json:"webhook_secret,omitempty"`
}

AIPhotosTrainParams represents parameters for AI Photos training

type AIPhotosUploadParams

type AIPhotosUploadParams struct {
	Images        []string `json:"images"` // Base64 array of 10-30 images
	Ethnicity     string   `json:"ethnicity"`
	Gender        string   `json:"gender"` // 'female', 'male'
	Age           int      `json:"age"`
	WebhookURL    string   `json:"webhook_url,omitempty"`
	WebhookSecret string   `json:"webhook_secret,omitempty"`
}

AIPhotosUploadParams represents parameters for AI Photos upload

type AccountInfo

type AccountInfo struct {
	Email       string `json:"email"`
	Credits     int    `json:"credits"`
	TotalImages int    `json:"total_images"`
	Plan        string `json:"plan"`
}

AccountInfo represents account information

type AuthenticationError

type AuthenticationError struct {
	Err *Error
}

AuthenticationError represents an authentication error (401)

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

Error implements the error interface

type Client

type Client struct {

	// Tasks provides task management methods
	Tasks *Tasks

	// Midjourney provides Original Midjourney API methods
	Midjourney *Midjourney

	// MidjourneyAlt provides Pro Midjourney API methods with Fast & Turbo modes
	MidjourneyAlt *MidjourneyAlt

	// Flux provides Flux AI image generation methods
	Flux *Flux

	// Ideogram provides Ideogram image generation methods
	Ideogram *Ideogram

	// Luma provides Luma AI video generation methods
	Luma *Luma

	// Suno provides Suno AI music generation methods
	Suno *Suno

	// Udio provides Udio AI music generation methods
	Udio *Udio

	// Runway provides Runway ML video generation methods
	Runway *Runway

	// Kling provides Kling AI video generation methods
	Kling *Kling

	// AIPhotos provides AI Photos generation methods
	AIPhotos *AIPhotos

	// Media provides media upload methods
	Media *Media
	// contains filtered or unexported fields
}

Client is the main Apiframe SDK client

Example usage:

client, err := apiframe.NewClient(apiframe.Config{
	APIKey: "your_api_key_here",
})
if err != nil {
	log.Fatal(err)
}

task, err := client.Midjourney.Imagine(apiframe.MidjourneyImagineParams{
	Prompt:      "a beautiful sunset",
	AspectRatio: "16:9",
})
if err != nil {
	log.Fatal(err)
}

result, err := client.Tasks.WaitFor(task.ID, &apiframe.WaitForOptions{
	OnProgress: func(progress int) {
		fmt.Printf("Progress: %d%%\n", progress)
	},
})

func NewClient

func NewClient(config Config) (*Client, error)

NewClient creates a new Apiframe client with the given configuration

type Config

type Config struct {
	APIKey  string
	BaseURL string
	Timeout int // in milliseconds
}

Config holds configuration for the Apiframe client

type Error

type Error struct {
	Message string
	Code    string
	Status  int
	Details interface{}
}

Error represents a general Apiframe SDK error

func NewError

func NewError(message string, code string, status int, details interface{}) *Error

NewError creates a new Apiframe error

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface

type Flux

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

Flux provides methods for Flux AI image generation

func NewFlux

func NewFlux(httpClient *HTTPClient) *Flux

NewFlux creates a new Flux service

func (*Flux) Generate

func (f *Flux) Generate(params FluxGenerateParams) (*TaskResponse, error)

Generate generates images using Flux AI

func (*Flux) GenerateDev

func (f *Flux) GenerateDev(params FluxGenerateParams) (*TaskResponse, error)

GenerateDev generates images using Flux Dev Convenience method that sets model to 'flux-dev'

func (*Flux) GeneratePro

func (f *Flux) GeneratePro(params FluxGenerateParams) (*TaskResponse, error)

GeneratePro generates images using Flux Pro Convenience method that sets model to 'flux-pro'

func (*Flux) GenerateSchnell

func (f *Flux) GenerateSchnell(params FluxGenerateParams) (*TaskResponse, error)

GenerateSchnell generates images using Flux Schnell (fast mode) Convenience method that sets model to 'flux-schnell'

type FluxGenerateParams

type FluxGenerateParams struct {
	Model               string   `json:"model"` // 'flux-schnell', 'flux-pro', 'flux-dev', 'flux-pro-1.1', 'flux-pro-1.1-ultra'
	Prompt              string   `json:"prompt"`
	ImagePrompt         string   `json:"image_prompt,omitempty"`          // base64 encoded image
	ImagePromptStrength *float64 `json:"image_prompt_strength,omitempty"` // 0-1
	PromptUpsampling    *bool    `json:"prompt_upsampling,omitempty"`
	Width               *int     `json:"width,omitempty"`  // min 256, max 1440
	Height              *int     `json:"height,omitempty"` // min 256, max 1440
	AspectRatio         string   `json:"aspect_ratio,omitempty"`
	Steps               *int     `json:"steps,omitempty"`
	Guidance            *float64 `json:"guidance,omitempty"`
	Interval            *int     `json:"interval,omitempty"` // default 2, min 1, max 4
	Seed                *int     `json:"seed,omitempty"`
	SafetyTolerance     *int     `json:"safety_tolerance,omitempty"` // 0-6
	Raw                 *bool    `json:"raw,omitempty"`
	WebhookURL          string   `json:"webhook_url,omitempty"`
	WebhookSecret       string   `json:"webhook_secret,omitempty"`
}

FluxGenerateParams represents parameters for Flux generation

type HTTPClient

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

HTTPClient handles all HTTP requests to the Apiframe API

func NewHTTPClient

func NewHTTPClient(config Config) (*HTTPClient, error)

NewHTTPClient creates a new HTTP client

func (*HTTPClient) Delete

func (h *HTTPClient) Delete(url string, result interface{}) error

Delete performs a DELETE request

func (*HTTPClient) Get

func (h *HTTPClient) Get(url string, result interface{}) error

Get performs a GET request

func (*HTTPClient) Patch

func (h *HTTPClient) Patch(url string, body interface{}, result interface{}) error

Patch performs a PATCH request

func (*HTTPClient) Post

func (h *HTTPClient) Post(url string, body interface{}, result interface{}) error

Post performs a POST request

func (*HTTPClient) PostFormData

func (h *HTTPClient) PostFormData(url string, formData map[string]interface{}, result interface{}) error

PostFormData performs a POST request with multipart form data

func (*HTTPClient) Put

func (h *HTTPClient) Put(url string, body interface{}, result interface{}) error

Put performs a PUT request

func (*HTTPClient) SetFileBytes

func (h *HTTPClient) SetFileBytes(url string, fieldName string, fileName string, fileBytes []byte, result interface{}) error

SetFileBytes performs a POST request with a file

type Ideogram

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

Ideogram provides methods for Ideogram image generation

func NewIdeogram

func NewIdeogram(httpClient *HTTPClient) *Ideogram

NewIdeogram creates a new Ideogram service

func (*Ideogram) Describe

func (i *Ideogram) Describe(params IdeogramDescribeParams) (*TaskResponse, error)

Describe extensively describes a provided image

func (*Ideogram) Generate

func (i *Ideogram) Generate(params IdeogramGenerateParams) (*TaskResponse, error)

Generate generates images using Ideogram

func (*Ideogram) Remix

func (i *Ideogram) Remix(params IdeogramRemixParams) (*TaskResponse, error)

Remix generates images with remix (image-to-image)

func (*Ideogram) Upscale

func (i *Ideogram) Upscale(params IdeogramUpscaleParams) (*TaskResponse, error)

Upscale upscales an existing image to higher quality and resolution

type IdeogramDescribeParams

type IdeogramDescribeParams struct {
	ImageURL string `json:"image_url"`
}

IdeogramDescribeParams represents parameters for Ideogram describe

type IdeogramGenerateParams

type IdeogramGenerateParams struct {
	Prompt            string `json:"prompt"`
	StyleType         string `json:"style_type,omitempty"`
	NegativePrompt    string `json:"negative_prompt,omitempty"`
	Seed              *int   `json:"seed,omitempty"`
	MagicPromptOption string `json:"magic_prompt_option,omitempty"`
	AspectRatio       string `json:"aspect_ratio,omitempty"`
	Resolution        string `json:"resolution,omitempty"`
}

IdeogramGenerateParams represents parameters for Ideogram generation

type IdeogramRemixParams

type IdeogramRemixParams struct {
	ImageURL          string `json:"image_url"`
	Prompt            string `json:"prompt"`
	ImageWeight       int    `json:"image_weight"` // 1-100
	StyleType         string `json:"style_type,omitempty"`
	NegativePrompt    string `json:"negative_prompt,omitempty"`
	Seed              *int   `json:"seed,omitempty"`
	MagicPromptOption string `json:"magic_prompt_option,omitempty"`
	AspectRatio       string `json:"aspect_ratio,omitempty"`
	Resolution        string `json:"resolution,omitempty"`
}

IdeogramRemixParams represents parameters for Ideogram remix

type IdeogramUpscaleParams

type IdeogramUpscaleParams struct {
	ImageURL          string `json:"image_url"`
	Prompt            string `json:"prompt"`
	Resemblance       int    `json:"resemblance"`      // 1-100
	Detail            *int   `json:"detail,omitempty"` // 1-100
	Seed              *int   `json:"seed,omitempty"`
	MagicPromptOption string `json:"magic_prompt_option,omitempty"`
}

IdeogramUpscaleParams represents parameters for Ideogram upscale

type Kling

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

Kling provides methods for Kling AI video generation

func NewKling

func NewKling(httpClient *HTTPClient) *Kling

NewKling creates a new Kling service

func (*Kling) Generate

func (k *Kling) Generate(params KlingGenerateParams) (*TaskResponse, error)

Generate generates video based on a prompt and/or an image input

func (*Kling) ImageToVideo

func (k *Kling) ImageToVideo(imageURL string, prompt string, model string, mode string, duration int) (*TaskResponse, error)

ImageToVideo is a convenience method for image to video generation

func (*Kling) TextToVideo

func (k *Kling) TextToVideo(prompt string, aspectRatio string, model string, duration int) (*TaskResponse, error)

TextToVideo is a convenience method for text to video generation

func (*Kling) Tryon

func (k *Kling) Tryon(params KlingTryonParams) (*TaskResponse, error)

Tryon performs virtual try-on - generates an image of a person with the provided clothe image

type KlingGenerateParams

type KlingGenerateParams struct {
	Prompt         string   `json:"prompt"`
	GenerationType string   `json:"generation_type"` // 'text2video', 'image2video'
	NegativePrompt string   `json:"negative_prompt,omitempty"`
	ImageURL       string   `json:"image_url,omitempty"`
	EndImageURL    string   `json:"end_image_url,omitempty"`
	Mode           string   `json:"mode,omitempty"` // 'std', 'pro'
	AspectRatio    string   `json:"aspect_ratio,omitempty"`
	Model          string   `json:"model,omitempty"`     // 'kling-v1', 'kling-v1-5', 'kling-v1-6'
	Duration       *int     `json:"duration,omitempty"`  // 5 or 10
	CFGScale       *float64 `json:"cfg_scale,omitempty"` // 0-1
	WebhookURL     string   `json:"webhook_url,omitempty"`
	WebhookSecret  string   `json:"webhook_secret,omitempty"`
}

KlingGenerateParams represents parameters for Kling video generation

type KlingTryonParams

type KlingTryonParams struct {
	HumanImageURL string `json:"human_image_url"`
	ClothImageURL string `json:"cloth_image_url"`
	Model         string `json:"model,omitempty"` // 'kolors-virtual-try-on-v1', 'kolors-virtual-try-on-v1-5'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

KlingTryonParams represents parameters for Kling virtual try-on

type Luma

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

Luma provides methods for Luma AI video generation

func NewLuma

func NewLuma(httpClient *HTTPClient) *Luma

NewLuma creates a new Luma service

func (*Luma) Extend

func (l *Luma) Extend(params LumaExtendParams) (*TaskResponse, error)

Extend extends a previously generated video

func (*Luma) Generate

func (l *Luma) Generate(params LumaGenerateParams) (*TaskResponse, error)

Generate generates a video based on a prompt and/or an image input

type LumaExtendParams

type LumaExtendParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Prompt        string `json:"prompt"`
	ImageURL      string `json:"image_url,omitempty"`
	EndImageURL   string `json:"end_image_url,omitempty"`
	EnhancePrompt *bool  `json:"enhance_prompt,omitempty"`
	AspectRatio   string `json:"aspect_ratio,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

LumaExtendParams represents parameters for Luma video extension

type LumaGenerateParams

type LumaGenerateParams struct {
	Prompt        string `json:"prompt"`
	ImageURL      string `json:"image_url,omitempty"`
	EndImageURL   string `json:"end_image_url,omitempty"`
	EnhancePrompt *bool  `json:"enhance_prompt,omitempty"`
	AspectRatio   string `json:"aspect_ratio,omitempty"`
	Loop          *bool  `json:"loop,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

LumaGenerateParams represents parameters for Luma video generation

type Media

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

Media provides methods for media upload

func NewMedia

func NewMedia(httpClient *HTTPClient) *Media

NewMedia creates a new Media service

func (*Media) Upload

func (m *Media) Upload(filePath string, fileBytes []byte) (*MediaUploadResponse, error)

Upload uploads an image file (max 2MB) filePath can be a path to a file or fileBytes can be provided directly

func (*Media) UploadAudio

func (m *Media) UploadAudio(filePath string, fileBytes []byte) (*MediaUploadAudioResponse, error)

UploadAudio uploads an audio file (max 2MB and 60 seconds) filePath can be a path to a file or fileBytes can be provided directly

type MediaUploadAudioResponse

type MediaUploadAudioResponse struct {
	AudioURL string `json:"audioURL"`
}

MediaUploadAudioResponse represents a response from audio upload

type MediaUploadResponse

type MediaUploadResponse struct {
	ImageURL string `json:"imageURL"`
}

MediaUploadResponse represents a response from media upload

type Midjourney

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

Midjourney provides methods for the Original Midjourney API

func NewMidjourney

func NewMidjourney(httpClient *HTTPClient) *Midjourney

NewMidjourney creates a new Midjourney service

func (*Midjourney) Blend

func (m *Midjourney) Blend(params MidjourneyBlendParams) (*TaskResponse, error)

Blend blends multiple images into one image (2-5 images)

func (*Midjourney) Describe

func (m *Midjourney) Describe(params MidjourneyDescribeParams) (*TaskResponse, error)

Describe writes four example prompts based on an image

func (*Midjourney) ExtendVideo

func (m *Midjourney) ExtendVideo(params MidjourneyExtendVideoParams) (*TaskResponse, error)

ExtendVideo extends previously generated videos

func (*Midjourney) FaceSwap

func (m *Midjourney) FaceSwap(params MidjourneyFaceSwapParams) (*TaskResponse, error)

FaceSwap swaps faces between two images

func (*Midjourney) Imagine

func (m *Midjourney) Imagine(params MidjourneyImagineParams) (*TaskResponse, error)

Imagine creates a new image generation task

func (*Midjourney) ImagineVideo

func (m *Midjourney) ImagineVideo(params MidjourneyImagineVideoParams) (*TaskResponse, error)

ImagineVideo creates a video generation task using a text prompt and image URL

func (*Midjourney) Inpaint

func (m *Midjourney) Inpaint(params MidjourneyInpaintParams) (*TaskResponse, error)

Inpaint redraws a selected area of an image (Vary Region)

func (*Midjourney) Outpaint

func (m *Midjourney) Outpaint(params MidjourneyOutpaintParams) (*TaskResponse, error)

Outpaint enlarges an image's canvas beyond its original size (Zoom Out)

func (*Midjourney) Pan

func (m *Midjourney) Pan(params MidjourneyPanParams) (*TaskResponse, error)

Pan broadens the image canvas in a specific direction

func (*Midjourney) Reroll

func (m *Midjourney) Reroll(params MidjourneyRerollParams) (*TaskResponse, error)

Reroll creates new images from a previous Imagine task

func (*Midjourney) Seed

func (m *Midjourney) Seed(params MidjourneySeedParams) (*TaskResponse, error)

Seed gets the seed of a generated image

func (*Midjourney) Shorten

func (m *Midjourney) Shorten(params MidjourneyShortenParams) (*TaskResponse, error)

Shorten analyzes and suggests optimizations for a prompt

func (*Midjourney) Upscale

func (m *Midjourney) Upscale(params MidjourneyUpscaleParams) (*TaskResponse, error)

Upscale upscales a specific image from a generation (legacy method) Deprecated: Use Upscale1x, UpscaleAlt, or UpscaleHighres instead

func (*Midjourney) Upscale1x

func (m *Midjourney) Upscale1x(params MidjourneyUpscale1xParams) (*TaskResponse, error)

Upscale1x upscales one of the 4 generated images to get a single image

func (*Midjourney) UpscaleAlt

func (m *Midjourney) UpscaleAlt(params MidjourneyUpscaleAltParams) (*TaskResponse, error)

UpscaleAlt upscales with Subtle or Creative mode Subtle doubles the size keeping details similar to original, Creative adds details

func (*Midjourney) UpscaleHighres

func (m *Midjourney) UpscaleHighres(params MidjourneyUpscaleHighresParams) (*TaskResponse, error)

UpscaleHighres upscales any image to higher resolution (2x or 4x) Image must not be larger than 2048x2048

func (*Midjourney) Variations

func (m *Midjourney) Variations(params MidjourneyVariationsParams) (*TaskResponse, error)

Variations creates 4 new variations of one of the 4 generated images

func (*Midjourney) Vary

func (m *Midjourney) Vary(params MidjourneyVaryParams) (*TaskResponse, error)

Vary creates variations of a specific image (legacy method) Deprecated: Use Variations instead

func (*Midjourney) Zoom

func (m *Midjourney) Zoom(params MidjourneyZoomParams) (*TaskResponse, error)

Zoom zooms out from an image (legacy method) Deprecated: Use Outpaint instead

type MidjourneyAlt

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

MidjourneyAlt provides methods for the Pro Midjourney API Advanced version with Fast and Turbo modes

func NewMidjourneyAlt

func NewMidjourneyAlt(httpClient *HTTPClient) *MidjourneyAlt

NewMidjourneyAlt creates a new MidjourneyAlt service

func (*MidjourneyAlt) GetAccountInfo

func (m *MidjourneyAlt) GetAccountInfo() (map[string]interface{}, error)

GetAccountInfo retrieves account information (Pro API)

func (*MidjourneyAlt) GetGeneration

func (m *MidjourneyAlt) GetGeneration(generationID string) (*TaskResponse, error)

GetGeneration retrieves generation info by ID (Pro API)

func (*MidjourneyAlt) Imagine

Imagine creates a new image generation task (Pro API) Supports Fast and Turbo modes

func (*MidjourneyAlt) Pan

Pan pans in a specific direction (Pro API)

func (*MidjourneyAlt) Upscale

Upscale upscales a specific image from a generation (Pro API)

func (*MidjourneyAlt) Variations

Variations generates 4 variations of a specific image (Pro API)

func (*MidjourneyAlt) Vary

Vary creates variations of a specific image with strong/subtle control (Pro API)

func (*MidjourneyAlt) Zoom

Zoom zooms out from an image (Pro API)

type MidjourneyAltImagineParams

type MidjourneyAltImagineParams struct {
	Prompt        string `json:"prompt"`
	Mode          string `json:"mode,omitempty"` // 'fast' or 'turbo'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyAltImagineParams represents parameters for Pro imagine request

type MidjourneyAltPanParams

type MidjourneyAltPanParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"`
	Type          string `json:"type"` // 'up', 'down', 'left', 'right'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyAltPanParams represents parameters for Pro pan request

type MidjourneyAltUpscaleParams

type MidjourneyAltUpscaleParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"`
	Type          string `json:"type"` // 'subtle' or 'creative'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyAltUpscaleParams represents parameters for Pro upscale request

type MidjourneyAltVariationsParams

type MidjourneyAltVariationsParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyAltVariationsParams represents parameters for Pro variations request

type MidjourneyAltVaryParams

type MidjourneyAltVaryParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"`
	Type          string `json:"type"` // 'strong' or 'subtle'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyAltVaryParams represents parameters for Pro vary request

type MidjourneyAltZoomParams

type MidjourneyAltZoomParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"`
	Type          string `json:"type"` // '1.5', '2', '{1, 2}', '1'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyAltZoomParams represents parameters for Pro zoom request

type MidjourneyBlendParams

type MidjourneyBlendParams struct {
	ImageURLs     []string `json:"image_urls"` // Min 2, max 5
	Dimension     string   `json:"dimension,omitempty"`
	WebhookURL    string   `json:"webhook_url,omitempty"`
	WebhookSecret string   `json:"webhook_secret,omitempty"`
}

MidjourneyBlendParams represents parameters for blend request

type MidjourneyDescribeParams

type MidjourneyDescribeParams struct {
	ImageURL      string `json:"image_url"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyDescribeParams represents parameters for describe request

type MidjourneyExtendVideoParams

type MidjourneyExtendVideoParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"`
	Prompt        string `json:"prompt"`
	ImageURL      string `json:"image_url,omitempty"`
	Motion        string `json:"motion,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyExtendVideoParams represents parameters for extend video request

type MidjourneyFaceSwapParams

type MidjourneyFaceSwapParams struct {
	TargetImageURL string `json:"target_image_url"`
	SwapImageURL   string `json:"swap_image_url"`
	WebhookURL     string `json:"webhook_url,omitempty"`
	WebhookSecret  string `json:"webhook_secret,omitempty"`
}

MidjourneyFaceSwapParams represents parameters for face swap request

type MidjourneyImagineParams

type MidjourneyImagineParams struct {
	Prompt        string `json:"prompt"`
	AspectRatio   string `json:"aspect_ratio,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyImagineParams represents parameters for imagine request

type MidjourneyImagineVideoParams

type MidjourneyImagineVideoParams struct {
	Prompt        string `json:"prompt"`
	ImageURL      string `json:"image_url"`
	Motion        string `json:"motion,omitempty"` // 'low' or 'high'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyImagineVideoParams represents parameters for imagine video request

type MidjourneyInpaintParams

type MidjourneyInpaintParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Mask          string `json:"mask"` // Base64 encoding
	Prompt        string `json:"prompt"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyInpaintParams represents parameters for inpaint request

type MidjourneyOutpaintParams

type MidjourneyOutpaintParams struct {
	ParentTaskID  string  `json:"parent_task_id"`
	ZoomRatio     float64 `json:"zoom_ratio"` // 1.5, 2, or 1
	AspectRatio   string  `json:"aspect_ratio,omitempty"`
	Prompt        string  `json:"prompt,omitempty"`
	WebhookURL    string  `json:"webhook_url,omitempty"`
	WebhookSecret string  `json:"webhook_secret,omitempty"`
}

MidjourneyOutpaintParams represents parameters for outpaint request

type MidjourneyPanParams

type MidjourneyPanParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Direction     string `json:"direction"` // 'up', 'down', 'left', 'right'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyPanParams represents parameters for pan request

type MidjourneyRerollParams

type MidjourneyRerollParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Prompt        string `json:"prompt,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyRerollParams represents parameters for reroll request

type MidjourneySeedParams

type MidjourneySeedParams struct {
	TaskID        string `json:"task_id"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneySeedParams represents parameters for seed request

type MidjourneyShortenParams

type MidjourneyShortenParams struct {
	Prompt        string `json:"prompt"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyShortenParams represents parameters for shorten request

type MidjourneyUpscale1xParams

type MidjourneyUpscale1xParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"` // '1', '2', '3', '4'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyUpscale1xParams represents parameters for upscale 1x request

type MidjourneyUpscaleAltParams

type MidjourneyUpscaleAltParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Type          string `json:"type"` // 'subtle' or 'creative'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyUpscaleAltParams represents parameters for upscale alt request

type MidjourneyUpscaleHighresParams

type MidjourneyUpscaleHighresParams struct {
	ParentTaskID  string `json:"parent_task_id,omitempty"`
	ImageURL      string `json:"image_url,omitempty"`
	Type          string `json:"type"` // '2x' or '4x'
	Index         string `json:"index,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyUpscaleHighresParams represents parameters for upscale highres request

type MidjourneyUpscaleParams

type MidjourneyUpscaleParams struct {
	TaskID string `json:"taskId"`
	Index  string `json:"index"`
}

MidjourneyUpscaleParams represents parameters for legacy upscale request

type MidjourneyVariationsParams

type MidjourneyVariationsParams struct {
	ParentTaskID  string `json:"parent_task_id"`
	Index         string `json:"index"` // '1', '2', '3', '4', 'strong', 'subtle'
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

MidjourneyVariationsParams represents parameters for variations request

type MidjourneyVaryParams

type MidjourneyVaryParams struct {
	TaskID   string `json:"taskId"`
	Index    string `json:"index"`
	Strength int    `json:"strength,omitempty"`
}

MidjourneyVaryParams represents parameters for legacy vary request

type MidjourneyZoomParams

type MidjourneyZoomParams struct {
	TaskID string `json:"taskId"`
	Zoom   int    `json:"zoom,omitempty"`
}

MidjourneyZoomParams represents parameters for legacy zoom request

type RateLimitError

type RateLimitError struct {
	Err *Error
}

RateLimitError represents a rate limit error (429)

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

Error implements the error interface

type Runway

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

Runway provides methods for Runway ML video generation

func NewRunway

func NewRunway(httpClient *HTTPClient) *Runway

NewRunway creates a new Runway service

func (*Runway) Generate

func (r *Runway) Generate(params RunwayGenerateParams) (*TaskResponse, error)

Generate generates video based on a prompt and/or an image input or a video input

func (*Runway) ImageToVideo

func (r *Runway) ImageToVideo(imageURL string, prompt string, model string, duration int) (*TaskResponse, error)

ImageToVideo is a convenience method for image to video generation

func (*Runway) TextToVideo

func (r *Runway) TextToVideo(prompt string, aspectRatio string, model string, duration int) (*TaskResponse, error)

TextToVideo is a convenience method for text to video generation

func (*Runway) VideoToVideo

func (r *Runway) VideoToVideo(videoURL string, prompt string, model string, duration int) (*TaskResponse, error)

VideoToVideo is a convenience method for video to video generation

type RunwayGenerateParams

type RunwayGenerateParams struct {
	Prompt         string `json:"prompt"`
	GenerationType string `json:"generation_type"` // 'text2video', 'image2video', 'video2video'
	ImageURL       string `json:"image_url,omitempty"`
	EndImageURL    string `json:"end_image_url,omitempty"`
	VideoURL       string `json:"video_url,omitempty"`
	AspectRatio    string `json:"aspect_ratio,omitempty"`
	Model          string `json:"model,omitempty"`    // 'gen3', 'gen3a_turbo'
	Duration       *int   `json:"duration,omitempty"` // 5 or 10
	Flip           *bool  `json:"flip,omitempty"`
	WebhookURL     string `json:"webhook_url,omitempty"`
	WebhookSecret  string `json:"webhook_secret,omitempty"`
}

RunwayGenerateParams represents parameters for Runway video generation

type Suno

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

Suno provides methods for Suno AI music generation

func NewSuno

func NewSuno(httpClient *HTTPClient) *Suno

NewSuno creates a new Suno service

func (*Suno) Extend

func (s *Suno) Extend(params SunoExtendParams) (*TaskResponse, error)

Extend extends a previously generated song or an uploaded audio

func (*Suno) Generate

func (s *Suno) Generate(params SunoGenerateParams) (*TaskResponse, error)

Generate generates a song with a lyrics video clip This endpoint generates TWO songs with the same lyrics

func (*Suno) GenerateLyrics

func (s *Suno) GenerateLyrics(params SunoLyricsParams) (*TaskResponse, error)

GenerateLyrics generates song lyrics based on a prompt

func (*Suno) Upload

func (s *Suno) Upload(params SunoUploadParams) (*TaskResponse, error)

Upload uploads an audio file and turns it into an extendable song

type SunoExtendParams

type SunoExtendParams struct {
	ParentTaskID  string `json:"parent_task_id,omitempty"`
	SongID        string `json:"song_id,omitempty"`
	ContinueAt    int    `json:"continue_at"` // timestamp in seconds
	FromUpload    *bool  `json:"from_upload,omitempty"`
	Prompt        string `json:"prompt,omitempty"`
	Lyrics        string `json:"lyrics,omitempty"`
	Title         string `json:"title,omitempty"`
	Tags          string `json:"tags,omitempty"`
	WebhookURL    string `json:"webhook_url,omitempty"`
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

SunoExtendParams represents parameters for Suno song extension

type SunoGenerateParams

type SunoGenerateParams struct {
	Prompt           string `json:"prompt"`
	Lyrics           string `json:"lyrics,omitempty"`
	Model            string `json:"model,omitempty"` // 'chirp-v3-0', 'chirp-v3-5', 'chirp-v4'
	MakeInstrumental *bool  `json:"make_instrumental,omitempty"`
	Title            string `json:"title,omitempty"`
	Tags             string `json:"tags,omitempty"`
	WebhookURL       string `json:"webhook_url,omitempty"`
	WebhookSecret    string `json:"webhook_secret,omitempty"`
}

SunoGenerateParams represents parameters for Suno music generation

type SunoLyricsParams

type SunoLyricsParams struct {
	Prompt string `json:"prompt"`
}

SunoLyricsParams represents parameters for Suno lyrics generation

type SunoUploadParams

type SunoUploadParams struct {
	AudioURL string `json:"audio_url"`
}

SunoUploadParams represents parameters for Suno audio upload

type TaskResponse

type TaskResponse struct {
	ID               string      `json:"id"`
	TaskID           string      `json:"task_id,omitempty"` // For normalization
	Status           TaskStatus  `json:"status"`
	Progress         int         `json:"progress,omitempty"`
	Percentage       interface{} `json:"percentage,omitempty"` // Can be string or int
	Result           interface{} `json:"result,omitempty"`
	Error            string      `json:"error,omitempty"`
	Message          string      `json:"message,omitempty"`
	CreatedAt        string      `json:"createdAt,omitempty"`
	UpdatedAt        string      `json:"updatedAt,omitempty"`
	ImageURL         string      `json:"imageUrl,omitempty"`
	ImageURLs        []string    `json:"image_urls,omitempty"`
	OriginalImageURL string      `json:"original_image_url,omitempty"`
	DownloadURL      string      `json:"downloadUrl,omitempty"`
	VideoURL         string      `json:"videoUrl,omitempty"`
	Actions          []string    `json:"actions,omitempty"`
	TaskType         string      `json:"task_type,omitempty"`
}

TaskResponse represents a task response from the API

type TaskStatus

type TaskStatus string

TaskStatus represents the status of a task

const (
	TaskStatusPending    TaskStatus = "pending"
	TaskStatusProcessing TaskStatus = "processing"
	TaskStatusCompleted  TaskStatus = "completed"
	TaskStatusFailed     TaskStatus = "failed"
)

type Tasks

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

Tasks provides methods for task management

func NewTasks

func NewTasks(httpClient *HTTPClient) *Tasks

NewTasks creates a new Tasks service

func (*Tasks) Get

func (t *Tasks) Get(taskID string) (*TaskResponse, error)

Get retrieves the status of a task

func (*Tasks) GetAccountInfo

func (t *Tasks) GetAccountInfo() (*AccountInfo, error)

GetAccountInfo retrieves account information including credits, usage, plan, etc.

func (*Tasks) GetMany

func (t *Tasks) GetMany(taskIDs []string) (*TasksResponse, error)

GetMany retrieves the status/results of multiple tasks (min 2, max 20)

func (*Tasks) WaitFor

func (t *Tasks) WaitFor(taskID string, options *WaitForOptions) (*TaskResponse, error)

WaitFor waits for a task to complete with optional progress callback

type TasksResponse

type TasksResponse struct {
	Tasks []TaskResponse `json:"tasks"`
}

TasksResponse represents a response with multiple tasks

type TimeoutError

type TimeoutError struct {
	Err *Error
}

TimeoutError represents a timeout error (408)

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

Error implements the error interface

type Udio

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

Udio provides methods for Udio AI music generation

func NewUdio

func NewUdio(httpClient *HTTPClient) *Udio

NewUdio creates a new Udio service

func (*Udio) Generate

func (u *Udio) Generate(params UdioGenerateParams) (*TaskResponse, error)

Generate generates a music song using Udio AI This endpoint generates TWO different songs with their own lyrics

type UdioGenerateParams

type UdioGenerateParams struct {
	Prompt                   string   `json:"prompt"`
	Lyrics                   string   `json:"lyrics,omitempty"`
	Model                    string   `json:"model,omitempty"` // 'udio32-v1.5', 'udio130-v1.5'
	BypassPromptOptimization *bool    `json:"bypass_prompt_optimization,omitempty"`
	PromptStrength           *float64 `json:"prompt_strength,omitempty"`
	ClarityStrength          *float64 `json:"clarity_strength,omitempty"`
	LyricsStrength           *float64 `json:"lyrics_strength,omitempty"`
	GenerationQuality        *float64 `json:"generation_quality,omitempty"`
	NegativePrompt           string   `json:"negative_prompt,omitempty"`
	LyricsPlacementStart     *int     `json:"lyrics_placement_start,omitempty"`
	LyricsPlacementEnd       *int     `json:"lyrics_placement_end,omitempty"`
	Tags                     string   `json:"tags,omitempty"`
	WebhookURL               string   `json:"webhook_url,omitempty"`
	WebhookSecret            string   `json:"webhook_secret,omitempty"`
}

UdioGenerateParams represents parameters for Udio music generation

type ValidationError

type ValidationError struct {
	*Error
}

ValidationError represents a validation error (400)

func NewValidationError

func NewValidationError(message string, details interface{}) *ValidationError

NewValidationError creates a new validation error

type WaitForOptions

type WaitForOptions struct {
	OnProgress func(progress int) // Callback for progress updates
	Interval   int                // Polling interval in milliseconds (default: 3000)
	Timeout    int                // Timeout in milliseconds (default: 300000)
}

WaitForOptions configures the behavior of WaitFor

Directories

Path Synopsis
examples
comprehensive command
flux command
luma_video command
media_upload command
midjourney command
quickstart command
suno_music command

Jump to

Keyboard shortcuts

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