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-key

API 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.

POST/v1/chat/completions

Parameters

modelstringrequired

Model ID in provider/model format (e.g., openai/gpt-4o).

messagesarrayrequired

Array of message objects with role and content fields.

temperaturenumber

Sampling temperature between 0 and 2. Defaults to 1.

max_tokensinteger

Maximum number of tokens to generate.

streamboolean

If true, responses are streamed via Server-Sent Events. Defaults to false.

top_pnumber

Nucleus sampling parameter. Defaults to 1.

stopstring | array

Stop sequences. Up to 4 sequences.

Request

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

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.

POST/v1/images/generations

Parameters

modelstringrequired

Image model ID (e.g., openai/dall-e-3).

promptstringrequired

Text description of the image to generate.

ninteger

Number of images to generate. Defaults to 1.

sizestring

Image size. One of 256x256, 512x512, 1024x1024, 1024x1792, 1792x1024.

qualitystring

Image quality. standard or hd.

Request

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

Response
{
  "created": 1710000000,
  "data": [
    {
      "url": "https://...",
      "revised_prompt": "A serene mountain landscape..."
    }
  ]
}

List Models

Retrieve a list of all available models and their pricing.

GET/v1/models

Response

Response
{
  "object": "list",
  "data": [
    {
      "id": "openai/gpt-4o",
      "object": "model",
      "created": 1710000000,
      "owned_by": "openai",
      "pricing": {
        "prompt": "0.0025",
        "completion": "0.01"
      }
    }
  ]
}