nolgia (Python SDK)
Official Python client for the Nolgia API, generated
from api/openapi.yaml with
openapi-python-client
(httpx-based). Published on PyPI as nolgia.
Every endpoint module exposes sync, sync_detailed, asyncio and
asyncio_detailed variants. Each sync call returns the typed success model,
or an Error (an RFC 7807 problem object) when the API refused the request.
Install
pip install nolgia
Requires Python 3.10 or later.
Authenticate
Requests carry a Personal Access Token (nol_...) as a bearer token. Create
one in the app at nolgia.com/settings/api-tokens
(or POST /pat with a signed-in session). The plaintext token is shown once.
from nolgia import AuthenticatedClient
client = AuthenticatedClient(base_url="https://api.nolgia.ai/v1", token="nol_...")
First image
POST /generate/image is asynchronous: it answers 202 with a job. Long-poll
GET /jobs/{id}/wait for the finished asset (images usually land in seconds).
from nolgia.api.generate import generate_image
from nolgia.api.jobs import wait_for_job
from nolgia.models import GenerateImageRequest, ImageModel, Job
job = generate_image.sync(
client=client,
body=GenerateImageRequest(model=ImageModel.GPT_IMAGE_2, prompt="a red fox in the snow"),
)
if not isinstance(job, Job):
raise SystemExit(f"refused: {job}")
done = wait_for_job.sync(job.id, client=client, timeout_seconds=120)
if isinstance(done, Job) and done.status == "succeeded":
print(done.asset.signed_url)
First video
Video is the same job model with a longer wait (timeout_seconds up to 900).
A 408 from wait means the job is still running: call it again.
from nolgia.api.generate import generate_video
from nolgia.models import GenerateVideoRequest, VideoModel
job = generate_video.sync(
client=client,
body=GenerateVideoRequest(
model=VideoModel.SEEDANCE_2_5,
prompt="a red fox trots through fresh snow at dawn, slow dolly in",
duration_seconds=5,
),
)
if not isinstance(job, Job):
raise SystemExit(f"refused: {job}")
done = wait_for_job.sync(job.id, client=client, timeout_seconds=600)
if isinstance(done, Job) and done.status == "succeeded":
print(done.asset.signed_url)
Wait for completion and handle moderation
The helper retries long-poll timeouts for up to 30 minutes by default and returns the job as a JSON dict. A wait timeout leaves the job running.
from nolgia.job_wait import JobModeratedError, wait_for_job
try:
done = wait_for_job(client, str(job.id))
print(done["asset"]["signed_url"])
except JobModeratedError as error:
print(error.message, error.credits_refunded)
failure.credits_refunded reports what the ledger did: true means refunded,
false means charged, and absent or null means unknown. Never read an absent
value as "no charge".
Submit and subscribe
subscribe submits, polls, and returns the final media URLs with the raw job.
import os; from nolgia import AuthenticatedClient, subscribe
client = AuthenticatedClient(base_url="https://api.nolgia.ai/v1", token=os.environ["NOLGIA_TOKEN"])
result = subscribe(client, "/generate/image", {"model": "flux-pro", "prompt": "a paper-cut mountain range"},
on_status=lambda u: print(u.status, u.progress))
print(result.url)
model is required on every generation request; GET /models is the live
catalog of ids, capabilities and prices. subscribe covers the endpoints that
answer 202 with a job: /generate/image, /generate/audio,
/generate/video, /generate/3d and /restore/video. /generate/set is not
one of them: it answers with an OutputSet polled through GET /sets/{id}.
submit accepts the same arguments and returns a handle with job_id, the raw
submit job, status(), cancel(), and a memoized synchronous result().
Polling starts only when result() is first called. Status callbacks fire
immediately and on changes; callback exceptions propagate.
NolgiaGenerationError carries an open code, http_status, job_id, and the
raw terminal job when available.
poll_interval defaults to 0.5 seconds and max_poll_time to 1800 seconds.
Timing out only stops waiting; it does not cancel generation, and credits are
still spent. cancel() cancels the job on the server
(POST /jobs/{id}/cancel), returns the canceled job and makes result() raise
code canceled. The job's cancellation says what the model provider did and
whether the credits were refunded: a job that had not reached the provider is
refunded in full, and a started render is refunded only when the provider stops
it without billing (settlement can read pending until the provider
answers). A canceled job is never added to your library. A job that already
finished raises code job_not_cancellable and keeps its own result.
List assets
from nolgia.api.assets import list_assets
from nolgia.models import AssetPage
page = list_assets.sync(client=client, limit=10)
if isinstance(page, AssetPage):
for asset in page.items:
print(asset.id, asset.modality, asset.signed_url)
Staging
Point the client at staging with
AuthenticatedClient(base_url="https://api.stg.nolgia.ai/v1", token="nol_...").
Staging tokens are minted on stg.nolgia.ai and do not
work against production.
Docs
- Getting started: https://docs.nolgia.ai/guides/getting-started.html
- API reference: https://docs.nolgia.ai/api/
- Developer portal: https://nolgia.com/developers
Layout
nolgia/: generated, do not edit; regenerate withmake sdk-pythonfrom the repo rootpyproject.toml,README.md,config.yaml: hand-written
Older published Python SDK versions raise ValueError on unknown generation refusal codes. Upgrade the Python SDK to handle the specific refusal codes and guidance.
Metadata
Release files for nolgia 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nolgia-0.1.7.tar.gz | 591.8 kB | With provenance | Details for nolgia-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nolgia-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for nolgia-0.1.7-py3-none-any.whl |
Total release size: 1.9 MB
Release files / nolgia-0.1.7.tar.gz
| Download URL | nolgia-0.1.7.tar.gz |
|---|---|
| Size | 591.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa98e2401507ed5339b9aa8270df72cb702bce30a24ef491ef9ff8a52a9bc5ab
|
|
BLAKE2b-256 checksum How to use checksums |
82390814f93040efce841cf5f84d8977213ce3bf1a3b9b16bc054ef20a4b0575
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logRelease files / nolgia-0.1.7-py3-none-any.whl
| Download URL | nolgia-0.1.7-py3-none-any.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02d44cc4d63751a18361a48d4403ba813786d16b09bf008adc5411b99ea17778
|
|
BLAKE2b-256 checksum How to use checksums |
4472e4b2d11668549ec0df5c802cf9653e2c671be4a87388fe64cc94ed992fbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logSecurity for nolgia 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for nolgia-0.1.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.