Skip to main content

Yetter Python Client

Project description

Yetter Python Client

A lightweight async Python client for the Yetter image generation API. It supports simple one-shot runs, subscription-style polling, and server-sent events (SSE) streaming.

Installation

pip install yetter

If the package is not yet published to PyPI, install from the repository:

pip install "yetter @ git+https://github.com/SqueezeBits/yetter-client"

Authentication & Configuration

Provide your API key in one of the following ways:

  • Environment variable (preferred):
export YTR_API_KEY="YOUR_API_KEY"
  • Programmatically via configure:
import asyncio
import yetter

async def main():
    yetter.configure(api_key="YOUR_API_KEY")
    # Optionally override endpoint:
    # yetter.configure(api_key="YOUR_API_KEY", api_endpoint="https://api.yetter.ai")

asyncio.run(main())

Quick start: one-shot run

Use yetter.run() for a convenient "submit + wait for completion" flow powered by streaming under the hood.

import asyncio
import yetter

async def main():
    yetter.configure(api_key="YOUR_API_KEY")
    result = await yetter.run(
        "ytr-ai/qwen/image/t2i",
        args={"prompt": "A beautiful landscape with a river and mountains"},
    )
    # result is GetResponseResponse(images=..., prompt=...)
    print(result)

asyncio.run(main())

Subscribe: polling with optional queue updates

yetter.subscribe() submits a request and polls status until completion. You can pass a callback to receive queue/status updates.

import asyncio
import yetter
from yetter.types import GetStatusResponse

async def on_update(status: GetStatusResponse):
    print("status:", status.status)

async def main():
    yetter.configure(api_key="YOUR_API_KEY")
    result = await yetter.subscribe(
        "ytr-ai/qwen/image/t2i",
        args={
            "prompt": "A beautiful landscape with a river and mountains",
            "num_images": 2,
        },
        on_queue_update=on_update,
    )
    print("final images:", result.images)

asyncio.run(main())

Examples

See the examples/ directory:

  • examples/run.py: minimal one-shot run
  • examples/subscribe.py: subscription with updates

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

yetter-0.0.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

yetter-0.0.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file yetter-0.0.2.tar.gz.

File metadata

  • Download URL: yetter-0.0.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for yetter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 001873edd3b3890d86a6223dc6cdf8a2502f8eaad6d1859d40f007e6e0f22038
MD5 500058147b826e0f27cf364cba8e8026
BLAKE2b-256 0587d5ae0b7173993793e62fc856fffc4a9d2705c2eb51b3da4436076c42aed0

See more details on using hashes here.

File details

Details for the file yetter-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: yetter-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for yetter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3823c6a520c5032d584335eadce40ba35e183eb2ac5481c0048dc9a70c7d3ac
MD5 78353f648b10f0f1cf575f5971caf611
BLAKE2b-256 f60cec8f7a4d60b4e544a69c10ef94204f8a8d9ae19f119a11c645062cede04e

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