For work that takes too long for one HTTP request, submit a job, get an ID back, and poll until it finishes.
| Task | Submit | Get the result |
|---|---|---|
| Long text generation | POST /v1/responses with background: true | GET /v1/responses/{id} |
| Video generation | POST /v1/videos/generations (always async) | GET /v1/videos/generations/{id} |
The IDs are not interchangeable. A video job ID returns 404 from a Responses endpoint. A completed video is also available from GET /v1/outputs/{requestId} with the job ID.
Responses background jobs
With background: true, the API returns status: "queued" right away. Create the client as in the quickstart.
import time
job = client.responses.create(
model="everyais/gemini-3-8-flash",
input="A long research task...",
background=True,
)
while job.status in ("queued", "in_progress"):
time.sleep(5)
job = client.responses.retrieve(job.id)
print(job.status)
print(job.output_text)The job ends as completed, incomplete, failed or cancelled. Cancel a queued or in_progress job with POST /v1/responses/{id}/cancel (client.responses.cancel(id)); its credit is refunded.
Video jobs
Poll with the id from the submit response. Responses include Retry-After: 5 while the job runs.
import os
import time
import requests
BASE_URL = "https://api.everyais.com/v1"
headers = {"Authorization": f"Bearer {os.environ['EVERYAIS_API_KEY']}"}
job = requests.post(f"{BASE_URL}/videos/generations", headers=headers, json={
"model": "everyais/minimax-h3-turbo",
"prompt": "a timelapse of a blooming flower",
}).json()
while job["status"] == "processing":
time.sleep(5)
job = requests.get(f"{BASE_URL}/videos/generations/{job['id']}", headers=headers).json()
print(job["status"], job.get("data"))The job ends as completed, failed or cancelled, and its record is kept for 24 hours. See video generation for status details.
Avoid duplicate charges
- Don't resubmit a video because you missed the submit response. Video submission doesn't support
Idempotency-Key, so a resubmit creates and bills a second job. - Polling too often uses your key's rate limit. Follow
Retry-After.