API Documentation

Drop-in OpenAI-, Anthropic- and Gemini-compatible endpoints for every model on your account. Bring your favorite SDK.

Get an API key

Base URL

Send requests to the API host shown below. All endpoints live under /v1 (OpenAI-style) or /v1beta (Gemini).

https://resell.api.airforce.example/v1

Authentication

Mint a key on the API Keys page, then send it as a Bearer token. The Anthropic-style /v1/messages endpoint reads x-api-key; Gemini's endpoints read x-goog-api-key.

Authorization: Bearer afk-•••••••••••••••••••••••••••••••••
Your secret key is shown only at creation time. If you lose it, mint a new one and revoke the old.

List models

GET/v1/models

Returns the models you can call from this account, formatted as OpenAI's model list with a pricing extension showing what you'll be billed per request.

curl https://YOUR-HOST/v1/models \
  -H "Authorization: Bearer afk-YOUR_KEY"

Chat completions

POST/v1/chat/completions

Drop-in OpenAI chat-completions surface. Standard request/response shape — your existing OpenAI SDK works unmodified once you point it at our base URL.

curl https://YOUR-HOST/v1/chat/completions \
  -H "Authorization: Bearer afk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "hi"}]
  }'

Responses

POST/v1/responses

OpenAI's newer Responses API (input/output_text shape). Supports the same models as chat completions.

curl https://YOUR-HOST/v1/responses \
  -H "Authorization: Bearer afk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "gpt-4o-mini", "input": "hi" }'

Anthropic messages

POST/v1/messages

Anthropic-native messages endpoint. Forward your existing claude/anthropic SDK requests unchanged.

curl https://YOUR-HOST/v1/messages \
  -H "x-api-key: afk-YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "hi"}]
  }'

Gemini generate-content

POST/v1beta/models/<model>:generateContent

Google Gemini's generative-language endpoint. Authenticate via x-goog-api-key.

curl "https://YOUR-HOST/v1beta/models/gemini-2.0-flash-exp:generateContent" \
  -H "x-goog-api-key: afk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "contents": [{ "role": "user", "parts": [{ "text": "hi" }] }] }'

Image generation

POST/v1/images/generations

OpenAI-compatible image endpoint. Generated assets are re-hosted on tenant-configured S3 and returned as stable URLs.

curl https://YOUR-HOST/v1/images/generations \
  -H "Authorization: Bearer afk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-2-dev",
    "prompt": "A cute baby sea otter floating on its back",
    "n": 1,
    "response_format": "url"
  }'

Common parameters:

  • model — image model id (required).
  • prompt — image description (required).
  • n — number of variations.
  • size — OpenAI-style WxH (e.g. "1024x1024").
  • aspect_ratio — alternative to size (e.g. "16:9").
  • quality — "standard" | "hd" or model-specific.
  • response_format — "url" (default) or "b64_json".
  • seed — reproducibility seed where supported.
  • input_images — reference images for img2img / first-frame.

Response shape mirrors OpenAI:

{
  "created": 1715000000,
  "data": [{ "url": "https://YOUR-CDN/img/...." }]
}

Speech (TTS)

POST/v1/audio/speech

Synthesise speech from text. Returns raw audio bytes with the matching Content-Type (e.g. audio/mpeg). PCM and µ-law formats include a WAV header so they play in any browser.

curl https://YOUR-HOST/v1/audio/speech \
  -H "Authorization: Bearer afk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  --output speech.mp3 \
  -d '{
    "model": "eleven-flash-v2-5",
    "input": "Hello, this is a test.",
    "voice": "CwhRBWXzGAHq8TQ4Fs17",
    "response_format": "mp3_44100_128"
  }'

Common parameters:

  • model — speech model id (required). Filter /v1/models by media_type="speech".
  • input — text to synthesise (required). Long inputs are chunked automatically.
  • voice — voice id (required). Use GET /v1/audio/voices to list options.
  • response_format — "mp3_44100_128" (default), "mp3_44100_192", "pcm_22050", "pcm_24000", "pcm_44100", "ulaw_8000".
  • speed — 0.25 – 4.0. OpenAI-compatible. Some upstreams ignore.
  • voice_settings — ElevenLabs-shape: { stability: 0–1, similarity_boost: 0–1, style: 0–1, use_speaker_boost: bool }.
  • language_code — ISO-639-1 hint, e.g. "de", "en", "ja". Improves prosody for multilingual models.
  • seed — reproducibility seed where supported.
GET/v1/audio/voices

Lists every voice you can pass as the "voice" parameter on /v1/audio/speech. Includes premade voices and any you've cloned.

curl https://YOUR-HOST/v1/audio/voices \
  -H "Authorization: Bearer afk-YOUR_KEY"
{
  "voices": [{
    "voice_id": "CwhRBWXzGAHq8TQ4Fs17",
    "name": "Roger",
    "category": "premade",
    "preview_url": "https://...",
    "labels": { "gender": "male", "language": "en" }
  }]
}

Billing

Each request is billed against your credit balance. The price for every model is shown in the Models tab.

Streaming is supported on every endpoint — send `stream: true` (or call Gemini's `:streamGenerateContent`) and the response comes back as SSE.

  • Per-model per-call cap available; set it from the Models tab.
  • Your current balance is on the dashboard overview.
  • Calls are billed based on token usage.

Errors

Errors come back in the OpenAI-shaped envelope so SDKs treat them naturally.

{
  "error": {
    "message": "...",
    "type": "invalid_request_error",
    "code": null
  }
}
  • 400 — bad request (missing model, no channel for that model, invalid JSON, …)
  • 401 — missing or invalid API key
  • 402 — insufficient credits
  • 429 — rate-limited
  • 500 — internal error or upstream failure