Unified API
Introduction
One external entry point for text, image, video, viral remake, voiceover and social-data reads. type selects the capability, model selects the published model, and input plus parameters carry the type-specific fields. This is the single public interface: every capability, including the social reads, only changes type and its own input fields.
1. The envelope
BASH
curl -X POST https://api.anycap.io/v1/generations \ -H "Authorization: Bearer $ANYCAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "video_edit", "model": "<model from GET /v1/generations/models?type=video_edit>", "input": { "video_file_id": "<owned source video id>", "prompt": "replace the product on the table, keep the camera move" }, "parameters": { "resolution": "480P", "ratio": "adaptive" } }'| type | input | parameters | Result |
|---|---|---|---|
text | messages plus any chat body field | chat fields such as temperature and max_tokens | 200, synchronous output |
image | prompt plus the model fields shown by discovery | model fields such as size, quality and n | 202, job |
video | prompt, image_url, last_frame_url, owned reference_*_file_ids | resolution, ratio, duration, audio | 202, job |
video_edit | video_file_id, prompt, owned reference_*_file_ids | resolution, ratio, duration | 202, job |
audio | prompt, and either speaker or owned reference_audio_file_ids / reference_audio_urls / reference_image_file_id / reference_image_url | format, sample_rate, speech_rate, loudness_rate, pitch_rate, enable_subtitle, watermark | 202, job |
social | Instagram: username for a profile or operation: posts list, url + operation: post for a post, url + operation: comments for a comments page; TikTok: url | — | 200, synchronous call including media_downloads (Anycap links valid for 2 hours); 202 only when the upstream outcome is ambiguous |
2. Discover models
GET /v1/generations/models?type=text|image|video|video_edit|audio|social returns the models the connection key may call. The items objects are the same ones the capability discovery endpoints return, so prices, limits and accepted fields stay identical.
3. Read and cancel media jobs
GET /v1/generations/{id}returns{type, job}for image, video, video_edit and audio, or{type, call}for social; add?result=trueto fetch the final media URL.DELETE /v1/generations/{id}cancels a video or video_edit job only while it is still queued before the billable upstream submission. Image and audio jobs are not cancellable and return 400.- Poll until
completed,failedorpending;202never proves upstream success or settled billing.
4. Errors and idempotency
- Validation errors keep the standard
{error:{code,field,message}}body and are returned before submission; nothing is charged. - Send
Idempotency-Key(oridempotency_key) for media jobs: a repeated key returns the recorded job and never submits twice. Text uses the same header for retry safety. - An image quote is created and submitted in one call; a validation failure creates no reservation and charges nothing.
PreviousCoding agents
NextText generation