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.1.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.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yetter-0.0.1.tar.gz
  • Upload date:
  • Size: 8.2 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.1.tar.gz
Algorithm Hash digest
SHA256 587e326d682eca2293d05b006a5c68666a43e6eabd87a7e2e6384d089ebfb878
MD5 7c47fd87253c81ec4145a5b52ad13d82
BLAKE2b-256 8efaff4072cf6c4940fdd31cef24d677c29f2ce15e8fe4319fe5cda58a2d9f11

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yetter-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb4e6af0e763771003d63a0fe00a4820fa4c550c3eb64831263c2a8b59fea336
MD5 2376c40c12baeb2702e727a41555a16e
BLAKE2b-256 ae930c3b592372d706b78688a2da7647e0b5f4811f346b220875a24ce33071a1

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