Skip to main content

GPT-4o Image text-to-image client for RunAPI

Project description

GPT-4o Image Python SDK for RunAPI

The GPT-4o Image Python SDK is the language-specific package for GPT-4o Image on RunAPI. Use it for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Python.

For model details, use https://runapi.ai/models/gpt-4o-image; for API reference, use https://runapi.ai/docs#gpt-4o-image; for SDK docs, use https://runapi.ai/docs#sdk-gpt-4o-image.

Install

pip install runapi-gpt-4o-image

Quick start

from runapi.gpt_4o_image import Gpt4oImageClient

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

task = client.text_to_image.create(
    model="gpt-4o-image",
    prompt="A cinematic product photo on warm paper",
    aspect_ratio="1:1",
)
status = client.text_to_image.get(task.id)

Use create to submit a task and return quickly, get to fetch the latest task state, and run to create and poll until completion:

result = client.text_to_image.run(
    model="gpt-4o-image",
    prompt="A futuristic cityscape at dusk",
    aspect_ratio="3:2",
)
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 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.gpt_4o_image error classes when building image jobs or scripts. The available resource is text_to_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_gpt_4o_image-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

runapi_gpt_4o_image-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for runapi_gpt_4o_image-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ce11eae086cd7126b09c20ed222eeae4c9772120be90d9e9a28985236d9c68a
MD5 54e204c3addd6ff9134c1562b51b3450
BLAKE2b-256 d672888dfd1f031c6af9542c92cd68d32dceabb43941217d3b10a3b04892b5ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runapi_gpt_4o_image-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 568bad8736b982a74d777004f596515d6241bdd0440438db75edc34888841efe
MD5 0f84f2d6b892b545674c8f1f072a5f7a
BLAKE2b-256 ed7a8b8b93535fb5e4868107ecde7adf06d187e37b95203631f8acf5213ec13c

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