API Reference
ApexApi follows the OpenAI API format. All endpoints use the base URL https://api.apexapi.dev/v1.
Authentication
All API requests require a valid API key passed in the Authorization header.
Authorization: Bearer ak-your-api-keyAPI keys start with ak- and are 48 characters long. Create keys in your dashboard.
Chat Completions
Create a chat completion with the specified model. Supports streaming via Server-Sent Events.
/v1/chat/completionsParameters
modelstringrequiredModel ID in provider/model format (e.g., openai/gpt-4o).
messagesarrayrequiredArray of message objects with role and content fields. Content can be a string or an array of multimodal parts. See Images & PDFs in Chat.
temperaturenumberSampling temperature between 0 and 2. Defaults to 1.
max_tokensintegerMaximum number of tokens to generate.
streambooleanIf true, responses are streamed via Server-Sent Events. Defaults to false.
top_pnumberNucleus sampling parameter. Defaults to 1.
stopstring | arrayStop sequences. Up to 4 sequences.
Request
POST https://api.apexapi.dev/v1/chat/completions
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "openai/gpt-4o",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "What is the capital of France?" }
],
"temperature": 0.7,
"max_tokens": 1024,
"stream": false
}Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1710000000,
"model": "openai/gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 8,
"total_tokens": 33
}
}Images & PDFs in Chat
Chat completions accept multimodal content. Instead of a string, a message's content can be an array of parts. It's the same format as the OpenAI API, so existing SDKs work unchanged. The playground supports both via the attach button.
Content part types
textobjectA text segment: { "type": "text", "text": "..." }.
image_urlobjectAn image, for vision-capable models. Accepts a base64 data URI or a publicly reachable HTTPS URL: { "type": "image_url", "image_url": { "url": "..." } }. Optional detail: low | high | auto.
fileobjectA PDF document, for PDF-capable models. Must be a base64 application/pdf data URI, max 2 MB per file and 4 file parts per request.
Model support
Images work on all vision-capable models. PDFs are supported on Anthropic Claude, OpenAI GPT-4o / GPT-4.1 / o-series, and Google Gemini models. Sending a PDF to a model without PDF support returns 400 with error code unsupported_content.
Attachments are billed as input tokens by the upstream provider, roughly 1,000–1,600 tokens per image and 1,500–3,000 tokens per PDF page. They are processed in transit only and never stored by ApexApi.
Vision request
POST https://api.apexapi.dev/v1/chat/completions
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "anthropic/claude-sonnet-4.6",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this image?" },
{
"type": "image_url",
"image_url": { "url": "data:image/jpeg;base64,/9j/4AAQ..." }
}
]
}
]
}PDF request
POST https://api.apexapi.dev/v1/chat/completions
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "openai/gpt-4o",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarize this document." },
{
"type": "file",
"file": {
"filename": "report.pdf",
"file_data": "data:application/pdf;base64,JVBERi0xLjQ..."
}
}
]
}
]
}Image Generation
Generate images from text prompts using supported image models.
/v1/images/generationsParameters
modelstringrequiredImage model ID (e.g., openai/gpt-image-2, google/nano-banana-2). Full list via GET /v1/models.
promptstringrequiredText description of the image to generate (max 4,000 characters).
nintegerNumber of images to generate, 1–10. Defaults to 1.
sizestringImage size as WIDTHxHEIGHT, e.g. 1024x1024 (default).
qualitystringImage quality. standard (default) or hd.
response_formatstringurl (default) or b64_json.
Request
POST https://api.apexapi.dev/v1/images/generations
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "openai/gpt-image-2",
"prompt": "A serene mountain landscape at sunset",
"n": 1,
"size": "1024x1024",
"quality": "standard"
}Response
{
"created": 1710000000,
"data": [
{
"url": "https://uploads.apexapi.dev/generated/req-id-0.png"
}
]
}The url is always a hosted HTTPS link (never inline base64), whichever model serves the request. Links are temporary. Download the image promptly rather than hotlinking.
Video Generation
Generate video from a text prompt (and optionally a starting image) using supported video models like Veo, Kling, Seedance, Hailuo, and Grok Imagine. Video generation is asynchronous: you submit a job and get an id, then poll until it's done (renders take minutes).
/v1/videos/generationsParameters
modelstringrequiredVideo model ID (e.g., google/veo3.1/lite, bytedance/seedance-2.0/text-to-video). Full list via GET /v1/models (filter type=video).
promptstringrequiredText description of the video to generate.
durationintegerClip length in seconds. Allowed values are model-specific, e.g. Veo accepts 4, 6, or 8; Seedance accepts 4–15. An unsupported value returns 400 with the allowed set. Omit to use the model's default.
resolutionstring480p, 720p (default), 1080p, 2k, or 4k (model-dependent).
aspect_ratiostringe.g. 16:9, 9:16, 1:1.
image_urlstringStarting-frame image URL for image-to-video models.
Submit
POST https://api.apexapi.dev/v1/videos/generations
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "google/veo3.1/lite",
"prompt": "A calm ocean wave rolling onto a sandy beach at sunset",
"duration": 4,
"resolution": "720p",
"aspect_ratio": "16:9"
}{
"id": "a5933807-c44f-4eec-b25a-15f27a19b9ea",
"status": "queued"
}Poll for the result
GET https://api.apexapi.dev/v1/videos/generations/a5933807-...
Authorization: Bearer ak-your-api-key
# while rendering (poll every few seconds — takes minutes):
{ "id": "a5933807-...", "status": "processing" }
# when finished:
{ "id": "a5933807-...", "status": "completed", "url": "https://.../video.mp4" }
# on failure (the pre-auth hold is released — you are not charged):
{ "id": "a5933807-...", "status": "failed", "error": "..." }You're billed per second of generated video, matching the duration you requested. A job that fails releases its hold. You are not charged for a video you didn't get.
Audio (Text-to-Speech)
Generate natural voiceover from text using ElevenLabs models. Returns a URL to an MP3 file. Billed per 1,000 characters.
/v1/audio/speechParameters
modelstringrequiredAudio model ID (e.g., elevenlabs/tts/multilingual-v2).
inputstringrequiredThe text to synthesize into speech (1–10,000 characters).
voicestringOptional ElevenLabs voice name or id. Leave empty for the model default voice.
Request
POST https://api.apexapi.dev/v1/audio/speech
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "elevenlabs/tts/multilingual-v2",
"input": "Welcome to ApexAPI — one API for every AI model.",
"voice": "Rachel"
}Response
{
"created": 1710000000,
"data": [
{ "url": "https://.../output.mp3" }
]
}List Models
Retrieve a list of all available models and their pricing.
/v1/modelsResponse
{
"object": "list",
"data": [
{
"id": "openai/gpt-4o",
"object": "model",
"created": 1710000000,
"owned_by": "openai",
"pricing": {
"prompt": "0.0025",
"completion": "0.01"
}
}
]
}Context for AI (web data)
Give models live web knowledge on the same key and balance. Billed per unit; failures are free. Full guides: read a page, read a site, structured extract.
/v1/scrape(URL → markdown)curl https://api.apexapi.dev/v1/scrape \
-H "Authorization: Bearer ak-your-api-key" \
-H "Content-Type: application/json" \
-d '{ "url": "https://example.com/pricing", "stealth": "auto" }'
# → { "content": "# Pricing…", "tier": "standard", "cost": 0.002, … }/v1/crawl(site → markdown, async)curl https://api.apexapi.dev/v1/crawl \
-H "Authorization: Bearer ak-your-api-key" \
-H "Content-Type: application/json" \
-d '{ "url": "https://docs.example.com", "limit": 200 }'
# → { "id": "…", "status": "running" } then poll GET /v1/crawl/{id}/v1/extract(structured JSON, async)curl https://api.apexapi.dev/v1/extract \
-H "Authorization: Bearer ak-your-api-key" \
-H "Content-Type: application/json" \
-d '{ "scraper": "amazon-product",
"input": { "url": "https://www.amazon.com/dp/B09B8V1LZ3" } }'
# → { "id": "…", "status": "running" } then poll GET /v1/extract/{id}
# List scrapers: GET /v1/extract/scrapers