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.
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
}
}Image Generation
Generate images from text prompts using supported image models.
/v1/images/generationsParameters
modelstringrequiredImage model ID (e.g., openai/dall-e-3).
promptstringrequiredText description of the image to generate.
nintegerNumber of images to generate. Defaults to 1.
sizestringImage size. One of 256x256, 512x512, 1024x1024, 1024x1792, 1792x1024.
qualitystringImage quality. standard or hd.
Request
POST https://api.apexapi.dev/v1/images/generations
Authorization: Bearer ak-your-api-key
Content-Type: application/json
{
"model": "openai/dall-e-3",
"prompt": "A serene mountain landscape at sunset",
"n": 1,
"size": "1024x1024",
"quality": "standard"
}Response
{
"created": 1710000000,
"data": [
{
"url": "https://...",
"revised_prompt": "A serene mountain landscape..."
}
]
}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"
}
}
]
}