Skip to main content

Flux 2 text-to-image and remix-image client for RunAPI

Project description

Flux 2 Python SDK for RunAPI

The flux 2 Python SDK is the language-specific package for Flux 2 on RunAPI. Use this flux 2 package for text-to-image, remix-image, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Python.

This flux 2 README is the Python package guide inside the public flux-2-sdk repository. For the repository overview, start at ../README.md; for model details, use https://runapi.ai/models/flux-2; for API reference, use https://runapi.ai/docs#flux-2; for SDK docs, use https://runapi.ai/docs#sdk-flux-2.

Install

pip install runapi-flux-2

Quick start

from runapi.flux_2 import Flux2Client

client = Flux2Client()  # reads RUNAPI_API_KEY, or pass api_key="sk-..."

task = client.text_to_image.create(
    model="flux-2-pro-text-to-image",
    prompt="A cinematic product photo on warm paper",
    aspect_ratio="1:1",
)
status = client.text_to_image.get(task.id)

remix = client.remix_image.create(
    model="flux-2-pro-remix-image",
    prompt="Turn this product shot into a warm editorial photo",
    source_image_urls=["https://example.com/source.jpg"],
    aspect_ratio="auto",
)

Use create when you want to submit a task and return quickly, get when you need the latest task state, and run when a script should create and poll until completion:

result = client.text_to_image.run(
    model="flux-2-pro-text-to-image",
    prompt="A futuristic cityscape at dusk",
)
print(result.images[0].url)

In web request handlers, prefer create plus webhook or later get polling so a worker is not held open.

RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.

Language notes

Pass parameters as keyword arguments and catch the runapi.flux_2 error classes when building image jobs or scripts. The available resources are text_to_image and remix_image. Keep RUNAPI_API_KEY in the environment or your secret manager; never commit API keys or callback secrets.

Links

License

Licensed under the Apache License, Version 2.0.

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

runapi_flux_2-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

runapi_flux_2-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file runapi_flux_2-0.1.0.tar.gz.

File metadata

  • Download URL: runapi_flux_2-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.6

File hashes

Hashes for runapi_flux_2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0665131c95067739c54d6566515ac94351a7c0119e2237ae8048b9ce667870cd
MD5 a690c5d29f350365b9569b90203b0141
BLAKE2b-256 ab2e35822c468e0884cb2c09c2cf774fb5d4fdcce2c71a4ad9ca87b6be2dec77

See more details on using hashes here.

File details

Details for the file runapi_flux_2-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for runapi_flux_2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d1c5428a309166accbf2bee5a2192ca5f8c3a7fbc2924f53baa1867ef56a508
MD5 f59e2fb3150571d3702958ac540a987c
BLAKE2b-256 bd472f77345f64ff37361f544cb03c10a78ad7e9aa4a61d441844e45320253e3

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