CosmoMaker

CosmoMaker API

Make videos from your own code. Every tool the Studio’s agent uses is one HTTPS call, with the same credits and rules as the Studio.

Connecting ChatGPT, Claude or another agent? You don’t need this page. Give it https://mcp.cosmomaker.ai/mcp, or follow its steps on your Profile page, under Connected agents.

Your key

Make one on your Profile page, under API keys: Create API key. It’s shown once, so keep it somewhere safe. Send it with every call:

Authorization: Bearer cm_…

Each key has its own rules, which you can change any time under Manage: how many credits it may spend a day without asking, which workflows it sees, and whether it may start renders by itself.

Call a tool

POST the tool’s arguments as JSON to the tool’s address:

curl https://api.cosmomaker.ai/v1/tools/create_workflow \
  -H "Authorization: Bearer $COSMOMAKER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Paper boat"}'

Every answer has the same two fields: text, the answer in words, and ids, every id it names, in order.

{"text": "made wf_a8e7b371 \"Paper boat\": 16:9, 720P",
 "ids": ["wf_a8e7b371"]}

An id starts with what it is: wf_ a workflow, pic_ a picture, vid_ a video, take_ a rendered take, job_ a render.

Long work

Pictures, previews and renders take from seconds to minutes. A call still going after 40 seconds answers 202 with its call id. Pass it to wait, which answers when the call ends, or after up_to seconds (202 again if it’s still going):

POST /v1/tools/wait   {"ids": "call_5c0e1f2a", "up_to": 80}

To follow everything on a workflow, renders included, pass the workflow instead. When it answers nothing is under way, everything is done.

POST /v1/tools/wait   {"workflow": "wf_a8e7b371", "up_to": 80}

{"text": "job_81289cac: the take landed, take_bb6c5a36",
 "ids": ["job_81289cac", "take_bb6c5a36"]}

Send a file

upload_file gives you a one-time link. Send the file to it, then add it to the workflow’s library:

POST /v1/tools/upload_file      {"name": "script.md", "type": "text/markdown", "size": 18234}
PUT  <the link in its answer>   the file's bytes
POST /v1/tools/add_to_library   {"workflow": "wf_a8e7b371", "url": "<the url in its answer>"}

Pictures and audio up to 10 MB, documents (.md, .txt, .docx, .doc, .pdf) up to 50 MB, video up to 2 GB.

Credits and limits

  • quote gives the exact price before anything starts. It changes nothing.
  • Your changes go into a draft. land puts the draft on the workflow and starts its renders, if the key may; if not, you press Use these changes in the Studio.
  • Work within the key’s daily limit starts at once. Past it, it waits for your Go in the Studio.
  • whoami shows your credits, what’s left of today’s limit, and what the key may do.

Errors

A call that fails answers with an HTTP status and the reason, in words:

{"error": {"type": "invalid_request_error",
           "message": "S1 has no reference picture, so the take can't start: …"},
 "request_id": "9b1c2f…"}
400The tool said no, or the body isn’t the tool’s arguments. The message says why, and what to do next.
401The key is wrong, or it was removed.
403The key is paused, or it’s an app’s sign-in pass, which works only at the agents’ address.
404There’s no tool by that name.
429More than 10 calls a second. Wait a moment and try again.

A whole video

From nothing to an MP4, in Python with requests:

import requests

API = "https://api.cosmomaker.ai/v1/tools/"
KEY = {"Authorization": "Bearer cm_…"}

def call(tool, **args):
    r = requests.post(API + tool, json=args, headers=KEY, timeout=150)
    r.raise_for_status()
    while r.status_code == 202:                 # still going: wait for it
        r = requests.post(API + "wait", json={"ids": r.json()["call"]}, headers=KEY, timeout=150)
        r.raise_for_status()
    return r.json()

wf = call("create_workflow", name="Paper boat")["ids"][0]
call("add_segments", workflow=wf, count=1, seconds=5)

# a scene is filmed from a picture of its place or its people
pic = call("make_picture", workflow=wf,
           words="A red paper boat on a rainy street puddle at dusk, no people")["ids"][0]
call("add_to_bible", workflow=wf, kind="place", name="Rainy street", picture=pic)
call("set_references", workflow=wf, segment="S1", cast="@Rainy street")

# our cinematographer writes the scene from a note
call("write_segment", workflow=wf, segment="S1",
     note="The boat drifts across the puddle.", shots="0-5 s: wide, slow push in")

print(call("quote", workflow=wf)["text"])     # the price, before anything starts
call("shoot", workflow=wf)
call("land", workflow=wf)                      # the key must be allowed to start renders
while "nothing is under way" not in call("wait", workflow=wf, up_to=80)["text"]:
    pass

take = [i for i in call("open_workflow", workflow=wf)["ids"] if i.startswith("take_")][0]
print(call("deliver", workflow=wf, take=take)["text"])    # the MP4's link

Tools

All 49, read from GET /v1/tools as this page opens, so the list always matches the API. Each tool’s words are the ones agents read.

whoamiYour credits, what's left of today's limit, the workflows you can see, and whether your changes land without Use.

No parameters.

list_workflowsThe workflows you can see, newest first: id, name, scenes, takes.
query string optional
words in the name
create_workflowA new workflow. It joins the ones you can see. Free.
name string
its name
orientation string optional
landscape unless asked (portrait, landscape)
resolution string optional
720P unless asked (480P, 720P)
speech_language string optional
the language its spoken lines are in
like string optional
a wf_ id: its settings, and with cast its people and places, come along
cast string optional
with like: the people and places to carry over, by name with commas
copy_workflowA private copy of a workflow: its scenes, cast, library and takes, on the same files. It joins the ones you can see. Free.
workflow string
a wf_ id
name string optional
its name; the old name and (copy) if left out
find_resourcesSearch everything in the workflows you can see, by words, kind, who made it or where it is: pictures, audio, videos, documents, and the people and places of their bibles. Each with its id, its workflow, what uses it, who made it and its link.
query string optional
words in its name or prompt
kind string optional
(picture, audio, video, document, bible)
workflow string optional
a wf_ id: only there
made_by string optional
agents: only what an agent made (agents)
upload_fileA one-time link to send a file from your disk straight to our bucket, which costs you no tokens: run its curl line, then add_to_library. Pictures and audio up to 10 MB, documents (.md, .txt, .docx, .doc, .pdf) 50 MB, video 2 GB.
name string
the file's name, with its extension
type string
its content type, e.g. text/markdown, image/png
size integer
its exact size in bytes
get_guideHow to write for the models and work the Studio, by topic. Call it with no topic for the list.
topic string optional
(words, crew, bible, pictures, frames, checking, editing, music)
open_workflowThe workflow as you would change it, your draft's changes in it: its settings, cast and places, every scene with its id, length, price and the start of its words, the library's newest, the Sound lane, the takes. look reads a scene whole.
workflow string
a wf_ id
previzA 480P test of one scene, from your draft: 0.55 credits for 10 s with 2 pictures. Within the creator's daily limit it starts at once, above it the creator gets a Go card. wait follows it, then look at it by its job_ id.
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
set_wordsOnly for words the creator gave you exactly (else write_segment: our cinematographer writes them). Puts a scene's whole words into the draft; they are checked as the cinematographer's are, and an error says what to fix. get_guide words has the format. Set its references first, so its labels answer.
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
words string
the exact text the video model reads
shots string optional
its shot plan: '0-5 s: wide, still: what is seen; 5-10 s: close-up: ...'; every scene is shot from one, so it's needed when it has none or this reframes or retimes a shot
copy_bibleCarry people and places from another workflow into this one's bible, in the draft, by name, with their pictures, looks and voices, on the same files. Only who is on that workflow: who is only in a draft comes with Use.
workflow string
a wf_ id
frm string
a wf_ id: the workflow they are in
names string
their names, with commas
add_to_libraryAdd a file to this workflow's library: an upload_file url once its curl has run, or a small file inline (a picture or a document, under 1.5 MB).
workflow string
a wf_ id
url string optional
the url upload_file gave
name string
what to call it, with its extension
content_base64 string optional
the file's bytes
type string optional
with content_base64: its content type
copy_resourcesPut library items of other workflows into this one's library: the same files, new rows.
workflow string
a wf_ id
ids string
pic_, aud_, vid_ and doc_ ids with commas
remove_resourceTake a library item off this workflow, only one you made. What the creator made or uploaded stays: ask them.
workflow string
a wf_ id
id string
a pic_, aud_, vid_ or doc_ id you made
build_editMake a new take from a saved take's Edit lane: its cuts, look, captions and transitions, as the creator's Build button does. Free. The take stays as it is. Answers with a job id.
workflow string
a wf_ id
sayPut a line in the dock for the creator to read in Studio: what you are doing, or what you need.
workflow string
a wf_ id
text string
one short line
proposeHand the draft to the creator: they see your changes and renders in Studio, with a Use button and a Discard button, and your message. wait with this workflow follows their answer.
workflow string
a wf_ id
message string optional
what you did and what you ask of them, a sentence or two
landLand the draft on the workflow yourself, only if the creator allowed it (whoami says so). Renders within the daily limit start, the rest wait for their Use.
workflow string
a wf_ id
add_segmentsAdd empty scenes to the draft. Give them words with write_segment: our cinematographer writes them.
workflow string
a wf_ id
count integer
how many, 1-20
after string optional
the scene to add them after; S0 puts them first; left out: at the end
seconds integer optional
each one's length, 5-15
mode string optional
what they render from (omni_reference, first_last_frame)
continues boolean optional
true: each carries on from the scene before it, with no cut
set_segmentChange a scene's length, mode, continuity or place in the order, in the draft. Pass only what changes.
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
seconds integer optional
5-15
mode string optional
(omni_reference, first_last_frame)
continues boolean optional
true: no cut from the scene before
move_to integer optional
new position, 1 = first
remove_segmentRemove a scene from the draft. The ones after it move up.
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
write_screenplayHave our screenwriter write a story as a screenplay document in the library: scenes of 5-15 s with every line. Or change a script in the library, the rest kept word for word. Skip it when the creator has a script: upload that.
workflow string
a wf_ id
brief string
what the creator asks, word for word
seconds integer optional
how long the whole video is, in seconds
episodes integer optional
how many episodes
script string optional
a doc_ id: the script to change; left out, a new story
pitch boolean optional
true: two loglines to choose from, nothing saved
script_only boolean optional
true: the creator wants only the script for now
write_segmentHave our cinematographer write a scene's whole words, the exact text the video model reads, from the scene as it is, its shot plan and your note, into the draft. Set its references first. For a whole script use break_down_script.
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
note string
what it shows, in the creator's words: every fact, act, line, camera note and timing; for a change, only what changes
shots string optional
its whole shot plan: '0-5 s: wide, eye level, still: what is seen; 5-10 s: close-up, slow push-in: ...'; needed when it has none or the change reframes or retimes a shot
set_referencesSet what a scene renders from, in the draft: who is in it, each on their bible picture, and its other pictures, videos and clips (omni reference), or its first and last frame (first/last frame).
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
cast string optional
who is in it, by bible name in the order its words number them, e.g. '@Mia, @Kitchen'; 'none' clears them
pictures string optional
its other references in order, pic_, vid_ and aud_ ids with commas: 9 pictures, 3 videos and 3 clips at most, a video 2 s at least; 'pic_ab12cd34:composition' lends framing, light or things only; '' clears them
mute string optional
vid_ ids among them whose own sound is off; '' turns all sound on
first string optional
a pic_ id, or 'none'
last string optional
a pic_ id, or 'none'
add_to_bibleAdd a person or place to the series bible in the draft, or change one, by name.
workflow string
a wf_ id
kind string
(person, place)
name string
their name
look string optional
one sentence in the creator's language: a person's age (an adult), hair, face, build, clothes; a place's look and light
pronoun string optional
(she, he)
picture string optional
a pic_ id: their picture
voice string optional
a person's voice, one sentence: gender and age, pitch, timbre, pace, accent; written into every line of theirs
remove_from_bibleRemove a person or place from the series bible, in the draft.
workflow string
a wf_ id
name string
their name
make_pictureMake pictures into the library, 1 to 3 cents each, in seconds. With references it edits or combines them. Within the creator's daily limit it starts at once, above it the creator gets a Go card and this answers with a call id for wait. Never a picture that looks like a real person.
workflow string
a wf_ id
words string optional
what the picture model reads: for a new picture one English paragraph of 100-200 words, everyone an adult by decade; get_guide pictures says how
references string optional
pic_ ids to edit or combine, in the order the words name them
ratio string optional
its frame (9:16, 16:9)
resolution string optional
720P unless asked (480P, 720P)
count integer optional
how many, 1-4, each its own seed and price
for_bible string optional
a bible name: the picture becomes theirs
redo string optional
the pic_ id of one that missed the ask: the new one takes its place in the draft; twice at most
fix string optional
with redo: what was wrong with it
compose_musicMake music into the library from words: a song with its lyrics or an instrumental, about 7 cents a minute. Within the daily limit, else a Go card.
workflow string
a wf_ id
description string
its caption; get_guide music says how
seconds integer
the most it runs, 10-180
vocals string optional
(instrumental, sung)
lyrics string optional
the sung words in sections, a lowercase tag on its own line
count integer optional
how many, 1-4
lay_under_video boolean optional
lay it under the whole video, in the draft
design_soundMake a sound effect or ambience into the library, or an instrumental from a library clip, about a cent. Within the daily limit, else a Go card.
workflow string
a wf_ id
description string
the sound; get_guide music says how
seconds integer
10-60
clip string optional
an aud_ id to make it from
clip_use string optional
remix keeps its melody and timing; style makes a new piece with its sound (remix, style)
count integer optional
how many, 1-4
lay_at number optional
where on the video's clock to lay it, in seconds, in the draft
lay_trackLay a library audio clip on the Sound lane under the video, in the draft, or move it or change its level or fades.
workflow string
a wf_ id
clip string
an aud_ id
start number optional
seconds
end number optional
seconds
volume number optional
0-2; 1 = as made
fade_in number optional
seconds: 0.1 (none), 0.5, 1, 2 or 4
fade_out number optional
seconds: 0.1 (none), 0.5, 1, 2 or 4
remove_trackTake a track off the Sound lane, in the draft.
workflow string
a wf_ id
track string
T#, from open_workflow
set_formatChange the whole video's settings, in the draft. Pass only what changes.
workflow string
a wf_ id
name string optional
the workflow's name
speech_language string optional
the language its spoken lines are in (Arabic, Chinese, English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish)
orientation string optional
(portrait, landscape)
resolution string optional
one open_workflow lists
lookRead a scene's whole words or a document's, or see pictures, or have our reviewer watch a take, a preview or a library video, one at a time: it says what it sees, answers your question and sends frames. A whole take or video is heard too.
workflow string
a wf_ id
target string
'S2' or a doc_ id; or pic_ ids with commas; or a take_ id, a preview like 'S2.1' or a vid_ id, with pic_ ids after it to compare; or one moment, 'take_ab12cd34@13'; or a script's scene as the crew planned it, 'scene 7' or 'scenes 3-5'
question string optional
with a video: one open question in English on how something in it looks (what, who, where, how many, what colour); never yes or no, never naming what people do to each other
frames integer optional
with a question: how many frames that show its answer come back, 1-9
break_down_scriptThe one call for a whole script, however long. Our crew breaks it into scenes, makes a picture for everyone and everywhere new (a cent each, within the daily limit), plans every shot and writes every scene, straight onto the workflow, with no stop. Answers with a job id: wait follows it, then quote, shoot and propose.
workflow string
a wf_ id
script string optional
the script's doc_ id
direction string optional
how the creator wants the whole film shot, in their words
again boolean optional
true: break it down again from the start, as new scenes after the last ones, which stay until you remove_segment them
plan_shotsHave our crew read scenes' shot plans back from their words. A scene needs one to render.
workflow string
a wf_ id
scenes string optional
like 'S3,S7-S9'; every scene that lacks one if left out
write_scenesHave our crew write scenes of a broken-down script again, six at a time. Answers with a job id.
workflow string
a wf_ id
scenes string optional
like 'S3,S7-S9'; every scene not written yet if left out
shootAdd a full render of the video, or of a range, to the draft. It starts when the creator presses Use, or with land if they allow it.
workflow string
a wf_ id
first string optional
first scene, S1 if left out
last string optional
last scene, the last if left out
quoteThe exact price in credits of a take or a preview, or what it would be with what you pass. Nothing changes.
workflow string
a wf_ id
segment string optional
a scene: S2 (its place now) or seg_ab12cd34; a take of the whole video if left out
last string optional
a take of a range: its last scene
preview boolean optional
true: the scene's 480P preview instead of a take
resolution string optional
one open_workflow lists
seconds number optional
what if each were this long
mode string optional
what if each rendered from (omni_reference, first_last_frame)
pictures integer optional
what if each carried this many pictures
clips integer optional
what if each carried this many clips
videos integer optional
what if each carried this many videos
deliverSave a take into the library as an MP4, with the Sound lane mixed in, and get its link. Free.
workflow string
a wf_ id
take string optional
a take_ id; the newest if left out
report_brokenSend a render that came out badly broken to our team's test set, with the words and pictures it was made from, when the creator says it is. Free, and nothing here changes.
workflow string
a wf_ id
segment string
a scene: S2 (its place now) or seg_ab12cd34
problem string
what is wrong, in the creator's own words
video string optional
a take_ or job_ id: the video they mean; the scene's newest if left out
pull_stillSave one frame of a take into the library as a picture. Free.
workflow string
a wf_ id
take string optional
a take_ id; the newest if left out
at string optional
seconds into it, or 'end'; its first frame if left out
clip_videoCut a stretch of a library video or a take into the library, 60 s at most, or its sound alone as a clip. Free.
workflow string
a wf_ id
video string
a vid_ or take_ id
start string optional
seconds or a clock (9:50.5); its first second if left out
end string optional
the same; its last second if left out
audio boolean optional
true: its sound alone
save_documentSave words as a document in the library. For a file on disk use upload_file: it costs you no tokens.
workflow string
a wf_ id
name string
its title
text string
its words, whole
edit_footageEdit a saved take on the Edit lane, in the draft, with no new render: cut a stretch out, or play a library video in it, or with start = end put a video in whole, or put a stretch back. Free: build_edit then makes a new take of it, the take kept as it is.
workflow string
a wf_ id
take string optional
a take_ id; the newest if left out
start number
seconds into the take
end number
seconds into the take; = start to put a video in there
video string optional
a vid_ id
own_sound boolean optional
with video over a stretch: keep the take's own sound under it
back boolean optional
true: put the stretch back as it was
color_gradeColour a saved take on the Edit lane, in the draft: a named look, then each number moves one slider. Free: build_edit makes a new take with it.
workflow string
a wf_ id
take string optional
a take_ id; the newest if left out
look string optional
original takes the look off (original, warm, cool, vivid, film, mono, vintage, night, airy)
exposure integer optional
-100 to 100
contrast integer optional
-100 to 100
saturation integer optional
-100 to 100
temperature integer optional
-100 (blue) to 100 (orange)
tint integer optional
-100 (green) to 100 (magenta)
fade integer optional
0-100: lifted, matte blacks
subtitleCaptions on a saved take from what is said in it, in the draft: on, off, their style, or one line's words fixed. Free: build_edit burns them in.
workflow string
a wf_ id
take string optional
a take_ id; the newest if left out
on boolean optional
true: make them; false: take them off
style string optional
(clean, bold, boxed)
font string optional
(noto-sans-sc, noto-serif-sc, lxgw-wenkai, smiley-sans, zcool-kuaile, zcool-qingke-huangyou, zcool-xiaowei, ma-shan-zheng, zhi-mang-xing, inter, montserrat, bebas-neue, oswald, anton, playfair-display, eb-garamond)
line string optional
C#, from open_workflow: the line to fix
text string optional
with line: its words as said
set_transitionA dip to black or white or a dissolve on a saved take, where its picture changes, in the draft. Free: build_edit makes it.
workflow string
a wf_ id
take string optional
a take_ id; the newest if left out
kind string
a dissolve needs a shot either side (black, white, dissolve, none)
scene string optional
the scene change into this scene
all_scenes boolean optional
true: every scene change
at number optional
seconds into the take: 0, its end or a mark's edge
seconds number optional
0.3 quick, 0.6 (unless asked), 1 slow
set_production_soundThe video's own sound on the Sound lane, in the draft: its level, or a stretch silent, or heard again.
workflow string
a wf_ id
volume number optional
0-1; 1 = as rendered
silent_start number optional
seconds on the video's clock
silent_end number optional
seconds on the video's clock; 0.3 s at least
back boolean optional
true: those silent stretches are heard again
waitFollow what is under way: call and job ids, or everything on a workflow, including a Go card and the creator's answer to propose. It answers when one ends, or after up_to seconds, with how long is left: with a shell, sleep that long first, so that waiting costs no tokens.
ids string optional
call_ and job_ ids with commas
workflow string optional
a wf_ id: everything under way on it
up_to integer optional
seconds to hold, 50 if left out, 90 at most