Metadata-Version: 2.4
Name: runapi-gpt-image
Version: 0.1.0
Summary: GPT Image text-to-image and edit-image client for RunAPI
Project-URL: Homepage, https://runapi.ai/models/gpt-image
Project-URL: Documentation, https://runapi.ai/docs#sdk-gpt-image
Author-email: RunAPI <contact@runapi.ai>
License-Expression: Apache-2.0
Keywords: ai,edit-image,gpt-image,runapi,sdk,text-to-image
Requires-Python: >=3.9
Requires-Dist: runapi-core
Description-Content-Type: text/markdown

# GPT Image Python SDK for RunAPI

The GPT Image Python SDK is the language-specific package for GPT Image on
RunAPI. Use it for text-to-image and edit-image 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-image; for API reference, use
https://runapi.ai/docs#gpt-image; for SDK docs, use https://runapi.ai/docs#sdk-gpt-image.

## Install

```bash
pip install runapi-gpt-image
```

## Quick start

```python
from runapi.gpt_image import GptImageClient

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

task = client.text_to_image.create(
    model="gpt-image-1.5",
    prompt="A futuristic cityscape at dusk, cinematic",
    aspect_ratio="1:1",
    quality="high",
)
status = client.text_to_image.get(task.id)

edit = client.edit_image.create(
    model="gpt-image-1.5",
    prompt="Transform into an oil painting",
    source_image_urls=["https://example.com/source.jpg"],
    aspect_ratio="1:1",
    quality="high",
)
```

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

```python
result = client.text_to_image.run(
    model="gpt-image-1.5",
    prompt="A serene mountain lake at dawn",
    aspect_ratio="3:2",
    quality="high",
)
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_image` error
classes when building image jobs or scripts. The available resources are
`text_to_image` and `edit_image`. Keep `RUNAPI_API_KEY` in the environment or
your secret manager; never commit API keys or callback secrets.

## Links

- Model page: https://runapi.ai/models/gpt-image
- SDK docs: https://runapi.ai/docs#sdk-gpt-image
- Product docs: https://runapi.ai/docs#gpt-image
- Pricing and rate limits: https://runapi.ai/models/gpt-image
- Full catalog: https://runapi.ai/models

## License

Licensed under the Apache License, Version 2.0.
