Skip to main content

Corent Python SDK

One API for AI image, video, voice, and text generation. You pick a quality tier; Corent's router picks the best live model, reroutes failures, verifies the output, and returns the exact charge on every response. Failed generations are never billed.

pip install corent
from corent import Corent

client = Corent("co_live_...")  # get a key at https://corent.tech

image = client.images.generate("a lighthouse at dusk", tier="premium", aspect_ratio="9:16")
print(image.url, image.width, image.height, image.cost_cents)

video = client.videos.generate("a paper boat drifting across a puddle",
                               tier="premium", duration_s=5, resolution="1080p")
print(video.url, video.resolution, video.cost_cents)

speech = client.speech.generate("Welcome to Corent.")
print(speech.url, speech.cost_cents)

answer = client.text.generate("Name three uses for a paperclip.", tier="premium")
print(answer.text, answer.cost_cents)

What the SDK handles for you

  • Timeout-safe renders — images submit as background jobs and are polled; a network hiccup can never lose a finished (and billed) result.
  • Safe retries — every generate call carries an auto idempotency key; retries can never double-charge.
  • Backoff — 429/5xx are retried with Retry-After respected.
  • Honest receipts — width/height are the measured pixels of the delivered file, and cost_cents is the exact charge.

Pick a model yourself (direct access)

Pass model instead of tier to pin an exact model. It is never substituted: if that model can't deliver, the call fails and you are not charged.

image = client.images.generate("a lighthouse at dusk", model="corent-flux-schnell")
print(image.model)  # "corent-flux-schnell" — the name you asked for

client.models()  # the menu: every model with its kind, quality and live status

Every name Corent publishes is spelled corent-… — that is what client.models() lists, what comes back on .model, and what your receipt shows. Older spellings you may already have hard-coded (flux-schnell, seedream-5.0-direct) still resolve, and the SDK sends whatever string you pass straight through, untouched.

Each model has one name. When we can reach it by more than one route, Corent serves whichever is cheapest at that moment and charges you that price — you never have to shop between near-identical entries.

Text (language models)

Every frontier lab on one key and one bill, priced per token.

answer = client.text.generate("Explain reserve-then-settle billing.",
                              system="Answer in two sentences.", tier="premium")
print(answer.text, answer.prompt_tokens, answer.completion_tokens, answer.cost_cents)

# a real conversation, tool calls included
reply = client.text.chat(
    [{"role": "system", "content": "Be terse."},
     {"role": "user", "content": "What's the weather?"}],
    model="corent-claude-opus-5",
)

Streaming isn't wrapped here: point any OpenAI-compatible client at https://api.corent.tech/v1 with your Corent key and it works as-is.

Keep a character or product consistent

Pass 1 to 4 reference images and the prompt is applied as an edit of them, so the same face, character, or product carries into a new scene.

shot = client.images.generate(
    "the same woman, now on a beach",
    tier="pro",  # edit-capable models sit at premium and up
    reference_image_urls=["https://cdn.example/her.png"],
)

air and lite cannot do this and say so with a 400. client.tiers() reports capabilities.supports_reference_images per tier.

Upload your own files

Hand Corent a file from disk (or raw bytes) and get back a URL every other call accepts: image_url, mask_url, source_image_url, reference_image_urls. Up to 25 MB. The type is read from the filename's extension unless you name one.

up = client.upload("product.png")            # or bytes: client.upload(data, filename="product.png")
print(up.url, up.content_type, up.bytes)

client.images.generate("the same bottle, on a beach", tier="pro", reference_image_urls=[up.url])
client.videos.generate("the bottle slowly rotates", image_url=up.url)

Image tools: upscale, cut out, edit

Flat price, no tier, synchronous. The edit keeps every pixel outside the mask exactly as you sent it, which is what an ad needs when the product carries someone else's trademark.

bigger = client.images.upscale(up.url, prompt="keep the film grain")   # prompt optional
cutout = client.images.remove_background(up.url)                        # PNG, real transparency
mask = client.upload("mask.png")                                        # white = regenerate, black = keep
edited = client.images.edit(up.url, mask.url, "a red can instead of the blue one")
print(edited.url, edited.cost_cents)

Tag spend by your own customer

Pass customer_id (1 to 128 characters, your own id) on any generating call and client.usage(customer_id=...) reports that customer's spend alone. Batches take a default plus a per-item override.

client.images.generate("a fox", tier="air", customer_id="acct_8812")
client.text.generate("Summarise this.", customer_id="acct_8812")
client.batches.images(
    [ImageBatchItem(prompt="a"), ImageBatchItem(prompt="b", customer_id="acct_other")],
    customer_id="acct_8812",  # default for every item without its own
)
client.usage(customer_id="acct_8812")

Batches and webhooks

from corent import ImageBatchItem

# Up to 50 renders in one call. Each item bills at the normal rate.
batch = client.batches.images(
    [ImageBatchItem(prompt="a fox", tier="air"), ImageBatchItem(prompt="a heron", tier="air")],
    idempotency_key="campaign-9",  # a retry replays instead of re-billing
)
progress = client.batches.progress(batch.batch_id)

# Or have the server deliver each result and skip polling entirely.
client.videos.generate(
    "a drone shot",
    tier="premium",
    webhook_url="https://your-server.com/webhooks/corent",
    webhook_secret="your_shared_secret",  # signs every delivery
)

What else you can ask for

# Repeat an image exactly, then change one thing.
first = client.images.generate("a fox in a library", tier="pro")
again = client.images.generate(
    "a fox in a library, wearing glasses",
    tier="pro", seed=12345, negative_prompt="text, watermark",
)

# Four versions of one prompt in one call (four real renders, four charges).
images = client.images.generate_many("a fox", 4, tier="air")

# A transparent logo, at a size you choose.
client.images.generate("a minimal fox mark", transparent=True, width=1024, height=1024)

# Video with sound, going from one picture to another.
client.videos.generate(
    "the camera pulls back",
    tier="premium", audio=True,
    image_url="https://.../start.png", end_image_url="https://.../end.png",
    camera="zoom_out",
)

# Pick a voice, and shape how it reads.
voices = client.voices()
client.speech.generate("Welcome aboard.", voice_id=voices[0]["voice_id"], stability=0.3, speed=1.1)

# Started something by mistake? Stop it. Costs nothing.
client.jobs.cancel(job.id)

audio=True routes only to models that actually render sound, so a silent model can never quietly serve the request. Not every model takes every setting: anything the chosen one could not honour comes back in meta rather than being silently ignored.

Fine-grained control

job = client.images.generate("...", tier="max_pro", wait=False)  # returns immediately
job = client.jobs.wait(job.id)                                    # resume any time

client.tiers()     # live catalog with honest min-max price ranges
client.models()    # direct-access menu (names, quality, status)
client.balance()   # Balance(balance_cents, held_cents, available_cents)
client.usage()     # what this account has spent; customer_id= narrows it

Every generate call sends an Idempotency-Key, so the SDK's own retries can never double-charge. Pass your own idempotency_key to make that survive a process restart too.

Tiers: air | lite | premium | pro | max_pro — see corent.tech/pricing. Models: corent.tech/models. Docs: corent.tech/docs.

Metadata

Release files for corent 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for corent 0.4.0
File Size Uploaded Provenance Actions
corent-0.4.0.tar.gz 21.7 kB Without provenance Details for corent-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for corent 0.4.0
File Interpreter ABI Platform Actions
corent-0.4.0-py3-none-any.whl Python 3 none any Details for corent-0.4.0-py3-none-any.whl

Total release size: 38.7 kB

Release files / corent-0.4.0.tar.gz

Download URL corent-0.4.0.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
450230777a15557c99cba83a7f6a88470278a19f4aa56ad4e19327787daa587f
BLAKE2b-256 checksum
How to use checksums
5da80f52bcf3727c0f08e82ebc83ccb4e060c4a952fc60b1563651b473a00db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / corent-0.4.0-py3-none-any.whl

Download URL corent-0.4.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b77c389a5384f1c40b8e9fa53d8dbd74698bdd462b886750cbbdc3cf12aa2d61
BLAKE2b-256 checksum
How to use checksums
62a60b4c6fc347de6d9105e6e2e239893d6d24b767ee182b8a2ae165399f3529
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for corent 0.4.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page