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 dict('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.3.tar.gz (8.2 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.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yetter-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4c28396103670f0f15d94cf650315b023c7d82bc62ed29c22c7e02ee2f748aef
MD5 048a56e7b0a30e119f22f2bb8ebc628d
BLAKE2b-256 fb77ac5d191df975adead914ca35aa6b6a479e6af8626f0e753d8094dd094da7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yetter-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb05acce0350380bbcf53d88da5c6a53b49892ea6b2552168493acaf2048137f
MD5 ebb621d12b7422dbcf36273da7428d21
BLAKE2b-256 e50023918c37ebcd8f6e8c46f24286706df7a9bb859bb89fac1110d58e53bb6a

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