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" }  }'
typeinputparametersResult
textmessages plus any chat body fieldchat fields such as temperature and max_tokens200, synchronous output
imageprompt plus the model fields shown by discoverymodel fields such as size, quality and n202, job
videoprompt, image_url, last_frame_url, owned reference_*_file_idsresolution, ratio, duration, audio202, job
video_editvideo_file_id, prompt, owned reference_*_file_idsresolution, ratio, duration202, job
audioprompt, and either speaker or owned reference_audio_file_ids / reference_audio_urls / reference_image_file_id / reference_image_urlformat, sample_rate, speech_rate, loudness_rate, pitch_rate, enable_subtitle, watermark202, job
socialInstagram: 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
Text and social are synchronous in the unified envelope; for SSE use the protocol-native POST /v1/chat/completions. Image, video, video_edit and audio are asynchronous jobs.

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=true to 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, failed or pending; 202 never 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 (or idempotency_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.