Typed sync and async Python SDK for Imagegen Bridge
Project description
Imagegen Bridge Python SDK
Typed sync and async clients for the normalized Imagegen Bridge HTTP API. The package targets Python 3.10 and newer.
uv add imagegen-bridge
from imagegen_bridge import (
AsyncImagegenBridgeClient,
ImagePresetCreate,
ImagePresetTemplate,
ImageRequest,
OutputOptions,
ProviderRoute,
RoutingOptions,
)
async with AsyncImagegenBridgeClient("http://127.0.0.1:8787") as client:
result = await client.images.generate(ImageRequest.generate(
"a paper fox",
output=OutputOptions(
response_format="artifact",
directory="illustrations",
filename="fox.png",
collision="suffix",
metadata="sidecar",
),
routing=RoutingOptions(
provider="codex-app-server",
fallbacks=(ProviderRoute("codex-responses", "gpt-image-2"),),
),
))
print(result.data[0].name, result.data[0].metadata_name)
queued = await client.jobs.create(ImageRequest.generate("a second paper fox"))
partial = await client.jobs.partial(queued.id) # transient while the job runs
completed = await client.jobs.get(queued.id)
preset = await client.presets.create(ImagePresetCreate(
name="paper-fox",
template=ImagePresetTemplate(prompt="a paper fox"),
))
page = await client.jobs.list(
status="succeeded", visibility="active", favorite=True, search="paper fox"
)
diagnostics = await client.diagnostics()
print(diagnostics.configuration.listener_scope, diagnostics.providers)
Set provider in ImageRequest.routing to switch between configured bridge
providers; client construction and response types do not change.
Fallback routes are ordered and returned as typed provider attempts.
OutputOptions.transparency selects native or local chroma-key alpha when the
generation parameters request a transparent background.
OutputOptions.metadata accepts none, sidecar, embedded, or
sidecar_and_embedded. Embedded XMP is carried inside the returned PNG, JPEG,
or WebP bytes; the latter combined mode requires artifact output.
client.jobs is also available on the synchronous client and exposes
create, get, list, partial, cancel, and update with typed durable job
models. partial returns the latest verified in-memory preview and normally
returns 404 before the first partial event or after the job becomes terminal.
List filters include stable cursor pagination, status, active/hidden/all
visibility, favorite state, and literal prompt search.
client.presets exposes typed list, get, create, update, and delete
operations for reusable input-free request configurations.
diagnostics() returns the same typed, redaction-safe operator snapshot used by
the embedded dashboard; it never includes credential values, prompts, or host
paths.
Plain HTTP is accepted only for literal loopback addresses and localhost.
Remote bridge URLs must use HTTPS unless the caller explicitly sets
allow_insecure_remote_http=True, which disables transport confidentiality and
server authentication. Redirects remain governed by HTTPX and should not be
enabled for credential-bearing clients.
Per-call timeout omission inherits the timeout configured on the client;
passing None explicitly disables HTTPX timeouts for that call, while a number
or httpx.Timeout overrides them. Ordinary JSON bodies, error bodies, partial
previews, SSE lines, and aggregate SSE events have independent configurable
limits and are counted while streaming. Idempotency-Key can be supplied with
idempotency_key= to both image and durable-job creation methods.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imagegen_bridge-0.1.0.tar.gz.
File metadata
- Download URL: imagegen_bridge-0.1.0.tar.gz
- Upload date:
- Size: 44.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04d4b193404d249a4c7c6257c3815cbc1de88dd912d3bf6408461e9d42da9a0c
|
|
| MD5 |
58787555e40602809eeb606e7f67ccf8
|
|
| BLAKE2b-256 |
69e7a23d5b839cdc4de69af107a102d8da43b1a62ed34594e7514e7923855fe8
|
Provenance
The following attestation bundles were made for imagegen_bridge-0.1.0.tar.gz:
Publisher:
publish.yml on Crimsab/imagegen-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imagegen_bridge-0.1.0.tar.gz -
Subject digest:
04d4b193404d249a4c7c6257c3815cbc1de88dd912d3bf6408461e9d42da9a0c - Sigstore transparency entry: 2170885590
- Sigstore integration time:
-
Permalink:
Crimsab/imagegen-bridge@972abe692367678afdb725af2f5aa660983bba02 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Crimsab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@972abe692367678afdb725af2f5aa660983bba02 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file imagegen_bridge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: imagegen_bridge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c86173c578260835e57048a00300bfadc941ee4379e34b3021eeed2ba63394b6
|
|
| MD5 |
c4860f3400612ad0daf9c6d3246531c4
|
|
| BLAKE2b-256 |
e5f4597c12680241409e1cc8417c210315d61445bc35d8c11c9310eee3618632
|
Provenance
The following attestation bundles were made for imagegen_bridge-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Crimsab/imagegen-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imagegen_bridge-0.1.0-py3-none-any.whl -
Subject digest:
c86173c578260835e57048a00300bfadc941ee4379e34b3021eeed2ba63394b6 - Sigstore transparency entry: 2170885611
- Sigstore integration time:
-
Permalink:
Crimsab/imagegen-bridge@972abe692367678afdb725af2f5aa660983bba02 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Crimsab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@972abe692367678afdb725af2f5aa660983bba02 -
Trigger Event:
workflow_dispatch
-
Statement type: