Async Jobs
Track the status of asynchronous operations — video and music generation — via the jobs endpoints.
Some endpoints (currently video generation and music 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(the actual rendered length),output.resolution,output.file_size_mb,output.url_expires_at. The video is deleted 24 hours after it is generated, which is whenvideo_urlexpires: download it before then.tchavi.credits_usedis the net charge; for reserve-billed models (e.g.kling-v3-motion-control)tchavi.credits_refundedalso appears when part of the upfront reserve was returned.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.