跳到主要内容

开发者

API 与 MCP 文档

用 REST API 或让 AI 助手通过 MCP 完成整套广告复刻:找模板 → 上传产品图 → 审脚本 → 估价 → 生成 → 轮询 → 导出。计费、冻结和试用规则与网页完全一致。

鉴权

在 设置 → API 密钥 创建密钥(read / write / spend 权限),以 Bearer 方式发送。密钥只显示一次。

Authorization: Bearer rk_live_…

计费规则

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

EndpointMCP tool说明
POST /templates/searchsearch_templatesSearch 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 /uploadscreate_upload_urlGet 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 /projectscreate_projectCreate 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). Analysis and script are free; the project stops at phase script_review for the user to review / edit, then confirm_script (auto_confirm=true skips review). Resolution (720p | 1080p | 2K) is fixed here.
POST /characterscreate_characterSave 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 /characterslist_charactersYour character library (newest first) with moderation_status.
DELETE /characters/{character_id}delete_characterRemove a character from your library (its cloned voice, if any, is deleted too). Projects already using it are unaffected.
PATCH /characters/{character_id}update_characterRename 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-cloneclone_character_voiceInstant 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-keepkeep_character_voiceExtend 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 /voiceslist_voicesVoices a character can use: free ElevenLabs presets and your own cloned voices, plus clone_credits (price of clone_character_voice).
PUT /projects/{project_id}/characterset_project_characterBefore 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 /projectslist_projectsList your 50 most recent projects.
GET /projects/{project_id}get_projectProject 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}/scriptget_scriptOrdered 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}/scriptupdate_scriptEdit 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/rewriterewrite_scriptRewrite 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.
GET /rewrites/{rewrite_id}get_rewriteStatus of a rewrite (queued → applied | failed). Re-read get_script after applied.
POST /projects/{project_id}/variants/hookcreate_hook_variantCreate 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.
POST /projects/{project_id}/script/linesadd_lineOnly 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_lineOnly in script_review: remove a line (at least one must remain). Returns the updated estimate.
PUT /projects/{project_id}/script/lines/orderreorder_linesOnly 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/confirmconfirm_scriptLock 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}/estimateestimate_costCredit 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}/generategenerate_videoGenerate 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}/jobslist_jobsRecent jobs for a project.
GET /projects/{project_id}/clipslist_clipsClips with status and still / video preview URLs.
POST /projects/{project_id}/exportsexport_videoRender the final ad (720p | 1080p | 2K, default = project resolution, no upscaling; 9:16 free; 1:1 / 16:9 re-frame costs 20 credits/s). Requires confirm=true. Returns export_id; poll get_export for download_url.
GET /jobs/{job_id}get_jobStatus of one job (queued | running | paused | succeeded | failed). Poll every 10–30 s or use webhooks.
GET /exports/{export_id}get_exportExport status and download_url (+ srt_url) once done.
GET /balanceget_balanceAvailable and frozen credits. 100 credits = $1.

示例

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.id

AI 助手技能

给 Claude / Cursor 等助手用的 SKILL.md: SKILL.md (通用版: ad-remake-api) · 30 tools.