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. More models coming in future updates — Kling, Sora, Veo and others.

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

Install

pip install runblob

Quick Start

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())

Generate and poll separately

async with RunBlob(api_key="sk-...") as client:
    task = await client.nanobanana.generate(prompt="A sunset over the ocean")
    print(task.task_uuid)
    print(task.price)

    status = await client.nanobanana.get_status(task.task_uuid)
    print(status.status)

    result = await client.nanobanana.wait_for_result(task.task_uuid)
    print(result.result_image_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.nanobanana.generate(
        prompt="A forest at dawn",
        callback_url="https://your-server.com/webhook",
    )
from runblob import parse_webhook_payload, verify_webhook_signature

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.nanobanana.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.1.1.tar.gz (22.6 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.1.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for runblob-0.1.1.tar.gz
Algorithm Hash digest
SHA256 35647214bb7420ce5fbb5a691335e91f1032df24df42ff4491e903d6fe866341
MD5 faa7aa68a7de225828b00878ae64aeef
BLAKE2b-256 45c378b834a6a068cbe2d1bb216f4949152e1c1a3461ce75c739e8c93063a2c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: runblob-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.5 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc05d24d95f57efe56e89b8951cf712b86d275f09037d283dfe73e9b7cf5d89e
MD5 5a5eb0881e44bb7119fa52581a2a7ef9
BLAKE2b-256 de3a7c45269c74f6a62f7869b5215b80318af2dccf1e554e0bdc3a0f96b8069d

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