Skip to main content

Official Python SDK for RunBlob — all AI models in one place. Fast, affordable, high-quality generations. runblob.com

Project description

RunBlob Python SDK

Official async Python SDK for the RunBlob AI generation platform.

Currently supported: Nano Banana (Gemini) image generation, Kling video and image generation (12+ models including O1, O3, Motion Control), Veo 3 video generation (Fast, Quality, up to 4K). More models coming in future updates.

For pricing, available models and API documentation visit runblob.com.

Install

pip install runblob

Nano Banana (Gemini) — Image Generation

import asyncio
from runblob import RunBlob

async def main():
    async with RunBlob(api_key="sk-...") as client:
        result = await client.nanobanana.generate_and_wait(
            prompt="A cute orange cat on a windowsill",
            model="pro",
            quality="4k",
        )
        print(result.result_image_url)

asyncio.run(main())

Kling — Video Generation

async with RunBlob(api_key="sk-...") as client:
    result = await client.kling.generate_and_wait(
        prompt="A cinematic sunset over the ocean",
        model="kling_2.5_turbo",
        duration="10",
        aspect_ratio="16:9",
    )
    print(result.video_url)

Kling — O3 Video (up to 15s)

async with RunBlob(api_key="sk-...") as client:
    result = await client.kling.generate_o3_video_and_wait(
        prompt="A dog running through a field of flowers",
        model="kling_o3_pro",
        duration="15",
    )
    print(result.video_url)

Kling — O3 Photo (up to 4K)

async with RunBlob(api_key="sk-...") as client:
    result = await client.kling.generate_o3_photo_and_wait(
        prompt="A portrait in studio lighting",
        img_resolution="4k",
        aspect_ratio="3:4",
    )
    print(result.image_url)

Kling — Image-to-Video

async with RunBlob(api_key="sk-...") as client:
    result = await client.kling.generate_and_wait(
        prompt="Make this photo come alive",
        model="kling_2.1",
        image_url="https://example.com/photo.jpg",
    )
    print(result.video_url)

Veo 3 — Fast Video

async with RunBlob(api_key="sk-...") as client:
    result = await client.veo.generate_and_wait(
        prompt="A cinematic drone shot flying over a mountain lake at sunrise",
        model="veo_3_fast",
        aspect_ratio="16:9",
    )
    print(result.video_url)

Veo 3 — Quality 4K

async with RunBlob(api_key="sk-...") as client:
    result = await client.veo.generate_and_wait(
        prompt="Slow motion shot of rain drops falling on autumn leaves",
        model="veo_3_quality_4k",
        aspect_ratio="16:9",
    )
    print(result.video_url)

Veo 3 — Image-to-Video

async with RunBlob(api_key="sk-...") as client:
    result = await client.veo.generate_and_wait(
        prompt="Make this photo come alive with gentle camera movement",
        model="veo_3_fast",
        bytes_image="base64_encoded_image_here",
    )
    print(result.video_url)

Batch generation

async with RunBlob(api_key="sk-...") as client:
    results = await client.nanobanana.generate_batch_and_wait(
        prompts=[
            "A red apple on a white table",
            "A mountain peak covered in snow",
            "An anime girl with blue hair",
        ],
        model="standard",
        concurrency=5,
    )
    for r in results:
        print(r.result_image_url)

Webhooks

async with RunBlob(api_key="sk-...") as client:
    await client.kling.generate(
        prompt="A forest at dawn",
        callback_url="https://your-server.com/webhook",
    )
from runblob import parse_webhook_payload

event = parse_webhook_payload(request_body)
if event.is_completed:
    print(event.result_image_url)

Error handling

from runblob import RunBlob, AuthenticationError, RateLimitError, RunBlobError

async with RunBlob(api_key="sk-...") as client:
    try:
        result = await client.kling.generate(prompt="test")
    except AuthenticationError:
        print("Invalid API key")
    except RateLimitError as e:
        print(f"Rate limited, retry after {e.retry_after}s")
    except RunBlobError as e:
        print(f"SDK error: {e}")

Configuration

client = RunBlob(
    api_key="sk-...",
    max_connections=200,
    rate_limit_rps=100.0,
    max_retries=5,
    timeout=60.0,
    circuit_breaker_threshold=10,
)

Requirements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runblob-0.2.1.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runblob-0.2.1-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file runblob-0.2.1.tar.gz.

File metadata

  • Download URL: runblob-0.2.1.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for runblob-0.2.1.tar.gz
Algorithm Hash digest
SHA256 05d4c909805bb770b674f381194b97d8264a6ab1eff89067de28eeb945a98c8d
MD5 e017cb96d6527dad22f37413ab132c45
BLAKE2b-256 df60c576fe69ff63c6fe01d26f43ce1b4c2fbe625e5fa4889f344992598fe717

See more details on using hashes here.

File details

Details for the file runblob-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: runblob-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for runblob-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39c21f42173c58abc5cc4af28ee058289fb974d1a77c920b57a42aef0d9a6159
MD5 cf348bde639593c1217eb14676c4d5bb
BLAKE2b-256 6f2478ffb5971a68ecb727be970b4d9b15a2e3b6c290ef873f5aa6d07e337d2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page