Built for AI agents

Human developers poll. Agents should not have to. Corent gives autonomous workflows three affordances that a synchronous request/response API does not: webhooks so a generation can run fully in the background, a streaming endpoint so progress arrives without repeated requests, and batch endpoints so a hundred generations are one API call instead of a hundred. Everything below works alongside the standard endpoints in the main docs. Nothing about authentication or pricing changes.

Fire and forget with webhooks

Add webhook_url to any generate request and the call returns 202 Accepted immediately with a job id. Corent generates in the background and posts the full result to your URL when it is done. Add webhook_secret and every delivery is signed with an X-Corent-Signature header, an HMAC-SHA256 of the raw request body using your secret. Verify it before trusting the payload. Failed deliveries retry up to three times with exponential backoff.
curl -X POST https://api.corent.tech/v1/images/generate \
  -H "Authorization: Bearer co_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a matte black watch on a marble surface",
    "preference": "quality",
    "webhook_url": "https://your-server.com/webhooks/corent",
    "webhook_secret": "your_shared_secret"
  }'

# -> 202 Accepted
# { "id": "job_abc123", "status": "processing" }

# later, Corent POSTs to your webhook_url:
# { "id": "job_abc123", "status": "completed", "images": [...], "meta": {...} }

Track progress without polling

For video jobs, open a single connection to GET /v1/jobs/{id}/stream and Corent holds it open, pushing an event each time the job changes state: queued, processing (with an estimated progress_percent where available), completed, or failed. The connection closes on its own once the job reaches a terminal state. One connection replaces however many poll requests you would otherwise make.
curl -N https://api.corent.tech/v1/jobs/job_abc123/stream \
  -H "Authorization: Bearer co_live_..."

# event: processing
# data: {"id": "job_abc123", "status": "processing", "progress_percent": 42}
#
# event: completed
# data: {"id": "job_abc123", "status": "completed", "videos": [...], "meta": {...}}

Batch generation

Submit up to 50 items in a single call to /v1/images/generate/batch or /v1/videos/generate/batch. Corent processes up to 5 concurrently and returns a batch_id plus one job id per item immediately. Every item bills at the normal per-generation rate, there is no batch discount. If you set a webhook, each item delivers its own webhook as it finishes, tagged with the batch id so you can correlate them.
import requests

CORENT_API_KEY = "co_live_..."

items = [
    {"prompt": "a red sneaker on a white background", "preference": "fast"},
    {"prompt": "a blue sneaker on a white background", "preference": "fast"},
    {"prompt": "a green sneaker on a white background", "preference": "fast"},
    {"prompt": "a black sneaker on a white background", "preference": "fast"},
    {"prompt": "a yellow sneaker on a white background", "preference": "fast"},
]

res = requests.post(
    "https://api.corent.tech/v1/images/generate/batch",
    headers={"Authorization": f"Bearer {CORENT_API_KEY}"},
    json={
        "items": items,
        "webhook_url": "https://your-server.com/webhooks/corent",
        "webhook_secret": "your_shared_secret",
    },
)
res.raise_for_status()
batch = res.json()
print(batch["batch_id"], batch["job_ids"])

# check overall progress any time, no need to wait for every webhook
status = requests.get(
    f"https://api.corent.tech/v1/batches/{batch['batch_id']}",
    headers={"Authorization": f"Bearer {CORENT_API_KEY}"},
).json()
print(status["completed"], "of", status["total"], "done")

Function calling with Claude and OpenAI

Claude tool use
Pass these as the tools array in a Messages API call. When Claude returns a tool_use block, call the matching Corent endpoint with the given input and return the result as a tool_result.
{
  "tools": [
    {
      "name": "generate_image",
      "description": "Generate an image from a text prompt using Corent.",
      "input_schema": {
        "type": "object",
        "properties": {
          "prompt": { "type": "string" },
          "preference": { "type": "string", "enum": ["fast", "balanced", "quality"] },
          "aspect_ratio": { "type": "string" }
        },
        "required": ["prompt"]
      }
    },
    {
      "name": "generate_video",
      "description": "Generate a video from a text prompt using Corent.",
      "input_schema": {
        "type": "object",
        "properties": {
          "prompt": { "type": "string" },
          "preference": { "type": "string", "enum": ["fast", "balanced", "quality"] },
          "aspect_ratio": { "type": "string" },
          "duration_s": { "type": "integer" }
        },
        "required": ["prompt"]
      }
    }
  ]
}
OpenAI function calling
The same two capabilities as OpenAI function definitions, for the Chat Completions or Responses API.
{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "generate_image",
        "description": "Generate an image from a text prompt using Corent.",
        "parameters": {
          "type": "object",
          "properties": {
            "prompt": { "type": "string" },
            "preference": { "type": "string", "enum": ["fast", "balanced", "quality"] },
            "aspect_ratio": { "type": "string" }
          },
          "required": ["prompt"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "generate_video",
        "description": "Generate a video from a text prompt using Corent.",
        "parameters": {
          "type": "object",
          "properties": {
            "prompt": { "type": "string" },
            "preference": { "type": "string", "enum": ["fast", "balanced", "quality"] },
            "aspect_ratio": { "type": "string" },
            "duration_s": { "type": "integer" }
          },
          "required": ["prompt"]
        }
      }
    }
  ]
}
LangChain tool wrapper
A minimal @tool wrapper around the two endpoints, ready to hand to any LangChain agent.
from langchain_core.tools import tool
import requests

CORENT_API_KEY = "co_live_..."

@tool
def generate_image(prompt: str, preference: str = "balanced") -> str:
    """Generate an image from a text prompt using Corent. Returns the image URL."""
    res = requests.post(
        "https://api.corent.tech/v1/images/generate",
        headers={"Authorization": f"Bearer {CORENT_API_KEY}"},
        json={"prompt": prompt, "preference": preference},
        timeout=30,
    )
    res.raise_for_status()
    return res.json()["images"][0]["url"]

@tool
def generate_video(prompt: str, preference: str = "balanced", duration_s: int = 5) -> str:
    """Start a video generation using Corent. Returns a job id to poll or stream."""
    res = requests.post(
        "https://api.corent.tech/v1/videos/generate",
        headers={"Authorization": f"Bearer {CORENT_API_KEY}"},
        json={"prompt": prompt, "preference": preference, "duration_s": duration_s},
        timeout=30,
    )
    res.raise_for_status()
    return res.json()["id"]

# tools = [generate_image, generate_video]
# agent = create_tool_calling_agent(llm, tools, prompt)

Recommended patterns

Idempotency
An agent that retries a timed-out request can end up paying for two generations instead of one. Keep your own record of the job id returned by each call before you retry, and check GET /v1/jobs/{id} first. If it already exists and is processing or completed, do not submit again.
Retry logic
Retry on 429 and 5xx only, never on 4xx validation errors, since those will fail again identically. Respect the Retry-After header on a 429 rather than guessing a backoff.
Cost caps per agent session
Give each agent, or each API key, its own daily cost cap in the dashboard rather than sharing one key across every agent you run. An agent that gets stuck in a loop then hits its own ceiling instead of draining the account.
Use the intent endpoint for autonomous workflows
If your agent is deciding what to generate on its own rather than following an explicit spec, send the raw natural language request straight to /v1/intent/execute instead of mapping it to a tier yourself. Corent picks the tier, aspect ratio, and quality for you, conservatively, so an agent cannot accidentally request the most expensive tier for a throwaway request. Pass confirm_estimated_cost_cents_up_to as a hard ceiling and Corent will return the plan and estimated cost without spending anything if it is exceeded.