Give the agent a file
Models that edit, animate or listen take files, by ID (file_...). The agent gets one with upload_file, from one of three places:
Leap reads the type from the file’s bytes, not its name. Storing a video or a sound costs nothing, but needs some credit on your balance, and counts toward your workspace’s 5 GB of uploads a day.
For a larger photo, resize it first, for example to 2048 pixels on its long side. For a video or sound over 100 MB, or one on a slow host, upload it yourself with the API’s direct uploads (up to 1 GB of video) and give the agent its file ID. A file you uploaded through the API can go straight into a run by its ID.
Claude can’t pass a file you attach in its chat to a tool. Give it a link instead.
Use one run’s output in the next
To animate, edit or continue from an image Leap made, the agent callskeep_output with the run’s ID and the output’s index. It gets back a file ID for that image, without downloading or uploading anything, and the same output always gives the same ID. It’s free, and works for images only.
Waiting for a result
generate waits up to 50 seconds for the run to finish, inside the 60 seconds most clients give a tool call. Most images and speech come back finished. A video usually comes back running, and then:
- In ChatGPT and Claude, the result view keeps checking and shows the clip when it’s ready, without a new message from you.
- Any agent can call
get_generationwithwaitset to up to 50 seconds, as many times as it takes. Each call returns as soon as the run ends.
generate_batch waits up to 50 seconds for the whole batch, and says how many are still running. Some presets show a still first: the run has a preview_url while its video renders, and can’t be canceled until its slow_at. It’s still charged only if it succeeds.
Retrying without paying twice
generate and generate_batch need an idempotency_key, a new string for each new request, such as a UUID. The agent makes one up; you don’t have to. If a call times out or the connection drops, the agent sends it again with the same key and gets the first run back, and nothing runs or is charged twice.
Idempotency keys belong to your workspace and never expire. A new request needs a new key: the same key with the same input returns the earlier run, even a failed one, and the same key with a different input is refused. That’s why the Try again button asks for a new key.
What a run costs
Runs cost the same over MCP as in the studio and through the API. The price is held from your balance when a run starts and charged only if it succeeds; when it fails, is refused or is canceled, the hold goes back. A batch is priced and held as a whole, so all of it starts or none of it does, and each run in it is charged only if it succeeds.quotereturns a run’s exact price without running anything, andget_modelshows how the price is worked out. See Pricing and credits.planprices each option it suggests. An option with acost_usdof 0 is priced by a length the words didn’t give, such as a voice-over’s text, so the agent quotes it before telling you a price.get_accountshows the balance, what running jobs hold, and where to add credits: your workspace’s Credits page, or Leap’s price list in ChatGPT and Codex.
Not enough credit. Add credits to keep generating. Add credits at https://app.tryleap.ai/go/settings/credits. In ChatGPT and Codex, it links to Leap’s prices instead. New workspaces get a welcome credit, and a few limits apply before the first top-up. Turn on auto top-up at app.tryleap.ai/go/settings/credits so a long session doesn’t stop for an empty balance.
When a run fails or is refused
A failed run comes backfailed, with error saying why in words and failure_cause for the agent, and it isn’t charged. The tool’s answer also says what to do next:
Every retry needs a new
idempotency_key. Some requests are refused before anything runs or is held:
- Every photo you upload is checked before a run that takes it. A photo that may show someone under 18, or that shows nudity, is refused, and nothing is held or charged. See Photos of people.
planrefuses an ask that names a real person who hasn’t agreed to it, and suggests options with you or a new character instead.- An input that doesn’t match the model’s schema is refused with the field first, such as
input.aspect_ratio: ..., and what it accepts, so the agent can fix it and call again.
Links expire after 24 hours
Every output link is signed and works for 24 hours, for anyone who has it. Download what you want to keep, or ask the agent to read the run again withget_generation, which signs fresh links. The files themselves stay in your workspace: each run’s studio_url opens its page in the studio, with the result, its receipt and the downloads.
Transcripts
Speech-to-text models, such asopenai/whisper-large-v3, return the transcript to the agent as text, inside <untrusted-transcript> tags, with up to 20,000 characters inline. The .txt output has all of it. The tags tell the model that the words came from the recording, so it reads them as data and doesn’t follow anything they say.