9 best AI image and video APIs: costs and integration (2027)


Quick answer
Start with Magic Hour if your app needs image generation, video generation and related editing tools in one media workflow. Compare Replicate, fal and Runware when your priority is choosing among many hosted models. OpenAI suits direct GPT Image integration, Runway offers its own and third-party video models plus editing endpoints, Leonardo connects visual experimentation to API code, Google offers its image and video models through cloud APIs, and Hugging Face supports dedicated model deployment.
Choose the provider and the model separately. The provider determines authentication, billing, queues, support and file delivery. The selected model determines which inputs, controls and outputs your feature can use.
Magic Hour publishes this guide and is included where relevant. We selected current options with official product documentation and a distinct fit for the tasks in this guide, then compared documented inputs, controls, limits, exports, pricing mechanics, and workflow fit. This is not a controlled output-quality benchmark unless a retained test is explicitly described below.
Best AI image and video generation APIs compared
Provider | Most useful when | Image/video coverage | Cost basis |
|---|---|---|---|
Building a connected image, video and media-editing workflow | Generation plus tasks such as image editing, face swap, lip sync and upscaling | Credits specific to the endpoint, model and settings | |
Evaluating hosted models with different capabilities | Both, depending on the model | Official models use defined output/input units; community models generally use compute time | |
Integrating model endpoints with managed queues and SDKs | Both, plus other modalities | Usually per output unit; model-specific rates and some compute-based exceptions | |
Using a common task interface across model providers | Both, plus editing and other tasks | Model-specific request or compute pricing | |
Designing generations visually before exporting API code | Image generation/editing and video workflows | Pay-as-you-go API credits or custom terms | |
Direct image generation and reference-based editing | Image generation and editing; GPT Image models do not generate video | Text/image input tokens and image output tokens | |
Integrating Runway video generation and editing | Both, with capabilities defined per model | API credits per image, video second or other model-specific unit | |
Working directly with Google models and cloud infrastructure | Imagen/Gemini image workflows and Veo video | Model-, modality- and output-specific rates | |
Deploying a compatible model on dedicated infrastructure | Depends on the model and serving implementation | Provisioned instance usage, with hourly rates billed by the minute |
Reviewed September 13, 2026. This is a documentation-based comparison, not a measured speed or quality ranking. Magic Hour publishes this guide and is included in the comparison. Provider examples show capabilities; your own files and acceptance criteria determine whether the outputs work for your product.
Run one traceable media API job
Send one representative image or video brief through the exact endpoint, retain every request and result, and calculate accepted-output cost before increasing traffic.
Explore Magic Hour API1. Magic Hour: connect generation with practical media tools
Magic Hour’s API documentation covers text-to-video, image-to-video, image generation and editing, plus workflows including face swap, talking photos, lip sync, background removal and upscaling. That is useful when the feature extends beyond generating one isolated image or clip.
For example, a product-marketing workflow might create a scene around a supplied product image, animate the approved image and add a separate localized presenter asset. Each step still needs its own supported inputs and output review.
What to check: The model and credit reference lists exact model IDs, supported resolutions, durations and rates. Free-plan access still consumes credits. Video cost changes with model, duration, resolution and, where applicable, audio. Select a model explicitly when you need reproducible settings; the default recommendation can change.
First step: Try the intended visual task in Image-to-Video or AI Image Editor, then use the matching documented endpoint for your integration. A browser tool’s free allowance is not a promise of the same API allowance.
2. Replicate: distinguish official and community models
Replicate offers a common platform for running models, but its two model categories have different operating assumptions. Official models have maintained APIs, warm availability and pricing by defined units such as images or video seconds.
Community models are maintained by their creators, generally billed by hardware runtime and can experience cold starts. Their documentation, licenses and support vary. You can create dedicated deployments when you need more control.
Use it for: Trying several model families without building GPU-serving infrastructure for each one.
What to check: Pin community model versions, review the specific model license and distinguish a per-output price from an estimated runtime cost. Do not assume a free credit offer or one model’s latency applies to the entire catalog.
3. fal: model endpoints with queue handling
fal’s Model APIs provide hosted image, video and other models through HTTP and supported clients. Its queue handles status tracking; the subscribe pattern handles polling for callers that want to wait for a result.
Use it for: A product that needs hosted models, documented input schemas and managed asynchronous execution.
What to check: fal’s pricing documentation bills Model APIs by each model’s unit, such as an image, megapixel, video or video second. Some models use compute-based billing. Deploying your own application on fal Serverless is a different product and pricing path. An hourly GPU quote should not be presented as the price of generating an image through a prebuilt model endpoint.
Measure latency using your chosen model and workload before designing a “results in three seconds” experience. The provider name alone cannot establish that promise. For a measured first-party reference, our 30-day Magic Hour API latency benchmark reports p50 end-to-end completion time and successful-job sample sizes for 11 video endpoints; it is an internal baseline, not a cross-provider ranking.
4. Runware: a shared task interface across models
Runware offers image, video, editing and other models through a common API. Requests use a task array, and its documentation covers REST, WebSockets and asynchronous result delivery. Its model identifiers identify what you are actually calling.
Use it for: An application that wants several model choices within a shared request and billing interface.
What to check: Read the task and model documentation for the selected operation. Different models can require different references, dimensions and controls even when the surrounding interface is shared. Keep the provider name distinct from the model author: Runware is not the creator of every model it hosts.
For pricing, compare the exact model and settings. A low example price or a vendor’s savings claim is not a universal rate for all images and videos.
5. Leonardo: move from visual controls to API requests
Leonardo’s API product emphasizes a visual design workflow: configure a generation, inspect the result and export the corresponding API code. It also offers reusable blueprints for workflows such as mockups and upscaling.
Use it for: A team that wants designers and developers to agree on a generation’s settings before integrating it.
What to check: Leonardo currently lists pay-as-you-go API credits and custom plans. API requests cost API credit; a free website account does not make production requests free. Its public page lists up to 10 concurrent generations on pay-as-you-go, with custom limits available. Confirm your account’s current allowance before estimating how long a batch will take.
6. OpenAI: direct GPT Image generation and editing
OpenAI introduced GPT Image 2.5 Flare and Sunburst on September 8, 2026. Flare is positioned for everyday generation; Sunburst emphasizes editing precision. These are image models, not video generators.
Use it for: A feature centered on creating or revising images from text and image references using OpenAI directly.
What to check: The Flare model page and Sunburst model page list quality options, rate limits and token pricing. Both list $5 per million text input tokens, $8 per million image input tokens and $30 per million image output tokens, before applicable caching. These are token rates, not a fixed price per image.
The documentation explicitly says the GPT Image 2 calculator does not estimate GPT Image 2.5 token consumption. Record actual usage for your chosen size, quality and editing inputs rather than reusing an older per-image estimate. A ChatGPT subscription is also a separate product from API billing.
7. Runway: video generation and editing through documented models
Runway’s API model documentation and pricing reference cover generation and editing models, including Gen-4.5 and Aleph 2.0 alongside third-party models such as Seedance and Veo. Its API has published usage tiers; the old description of a generally invite-only API with a waitlist is not a useful account of current access.
Use it for: Building a feature around a specific Runway model or supported editing operation.
What to check: Supported inputs, duration, output format and concurrency limits depend on the model and account tier. API credits are separate from web-app subscription credits. Professional or HDR output formats can add surcharges, so compare the export you will actually deliver.
8. Google: choose the model and API surface together
Google offers image generation and editing through models such as Gemini and Imagen, and video generation through Veo. Google Cloud and the Gemini Developer API have their own setup, availability and billing documentation.
Use it for: Working directly with a Google model, especially when your application already uses the corresponding cloud infrastructure.
What to check: Begin with the Gemini image-generation guide or Veo guide, then use pricing for the same API surface. Google Cloud’s pricing table separates image generation, editing, upscaling and video settings. A Google AI consumer subscription or Flow credit allowance is not a direct API rate.
9. Hugging Face: dedicated deployment when control matters
Hugging Face Inference Endpoints lets you deploy compatible models on dedicated infrastructure. This can suit custom weights, a specific serving implementation or deployment requirements that a shared model API does not meet.
Use it for: A team prepared to choose the model, hardware and scaling configuration, and to maintain the application around them.
What to check: The pricing documentation lists instance rates and bills by the minute, including applicable initialization and running time. Small CPU-instance prices are not GPU-generation prices. Dedicated hosting is not automatically cheaper: utilization, cold starts, engineering time and required capacity determine the economics.
Compare costs with a defined job
Use a fixed deliverable and include attempts you will discard. These examples illustrate billing math; they do not compare visual quality.
Example job | Published rate used | Calculated generation charge |
|---|---|---|
Historical rate illustration: 100 generated image candidates using Imagen 4 Fast on Google Cloud | $0.02 per image | $2 for generation |
20 eight-second Gen-4.5 video candidates through Runway’s API, before optional format surcharges | 12 credits per second at $0.01 per credit | 1,920 credits, or $19.20 |
320 generated seconds at the same rate | 3,840 credits, or $38.40 |
Sources: Google Cloud pricing and Runway API pricing. These amounts exclude other services, storage, delivery, taxes and any minimum funding requirement. The Imagen 4 Fast row is historical billing math: the Google Cloud model documentation lists its generation endpoint as discontinued June 30, 2026. For a new image job, budget the current replacement endpoint instead; the retained price row is not proof of access.
For a credit-based provider, calculate the job in its own credits first, then use your actual funding terms to convert it to money. For dedicated compute, include running capacity rather than counting only completed files.
Finally, calculate total relevant spend ÷ accepted outputs. If only half of 100 generated images meet your requirements, your generation cost per accepted image is twice the cost per generated image. Keep API failures and visually rejected outputs separate because providers can bill them differently.
Use real examples to define your acceptance criteria
Our commercial image-to-video benchmark includes source images, exact prompts, request records and output files for 60 attempts across five named model selections through Magic Hour. Fifty-eight completed with downloadable videos. That establishes recorded completion, not a quality winner or a customer conversion rate.
Use the product, footwear, coffee and interior examples to identify details your own workflow must preserve. For a product ad, inspect the label, shape, materials and complete motion sequence. A technically successful API response can still contain a video you should not publish.
For images, use one repeatable task: place the supplied product on a neutral studio background, preserve its label and proportions, and return the required image size. Then ask for one specific edit, such as changing only the background color. Inspect what changed and what should have stayed fixed.
From a sample to a reliable product feature
- Define the deliverable. Record input types, dimensions, duration, audio, file format and the details that must remain unchanged.
- Run one representative request. Start with the provider’s current endpoint example and supported settings.
- Keep the job ID. For asynchronous work, poll or receive the documented completion event. A queued request is not a finished asset.
- Save the output. Check download availability and retention rules before relying on a temporary provider URL.
- Review quality and usage. Record the actual cost and whether the file meets the original brief.
- Increase volume within account limits. Check concurrency, failures and cancellation behavior before promising a delivery time to users.
After a timeout, look up an existing job before sending another creation request. Otherwise, a retry can create a second billable generation. Use idempotency features where the selected API documents them.
Completion and cancellation differ by provider
fal: COMPLETED still needs an error check. The queue reference allows a failed request to report COMPLETED with error and error_type. Check those fields, then retrieve the model-specific result and confirm the expected file exists. Canceling a running request sends a signal that the app may not handle; do not tell a user the job stopped merely because cancellation was requested.
Replicate: aborted and canceled have different billing implications. The prediction lifecycle distinguishes succeeded from failed, canceled and aborted. A deadline exceeded before processing starts produces aborted with no charge; a deadline exceeded after processing starts produces canceled, with the running time charged under the documented deadline policy. Keep the original prediction ID and terminal status so an application timeout does not become an automatic second paid attempt.
Magic Hour: keep polling as a recovery path. The video-project details and image-project details document complete, error and canceled separately. Successful completion supplies downloads; cancellation emits no webhook. A webhook-only listener can therefore miss a canceled job. Retain the project ID, reconcile unresolved work through the matching GET endpoint and verify the downloaded asset before marking the customer deliverable ready.
Output retention: a result URL is not durable storage
Download the required file and verify your stored copy before calling the customer deliverable ready. A successful generation and a durable handoff are different stages. Current provider documentation illustrates why a dashboard preview or returned URL should not be your application’s only copy.
Provider | Documented boundary | What the application should retain |
|---|---|---|
API inputs, outputs, files and logs are removed after one hour by default; website predictions have different retention. | Copy necessary files and job records promptly; a website result is not evidence of API retention. | |
Result URLs expire within 24–48 hours of API access. | Save required output in your own storage; do not expose a temporary provider URL as the permanent product asset. | |
CDN-file expiry is configurable; request-history payload storage is a separate setting. | Verify both controls rather than treating a history setting as a file-retention or complete ZDR guarantee. |
Sources checked October 19, 2026: Replicate data retention, Runway output delivery and fal storage controls. These are documented policies, not measured deletion or availability tests.
For fal specifically, request-history inputs and outputs are kept for 90 days by default. X-Fal-Store-IO: 0 changes that history storage; CDN files have a separate lifecycle control. Application-managed logging is another boundary. If a project requires Zero Data Retention, confirm endpoint coverage with fal rather than assuming one header establishes the entire commitment.
Worked handoff: Friday generation, Monday review
Suppose a client will review a clip on Monday but the generation completes on Friday. This is a workflow example, not a test of any provider. A temporary Friday link may no longer work at review time. The production job should retrieve the result after completion, save the required file under your application’s access policy, and present a link to that stored copy.
Keep the provider job ID beside the stored object, chosen model, settings, terminal status and recorded charge. Verify that the saved file opens and has the expected media type, dimensions and duration before marking it ready for review. A downloaded error page or a zero-byte object is not a recovered video. Keep the creative acceptance decision separate: a valid file may still fail the brief.
If the transfer fails while the provider result remains available, retry retrieval for the existing job before submitting another generation. A new generation can create another charge and a different creative result. If the provider file has expired and no copy exists, mark the asset unavailable and explain the recovery choice; do not keep showing a broken player or silently promise the identical output will be recreated.
For Magic Hour integrations, keep the matching video-project details endpoint or image-project details endpoint as the job-state reference. Retrieve the documented result, then verify the stored asset independently. The API’s completion status should not be repurposed as proof that your own storage transfer or customer review succeeded.
Retention, privacy and usable output are separate checks
Choose your own retention and deletion policy for the files you copy; durable delivery does not mean keeping customer media forever. Track who can access the stored file and what happens when a customer deletes the project. Provider file expiry, request-history cleanup, application logs and model-training policy answer different questions. Do not use one of those facts as a substitute for the others.
When evaluating providers, include this final handoff in the same representative job as generation. Record whether the file was copied successfully and still available for the required review window. Measure recovery work and any additional paid attempts separately. This makes the operational comparison useful to a product team without inventing a cross-provider speed, quality or privacy ranking.
Continue learning
Continue learning: AI media API evaluation framework, AI video API latency benchmark, and text-to-image API integration guide.
Frequently asked questions
Start with Magic Hour when you want generation and related media-editing tasks in one workflow. Compare Replicate, fal or Runware when choosing among hosted model families is the main requirement. Make the final choice on a representative task, not catalog size alone.
There is no useful universal answer without the model, output settings and workload. Compare cost per accepted image or clip. Include retries, unused provisioned capacity and minimum payments; do not compare a GPU-hour price directly with a per-image rate.
Some providers offer limited trial credits or free access to selected models. Verify the current account offer, supported settings and credit allowance. A free playground, website tier or model download does not imply unlimited free API inference.
You can keep your application’s job and file handling separate from provider-specific requests. But inputs, supported settings, moderation, billing and outputs can differ even for similarly named models. Recheck the complete workflow when switching.
See our image-generator API guide, image-to-video API comparison, or image-upscaling API guide. If you already know which Magic Hour task you need, go straight to its API documentation.

Continue Reading

How to evaluate AI media APIs: total time, cost and reliability

AI video API latency benchmark: 30 days of real jobs

Text-to-image API integration guide: request to accepted image

Best multimodal video APIs: inputs, controls & costs (2027)

7 best text-to-video APIs: models, queues & avatars (2027)









