开发者
API 与 MCP 文档
用 REST API 或让 AI 助手通过 MCP 完成整套广告复刻:找模板 → 上传产品图 → 审脚本 → 估价 → 生成 → 轮询 → 导出。计费、冻结和试用规则与网页完全一致。
鉴权
在 设置 → API 密钥 创建密钥(read / write / spend 权限),以 Bearer 方式发送。密钥只显示一次。
Authorization: Bearer rk_live_…计费规则
- 100 积分 = $1。分析、脚本、分镜静帧、出视频前改台词免费。
- 视频按生成秒数计费,分辨率只有 720p / 1080p / 2K,建项目时确定。
- generate_video 与 export_video 必须带 confirm: true 才会扣积分,否则只返回估价(402 confirmation_required)。
- 所有创建或扣费的 POST 请带 Idempotency-Key,重试不会重复扣费。
MCP
远程 MCP(Streamable HTTP): https://adrecast.com/api/mcp
{
"mcpServers": {
"adrecast": {
"url": "https://adrecast.com/api/mcp",
"headers": { "Authorization": "Bearer ${ADRECAST_API_KEY}" }
}
}
}Remake proven video ads for the user's product. Flow: search_templates → create_upload_url (PUT each product image) → create_project → poll get_project → get_script / update_script → estimate_cost (show the user) → generate_video with confirm=true → poll get_job / list_clips → export_video confirm=true → get_export.download_url. Never set confirm=true without the user approving the credit estimate. Resolutions: 720p, 1080p, 2K.
REST v1
Base URL https://adrecast.com/api/v1 · OpenAPI /api/v1/openapi.json
| Endpoint | MCP tool | 说明 |
|---|---|---|
| POST /templates/search | search_templates | Search the Meta Ad Library (cached, budgeted) for ads to remake. Each result has a remake_url you can pass to create_project as source {type:"url"}. Free for you; results cached 6 h. |
| POST /uploads | create_upload_url | Get a signed URL to upload ONE image (jpeg/png/webp ≤10 MB) or a source video. kind=product_image (default): pass `path` in create_project.product.image_paths (1–6 required). kind=person_image: a presenter reference photo for create_character.image_paths. kind=voice_sample: an audio recording (mp3/wav/m4a/webm/ogg ≤20 MB, ≥30 s) for clone_character_voice. kind=video: source upload. PUT the raw bytes to upload_url with the given Content-Type. |
| POST /projects | create_project | Create a project from ONE set of materials: source ad (url / template / upload), product info + uploaded image paths, an optional presenter (character_id from create_character, or an inline character {name?, description?, image_paths?, likeness_consent} saved to the library) and the script mode: replica (default, 1:1 remake of the source script) or brief (script_brief {instruction?, tone?, target_duration_s?} → a new script written in one pass). Requires the $1 trial or a top-up first (402 payment_required otherwise); analysis and script are included. The project stops at phase script_review for the user to review / edit, then confirm_script (auto_confirm=true skips review; auto_generate=true is one-click: script and stills are confirmed automatically and every video starts, needs the spend scope). Optional scene_image_paths (≤4 product_image paths: every shot is set in that place) and audio_mode=source (keep the own voice + music of the source video, lip-synced; script and language stay those of the source). Script mode (script_mode): replica (default) = the spoken lines of the source, word for word, only the source brand/product name swapped for yours (silent clips stay empty); brief = write the script from script_brief {instruction?, tone?, target_duration_s?}. Resolution (720p | 1080p | 2K) is fixed here. |
| POST /characters | create_character | Save a reusable on-screen presenter: an appearance description and/or 1–3 person reference photos (create_upload_url kind=person_image). Photos require likeness_consent=true (you have the right to use this person's likeness). Free. Moderated automatically before first use: minors and celebrities / public figures are rejected (moderation_status pending → approved | rejected). Use the id as create_project.character_id or set_project_character. |
| GET /characters | list_characters | Your character library (newest first) with moderation_status. |
| DELETE /characters/{character_id} | delete_character | Remove a character from your library (its cloned voice, if any, is deleted too). Projects already using it are unaffected. |
| PATCH /characters/{character_id} | update_character | Rename a library character and/or set its voiceover voice: voice=none (default narrator) or voice=preset with voice_id from list_voices. Free. Replacing a cloned voice deletes the clone. |
| POST /characters/{character_id}/voice-clone | clone_character_voice | Instant Voice Clone from a recording of at least 30 s (create_upload_url kind=voice_sample). Requires voice_consent=true (your own voice or you are authorized by the speaker). SPENDS 1000 credits (fixed): without confirm=true returns confirmation_required with the price. Async: poll list_characters until voice.status is ready or failed (failed releases the credits). Deleting the character deletes the clone. Unused clones are deleted after 60 days (voice.expires_at; any voiceover with it extends it). When the voice service is full it fails with voice_slots_full and nothing is charged. |
| POST /characters/{character_id}/voice-keep | keep_character_voice | Extend a ready cloned voice by 60 days from max(now, voice.expires_at). SPENDS 1000 credits: without confirm=true returns confirmation_required with the price. |
| GET /voices | list_voices | Voices a character can use: free preset voices (MiniMax) and your own cloned voices, plus clone_credits (price of clone_character_voice; cloning is currently disabled). |
| PUT /projects/{project_id}/character | set_project_character | Before any video is generated: switch the project presenter to a library character (character_id) or back to automatic (null), and regenerate the look. Look regenerations: 3 free per character, then 20 credits. Fails with video_started once video generation began. |
| GET /projects | list_projects | List your 50 most recent projects. |
| GET /projects/{project_id} | get_project | Project status (phase: analyzing → scripting → script_review → storyboard → generating → editing), the source-ad analysis, and active jobs. In script_review the script waits for the user: edit / add / delete / reorder lines or rewrite_script, then confirm_script. |
| GET /projects/{project_id}/script | get_script | Ordered script lines (one per clip) with spoken line_text, visual_desc and status. script_review=true means the script is still in review (all edits free, structure editable). still_regen_on_edit marks lines whose still is regenerated when edited after confirm. |
| PATCH /projects/{project_id}/script | update_script | Edit line_text / visual_desc. In script_review: free. After confirm_script: allowed for scenes without video; a scene that already has a still gets ONLY that still regenerated (3 free regenerations per scene, then 20 credits; resend with confirm=true when the response is confirmation_required). Scenes with video return clip_locked (use revise). |
| POST /projects/{project_id}/script/rewrite | rewrite_script | Rewrite the whole script from an instruction (e.g. "funnier, lead with the guarantee"), an optional tone (friendly | energetic | premium | humorous | urgent | calm | authentic) and an optional target_duration_s (5–120). The scene count is kept unless the target length needs more or fewer scenes. Only while phase = script_review (before confirm_script); FREE, applied automatically, max 5 per project per day. Returns rewrite_id; poll get_rewrite. After confirm use update_script for single lines or revise for clips with video. |
| POST /projects/{project_id}/clips/{clip_id}/still | regenerate_still | Make a new still for one scene (clip_id from get_script / list_clips). Use it to retry a still that failed (status still_pending with no still job running) or to re-roll a still that is ready / confirmed. Optional visual_desc replaces the scene's visual description. Scenes with video return clip_locked (use redo_scene). 3 free regenerations per scene, then 20 credits: without confirm=true a paid regeneration returns confirmation_required with the estimate; resend with confirm=true. A running still job returns still_in_progress. Poll list_clips or get_job. |
| POST /projects/{project_id}/clips/{clip_id}/redo | redo_scene | Redo one rendered scene (status done or flagged): a new still and video (kind=visual, the default, with optional instruction describing the change) or a re-voiced video (kind=voice, instruction = the new spoken line). A scene QC flagged gets its first redo free; every other redo costs 80% of generating the scene again. Without confirm=true a paid redo returns confirmation_required with the estimate (the free redo never asks). Returns job_id, free and credits. Poll get_job, then list_clips. Scenes not yet rendered return not_redoable. |
| GET /rewrites/{rewrite_id} | get_rewrite | Status of a rewrite (queued → applied | failed). Re-read get_script after applied. |
| POST /projects/{project_id}/variants/hook | create_hook_variant | Create a new sequence that swaps only the opening (hook) line for hook_text and regenerates just that clip; everything else is reused for free. The regenerated clip is charged like normal generation. |
| GET /hooks | list_hook_formulas | The 12-formula hook library (zh / en). With project_id each formula comes filled from that project's own product info ({product}, {benefit}, {audience}); formulas the product info cannot support honestly (e.g. no number in the selling points) are marked available=false. Free. |
| GET /variant-styles | list_variant_styles | Preset looks for style-swap variants (key, zh / en name). Generic visual styles only; no studio or brand names. Free. |
| POST /projects/{project_id}/variants/estimate | estimate_variants | Plan + price a variant batch on a project whose base video is finished. hooks: [{formula | text, visual?}] swaps the opening line AND makes a new opening image; characters: [{user_character_id (approved library character) | ai_description}] swaps the presenter on talking shots; products: [{product_id from add_variant_product}] swaps the product; scripts: [{instruction}] rewrites every spoken line keeping the beats (each shot's length locked ±15%, stills reused, re-voiced + re-rendered); styles: [{key}] re-renders every shot in a preset look (list_variant_styles; generic looks only, product kept as in its photo). Script + product cannot be crossed in one matrix. mode=each (one variant per choice) or matrix (all combinations). Max 10 variants. Price = ONLY the regenerated video seconds × the normal credits per second (720p 40, 1080p 50, 2K 60; multi-person dialogue shots ×1.5 exactly as in normal generation, single-speaker talking shots are not); new stills included, unchanged shots free, no per-variant fee. ALWAYS show this to the user before create_variants. |
| POST /projects/{project_id}/variants | create_variants | Run a variant batch (same input as estimate_variants). SPENDS CREDITS: without confirm=true returns confirmation_required with the estimate. The estimate is frozen once for the whole batch; the first variant runs as a pilot and the rest only start after it succeeded (a failed pilot stops the batch). You are charged for the seconds actually generated, never more than the estimate. auto_export (default true) renders each finished variant as a free 9:16 export named {product}_{project}_{H#_C#_P#[_S#][_R#]}_{lang}_9x16_{date}.mp4. Optional max_credits caps the batch. Poll list_variants. |
| GET /projects/{project_id}/variants | list_variants | Base + every variant of a project: code (H#_C#_P#), status, which shots were regenerated vs reused, per-shot video URLs (for side-by-side comparison), exports with versioned file names and download URLs, recent batches with frozen vs used credits. |
| GET /projects/{project_id}/variants/manifest | get_variant_manifest | CSV of the project's variants (optionally one batch_id): filename, code, hook line, character, product, language, seconds, status, utm_content (= lower-case code, for ad naming / UTM) and download_url. |
| POST /projects/{project_id}/variants/products | add_variant_product | Add another product to a project for product-swap variants: name, selling_points (the only source of claims for its lines) and 1–4 image_paths from create_upload_url (kind=product_image). Free. Returns product_id for estimate_variants / create_variants products. |
| POST /variant-batches/{batch_id}/cancel | cancel_variant_batch | Stop a running batch. Seconds already generated are charged; the rest of the frozen credits are released. |
| POST /projects/{project_id}/script/lines | add_line | Only in script_review: insert a new line (scene) after after_clip_id (null = first) with line_text (empty = b-roll) and/or visual_desc. Free; its still is made after confirm_script. Max 12 lines. Returns the new clip_id and the updated estimate. |
| DELETE /projects/{project_id}/script/lines/{clip_id} | delete_line | Only in script_review: remove a line (at least one must remain). Returns the updated estimate. |
| PUT /projects/{project_id}/script/lines/order | reorder_lines | Only in script_review: set the line order. clip_ids must list every line of the project exactly once (see get_script). |
| POST /projects/{project_id}/script/confirm | confirm_script | Lock the reviewed script (phase script_review → storyboard) and start the look + storyboard stills (free). After this, lines can no longer be added, deleted, reordered or rewritten; single-line edits via update_script regenerate only that scene's still. Idempotent. Unpaid accounts get script_only. |
| POST /projects/{project_id}/estimate | estimate_cost | Credit estimate for generating video for the given clips (default: all clips with ready stills), plus current balance and shortfall. 100 credits = $1. ALWAYS call this and show the user before generate_video. |
| POST /projects/{project_id}/generate | generate_video | Generate video for clips. SPENDS CREDITS: without confirm=true it only returns the estimate (error confirmation_required). Set confirm=true only after the user approved the estimate; optional max_credits caps spend. pilot=true renders the riskiest clip first. |
| GET /projects/{project_id}/jobs | list_jobs | Recent jobs for a project. |
| GET /projects/{project_id}/clips | list_clips | Clips with status and still / video preview URLs. |
| POST /projects/{project_id}/exports | export_video | Render the final ad (720p | 1080p | 2K, default = project resolution, no upscaling; 9:16 free; 1:1 / 16:9 re-frame costs 20 credits/s). Captions: subtitle_style defaults to 'source' = the original ad's caption style (font, size, colour, highlight, uppercase, position); classic / bold / karaoke are presets over it. burn_subtitles defaults to on, unless the source ad had no spoken captions (then none are burned). Requires confirm=true. Returns export_id; poll get_export for download_url. |
| GET /jobs/{job_id} | get_job | Status of one job (queued | running | paused | succeeded | failed). Poll every 10–30 s or use webhooks. |
| GET /exports/{export_id} | get_export | Export status and download_url (+ srt_url) once done. |
| GET /balance | get_balance | Available and frozen credits. 100 credits = $1. |
| POST /studio/quote | studio_quote | Price one Studio generation without starting it: credits frozen now, total_credits (text_to_video: first frame + video) and the unit price. Image kinds are per image, video and talking_avatar per second. Prices are 0.8× the matching remake price (100 credits = $1). Outputs carry no watermark (trial accounts run 1 job at a time). Failures release the frozen credits automatically. ALWAYS show this to the user before create_studio_generation. |
| POST /studio | create_studio_generation | Start one Studio generation: text_to_image, image_edit, image_to_video, first_last_frame, talking_avatar or text_to_video. You choose only resolution, duration and aspect. SPENDS CREDITS: without confirm=true returns confirmation_required with the quote; nothing is frozen. Prompts and input images are moderated before any spend (rejected → credits released). text_to_video makes the first frame first (status awaiting_confirm), then needs confirm_studio_video (or discard_studio_video). Errors: payment_required (needs the $1 trial or a top-up), insufficient_credits, busy (concurrent job limit of your plan), daily_cap (new accounts), studio_paused (try later), not_owned (an input is not yours). Poll get_studio_generation. Prices are 0.8× the matching remake price (100 credits = $1). Outputs carry no watermark (trial accounts run 1 job at a time). Failures release the frozen credits automatically. |
| GET /studio | list_studio_generations | Your Studio generations, newest first (limit ≤100, before = created_at cursor; next_before pages on), plus the current price table. |
| GET /studio/assets | list_studio_assets | Images you can pass as create_studio_generation.input_keys: your product and character photos, recent project stills and Studio images. Each has key, a preview url and source. Free. |
| GET /studio/{generation_id} | get_studio_generation | Status (queued → running → succeeded | failed | rejected | cancelled; text_to_video stops at awaiting_confirm with first_frame_url and video_credits; reconciling = delivery unclear, refunded automatically within 24 h), output URLs, credits frozen / charged (trial_watermark is always false, kept for compatibility). Poll every 10–30 s. |
| POST /studio/{generation_id}/confirm | confirm_studio_video | text_to_video at awaiting_confirm: freeze the video seconds and start the video from the first frame. SPENDS CREDITS: without confirm=true returns confirmation_required with the price and first_frame_url. The price is derived server-side from the generation's resolution and duration. Fails with not_awaiting_confirm otherwise. |
| POST /studio/{generation_id}/discard | discard_studio_video | text_to_video at awaiting_confirm: drop the first frame instead of making the video. Nothing more is charged (the first frame stays charged). Fails with not_awaiting_confirm otherwise. |
| POST /studio/{generation_id}/save | save_studio_output | Copy output image `index` of a succeeded image generation into your library: as=product returns a key for create_project.product.image_paths; as=character also creates a library character (consent=true required; moderated like any person photo). Free. |
示例
API=https://adrecast.com/api/v1
H="Authorization: Bearer $ADRECAST_API_KEY"
curl -s -X POST $API/templates/search -H "$H" -H 'Content-Type: application/json' -d '{"query":"vitamin c serum"}'
curl -s -X POST $API/projects/$PID/estimate -H "$H" -H 'Content-Type: application/json' -d '{}'
curl -s -X POST $API/projects/$PID/generate -H "$H" -H 'Content-Type: application/json' \
-H "Idempotency-Key: gen-$PID-1" -d '{"confirm":true,"max_credits":600}'Webhooks
事件 job.completed / job.failed。校验签名:
AdRecast-Signature: t=<unix>,v1=<hex> // same value also sent as legacy Replica-Signature
v1 = HMAC_SHA256(secret, "<t>.<raw body>") // reject if |now - t| > 300 s; dedupe by body.idAI 助手技能
给 Claude / Cursor 等助手用的 SKILL.md: SKILL.md (通用版: ad-remake-api) · 48 tools.