Async Jobs
Track the status of asynchronous operations such as video generation via the jobs endpoints.
Some endpoints — currently video generation — run asynchronously. They respond immediately with a job id and you track completion via these endpoints.
Retrieve a job
GET
/v1/jobs/:idReturns the full job record. The payload shape depends on status:
pending/processing— nooutputyet;tchavi.credits_usedis set.completed—output.video_url,output.duration,output.resolution,output.file_size_mb,output.url_expires_at.failed—error.message,error.code, andtchavi.credits_refunded(the charged credits are returned automatically).
List jobs
GET
/v1/jobsLists the caller's jobs, most recent first. Query params: status (filter), limit (1–50, default 20), offset (default 0).
Example
import Tchavi from '@tchavi/sdk';
const client = new Tchavi({ apiKey: 'YOUR_API_KEY' });
// Retrieve a specific job
const job = await client.jobs.retrieve('job_abc123');
console.log(job.status, job.output?.video_url);
// List the 10 most recent completed jobs
const { data } = await client.jobs.list({ status: 'completed', limit: 10 });
for (const j of data) {
console.log(j.created_at, j.model, j.output?.video_url);
}See Video Generation for the endpoint that produces these jobs.