Skip to main content

Quickstart

Make your first API call to FairStack in under 2 minutes.

Time to complete: ~2 minutes. One API key, 144 models, 6 modalities.

1. Get your API key

Create a FairStack account and generate an API key from your dashboard.

fs_live_xxxxxxxxxxxxxxxxxxxxxxxx
export FAIRSTACK_API_KEY="fs_live_YOUR_API_KEY"

2. Generate your first image

The example runs Z-Image Turbo. For best quality, use GPT Image 2. Every model's price is shown before you spend.

curl -X POST https://api.fairstack.ai/v1/generations/image \
  -H "Authorization: Bearer $FAIRSTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "z-image-turbo", "input": {"prompt": "A serene mountain lake at sunrise, photorealistic"}}'

Response:

{
  "id": "gen_abc123",
  "status": "completed",
  "url": "https://media.fairstack.ai/image/.../output.png",
  "cost": { "micro": 4800, "display": "$0.0048" },
  "model": "z-image-turbo",
  "modality": "image"
}

3. Generate voice

The example runs Fish Audio S2.1 Pro. The text goes in input.text; voice ids come from GET /v1/voices.

curl -X POST https://api.fairstack.ai/v1/generations/voice \
  -H "Authorization: Bearer $FAIRSTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "fish-s2.1-pro", "input": {"text": "Welcome to FairStack.", "voice": "933563129e564b19a115bedd57b7406a"}}'

4. Generate video

Video generation is asynchronous. You submit a job and poll for the result.

curl -X POST https://api.fairstack.ai/v1/generations/video \
  -H "Authorization: Bearer $FAIRSTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "seedance-2-fast", "input": {"prompt": "A cat walking on a beach"}}'

Poll GET /v1/jobs/:id until status is "completed".

5. Check your balance

curl https://api.fairstack.ai/v1/credits \
  -H "Authorization: Bearer $FAIRSTACK_API_KEY"

Next steps