Skip to main content

Prerequisites

  • A ModelRoute account at app.modelroute.ai
  • A funded balance (executions deduct from your balance)
  • An API key

1. Create an API key

Go to Dashboard > API Keys > Create Key. Copy the full key immediately — it is only shown once. Your key looks like this:
sk_a1b2c3d4e5f6...remaining_hex_chars_crc32hex
Store your API key securely. It cannot be retrieved after creation. If lost, revoke it and create a new one.

2. Submit an execution

Every execution is asynchronous. You submit a request and get a tracking ID immediately:
curl -X POST https://api.modelroute.ai/v1/executions \
  -H "Authorization: Bearer sk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: my-first-execution-001" \
  -d '{
    "model": "flux-1.1-pro",
    "input": {
      "prompt": "A mountain landscape at sunset, photorealistic"
    }
  }'
You’ll receive a 202 Accepted:
{
  "id": "exec_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "PENDING",
  "model": "flux-1.1-pro",
  "hold_amount": "0.048",
  "estimated_cost": "0.040",
  "expires_at": "2026-03-20T10:35:00Z"
}

3. Poll for the result

For this quickstart, we’ll poll. (In production, you’d use webhooks instead.)
# Poll until complete
curl -s https://api.modelroute.ai/v1/executions/exec_a1b2c3d4.../result \
  -H "Authorization: Bearer sk_your_api_key_here" | jq
{
  "execution_id": "exec_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "COMPLETED",
  "output": {
    "images": [
      {
        "file_id": "file_f47ac10b-58cc-4372-a567-0e02b2c3d479",
        "format": "png",
        "width": 1024,
        "height": 768
      }
    ]
  },
  "cost": "0.040",
  "latency_ms": 8420
}

4. Download the result

curl -X GET https://api.modelroute.ai/v1/files/file_f47ac10b.../download \
  -H "Authorization: Bearer sk_your_api_key_here" \
  -o result.png
That’s it — you’ve run your first AI model execution through ModelRoute.

What’s next?

Authentication

API key management, rotation, and permissions.

Webhooks

Receive results instantly at scale.

File Uploads

Upload images, audio, and video as execution inputs.