Black Friday

Diskon 50% untuk setahun penuh paket apa pun

Ambil penawarannya
eroq

blog/developers·28 Nov 2026·5 mnt·oleh tim eroq

Add AI image and video generation to your app — credits or a dollar balance

How to add AI image and video generation to an app: async jobs, webhooks, refunds on failure, and the two ways to pay for it — credits on eroq, or a dollar balance per model.


Adding AI image and video generation to an app takes three decisions: how your code waits for a render (a job and a webhook, never a blocking call), what happens when a render fails (it should cost nothing), and how you pay for it. That last one is the decision people skip, and it shapes your margins: you either buy credits on a creative platform's API, or you hold a balance in dollars on an API built only for developers, with a price per model.

This guide walks through the parts every integration needs, then the two ways to pay, with the case for each. We make eroq, so it is the first example.

What your app needs, whatever the vendor

  • Jobs, not a blocking request. A video takes from seconds to minutes. Your server submits, gets an id back at once, and finds out later. Serverless functions and load balancers cut long requests; a job survives them.
  • A signed webhook, and a fallback. The vendor calls your endpoint when the render ends, with a signature you check. Keep a poll as a safety net for anything you did not hear about.
  • No charge on failure. A render that fails, or that the vendor refuses, should not cost you. Otherwise your users' failed attempts become your bill.
  • Safe retries. A network error on submit should not create two renders. Look for an idempotency key, or check the job list before you resubmit.
  • A price you can quote. Before you promise your users a price, you need to know exactly what one image or one second of video costs you, model by model.
  • Agent access. More and more of the calls come from an agent rather than your code. An MCP server lets Claude, ChatGPT or Cursor call the same models with the same key.

The mechanics of jobs and webhooks are in async video generation with signed webhooks, and the full vendor checklist in choosing an AI video API.

Option 1: credits on eroq's API

eroq is an AI studio, and its public API is the same engine room: images, video, voice, music and chat from one key, with the studio as a place to test a prompt before you ship it.

curl -X POST https://eroq.ai/v1/videos/generations \
  -H "Authorization: Bearer $EROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-0-fast",
    "prompt": "A barista slides a latte across a wooden counter, morning light, slow push-in.",
    "seconds": 5,
    "aspect": "9:16"
  }'

You pay in credits: 260 credits for five seconds on Seedance 2.0 Fast, 145 on eroq's own Motion One, the full grid on /models. Credits never expire, a workspace shares one wallet across seats and keys, failed renders refund themselves, and a refused request returns content_blocked before anything is charged. Plans raise the rate limits and unlock the premium tiers.

It fits when your product is creative: you want eroq's own engines, characters that keep one face, voice and music next to video, Private mode for renders that should not be stored, and a studio your team can use without code. Start with 40 free credits; the API reference is at /docs.

Option 2: a dollar balance, priced per model

Some teams would rather not think in credits at all. They resell generation inside their own product, their finance team wants dollars, and they want to see what each model costs before they call it.

For that case, Frameport's image and video API is built only for developers: one key for the major models (Seedance, Veo, Kling, Nano Banana and more), a prepaid balance in dollars, the price shown on every model, and nothing debited when a render fails. It has signed webhooks, idempotency keys, a maximum-cost guard on each request, an MCP server, and a Studio to try a model before you write code.

How to choose

If your app… Credits on eroq Dollar balance on Frameport
Is a creative product (characters, voice, music, films) Yes: one key covers all of it Images and video only
Resells generation and quotes prices in dollars Possible, with a conversion Yes: you see the dollar price per model
Needs renders that are never stored Private mode on eroq's own engines Private mode on some models
Is called by an agent MCP server and CLI MCP server
Needs a team studio without code Yes A Studio for testing

Neither is the wrong answer. The question is whether you are buying a creative platform with an API, or an API with a price list.

A five-step integration plan

  1. Pick two models, not ten. One fast, one for the final render. Read their limits (durations, sizes, ratios) from the vendor's model list at runtime instead of hardcoding them.
  2. Store the job id before you tell the user "rendering". If your process crashes between the submit and the database write, the job id is how you find the render again.
  3. Verify the webhook signature, answer 200 at once, do the work after. Slow handlers get retried and create duplicates.
  4. Copy the file you keep. Rendered URLs expire; move the output to your own storage on success.
  5. Show the price before the click. Whatever you pay, your users should see what a render costs them before they press Generate.

FAQ

How do I add AI video generation to my app?

Call a video API from your server: submit a job with a model and a prompt, keep the job id, and get the result from a signed webhook or by polling. Never call the API from the browser with your key, and never wait for a video in one blocking request.

Is it cheaper to pay per credit or per dollar?

It depends on the models you use and on your plan. Credits are usually cheaper per render on a subscription; a dollar balance is easier to budget and resell because each model has a fixed dollar price. Compare the price of the two or three models you will actually call.

Do I pay when a render fails?

On eroq, failed renders refund themselves and refused requests are never charged. Check this on any vendor before you integrate: it is rarely on the pricing page.

Can an AI agent call the same API?

Yes, if the vendor runs an MCP server. eroq's lets Claude, ChatGPT, Cursor and Codex generate images and video with your key; see what an MCP server is.

Tagvideo-apiimage-apiwebhooksmcp

Buat di eroq

Bangun di atas API

Kunci API cukup semenit. Mesin yang sama, harga yang sama, job asinkron dan webhook.

40 kredit gratis · tanpa kartu · mode privat di setiap akun

Privasi

Privat dan tanpa batasan

  • Tanpa filter di mesin milik eroq sendiri: sebagai gantinya ada satu kebijakan tertulis.
  • Mereka tidak menyimpan apa pun, dan tidak ada yang dilatih dengan karyamu.
  • Mode privat tidak menyimpan file sama sekali.