Skip to main content
Use this guide to make your first successful AI Stats request in a few minutes. You will:
  • create an API key
  • send one free text request
  • confirm where to read the model output
  • know what to check if the request fails

1. Create an API key

  1. Open the AI Stats Dashboard.
  2. Create a key under Gateway -> Keys.
  3. Copy it once and store it securely.
Use this format:
Authorization: Bearer aistats_v1_sk_<kid>_<secret>
Treat your API key like a password. Do not expose it in client-side code.

2. Send your first free request

Use POST /v1/responses for the fastest first success.
Requests to :free models do not require deposited credits. Paid models still require available wallet balance.

Example request

curl https://api.phaseo.app/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemma-3-27b:free",
    "input": "Reply with: quickstart works",
    "temperature": 0
  }'

Example response

{
  "id": "resp_...",
  "object": "response",
  "created_at": 1730000000,
  "status": "completed",
  "completed_at": 1730000001,
  "model": "google/gemma-3-27b:free",
  "output": [
    {
      "type": "message",
      "id": "msg_...",
      "status": "completed",
      "role": "assistant",
      "content": [{ "type": "output_text", "text": "quickstart works", "annotations": [] }]
    }
  ],
  "usage": {
    "input_tokens": 9,
    "output_tokens": 3,
    "total_tokens": 12
  },
  "error": null,
  "incomplete_details": null
}
If you use the Responses API directly, read the assistant reply from output[].content[] where type is output_text. If you use the Vercel AI SDK, read the reply from result.text.

3. If it does not work, check these first

  • 401: the API key or auth header is wrong.
  • 400: the request body is invalid or includes an unsupported field.
  • 402: paid model without sufficient balance. Use a :free model or top up credits.
  • 429/5xx: retry with backoff.
Use the Error Handling reference to debug quickly.

4. Video requests work differently

Video generation is async by design, so you create a job first and then check for the result.
  1. Create a job with POST /v1/videos.
  2. Poll status with GET /v1/videos/{video_id} until completed.
  3. Download content from GET /v1/videos/{video_id}/content.
# Create
curl https://api.phaseo.app/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<video-model-id>",
    "prompt": "A cinematic sunrise over a mountain lake"
  }'

# Poll status
curl https://api.phaseo.app/v1/videos/VIDEO_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

5. Next steps

Integrating with the Gateway

Production integration patterns and endpoint selection.

API Reference

Full request and response docs for every endpoint.

Examples

More complete request samples for common workflows.

Support

Get help with debugging, routing, and model behavior.
Last modified on May 19, 2026