Skip to content
FreshApp Demo

OPEN API

Generate from your own code

Use the site's models from your own server. Create a generation with an API key, follow it until it ends, and download its files.

The API spends paid credits only: a paid credit pack or an active paid subscription unlocks it. Keep your keys on your server.

EXAMPLE REQUEST

Create your first generation

export API_ORIGIN='https://demo.freshapp.ai'
export API_KEY='sk_YOUR_API_KEY'

curl --fail-with-body "$API_ORIGIN/api/v1/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: order-1001' \
  -d '{"model":"seed-audio-1.0","input":{"prompt":"A lighthouse on a cliff at dawn, calm sea, soft light."}}'

# Read it every 5 to 10 seconds until its status ends.
curl --fail-with-body "$API_ORIGIN/api/v1/generations/GENERATION_ID" \
  -H "Authorization: Bearer $API_KEY"

# A delivered output's url is a signed link: no key needed.
curl --fail-with-body -o result "OUTPUT_URL"

Set API_KEY to your key first. Send a new Idempotency-Key with each new request, and the same one when you send that request again.

HOW IT WORKS

Three steps from request to file

  1. Create a generation

    Send a model id and its input with your API key and an Idempotency-Key. The answer is the generation, queued, with the credits it holds.

  2. Follow it

    Read the generation every 5 to 10 seconds until it succeeds, partly succeeds, fails or is canceled. What it did not use comes back when it settles.

  3. Download the files

    Each delivered output links to its file on this site. The links a key gets are signed and open for an hour without the key.

PERMISSIONS AND LIMITS

Keys that do only what you allow

  • A key either only reads (lists, reads and downloads) or may also generate (creates and cancels), and an IP allowlist can tie it to your servers.

  • One request reserves at most 150 credits, the most expensive request of the enabled models; a key's own setting or the request's max_credits can only lower it.

  • A key spends at most 5,000 credits a UTC day, and all keys of an account together 10,000, unless you set other limits on the API keys page.

  • Per key and per account: 20 creates and cancels and 240 reads and downloads a minute, and at most 2 generations running at once.

FILES

The OpenAPI file and a TypeScript client

The OpenAPI 3.1 file lists every operation, the input of each enabled model and every error code. The TypeScript client needs nothing else: it keeps one Idempotency-Key across retries and follows a generation to its end, and the React hook polls with it.

FAQ

API questions