For agents

For agents

This site is model documentation. If you are an AI agent or a background script calling it programmatically, start here.

The primary consumers of this site are humans reading dated blog posts. The secondary consumers are agents, crawlers, and scripts that read the docs, copy snippets, and dispatch jobs. This page is for the second group. It is shorter than the human docs and denser with machine-friendly surfaces.

Canonical endpoint

Every example on this site posts to one fal queue endpoint. Use the same id in your own client.

POST https://queue.fal.run/fal-ai/ernie-image

Fallback: fal-ai/ernie-image/turbo (ERNIE-Image Turbo). Standard ERNIE-Image runs 50 steps; Turbo runs 8 steps at a third of the cost when throughput matters.. Substitute this endpoint when the primary is unreachable.

Machine-readable index

A plaintext summary of this site lives at a well-known URL following the llmstxt.org convention. It enumerates every docs page, every blog post, the API surface, and the FAQ. Fetch it instead of scraping HTML.

GET https://ernie-api.com/llms.txt

The file is served as text/plain, cached for one hour, and regenerated when the build runs.

Schema

Compact parameter table derived from the live site config. Every request must include a prompt string; the fields below are optional with the defaults shown.

KeyTypeDefaultAllowed
promptrequiredstring""Free text describing the desired output.
aspect_ratioenum1:11:1 | 16:9 | 9:16 | 4:3 | 3:4 | 3:2 | 2:3 | 21:9
num_imagesnumber11 to 4, step 1
enable_prompt_enhancerenumtruetrue | false
num_inference_stepsnumber508 to 50, step 1
seednumber00 to +inf, step 1

Canonical schema: fal.ai/models/fal-ai/ernie-image/llms.txt. Cross-reference this table against the vendor manifest on every run; new keys land there first.

Rate limits and pricing

See /docs/rate-limits for the per-account queue limits and recommended exponential backoff on 429 and 503. For cost math, the homepage pricing table breaks down the signature metric (#8 LMArena global rank) against the fal posted rate. Always verify numbers against fal.ai/pricing before billing a job.

Agent-safe snippets

Three minimal clients against the primary endpoint. Each one reads a single environment variable, submits the job, and prints the parsed response. Swap in your own prompt as needed.

Copy, paste, run
01example.shBASH
01curl -X POST "https://queue.fal.run/fal-ai/ernie-image" \
02 -H "Authorization: Key $FAL_KEY" \
03 -H "Content-Type: application/json" \
04 -d '{"prompt":"A vertical coffee shop poster. Large centered headline reads 'MORNING POUR' i...","aspect_ratio":"1:1","num_images":1,"enable_prompt_enhancer":true,"num_inference_steps":50,"seed":0}'

Expected outputs

The output kind for this model is image. The primary field on a successful response is result.images[0].url. Extract it with the extractMedia helper shipped with every site, or read it directly if you are wiring your own client. URLs on fal.media expire after a retention window documented on docs.fal.ai, so copy assets to your own storage if you need them long term.

Failure modes

  • 401 Unauthorized. Your FAL_KEY is missing or revoked. Fetch a new one from fal.ai/dashboard/keys. Do not retry on this error.
  • 422 Validation error. A parameter is out of range or the wrong type. Parse the response body for the offending field and correct it before retrying. See /docs/error-codes.
  • 429 Rate limited. You are above the per-account concurrency cap. Apply exponential backoff starting at 500ms with jitter, capped at 10 seconds, and retry up to five times.
  • 503 Service unavailable. The model is temporarily offline or warming. Retry with the same backoff pattern; if the primary endpoint stays down for more than a few minutes and a fallback is declared above, swap to it.
  • Timeouts. Long jobs should use the async queue pattern from /docs/async-tasks: submit, poll status, fetch the result. Do not hold a synchronous request open for more than about sixty seconds.
Also reading