Quickstart

Get your API key and make your first request in under 2 minutes.

1. Get your API key

Sign in to the dashboard, navigate to API Keys, and create a new key. Your key will look like:

ak-1234567890abcdef1234567890abcdef12345678901234ab

Copy and save this key securely. It will only be shown once.

2. Make your first request

ApexApi is compatible with the OpenAI API format. Just change the base URL and use your ApexApi key.

curl

curl https://api.apexapi.dev/v1/chat/completions \
  -H "Authorization: Bearer ak-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "What is the capital of France?"
      }
    ]
  }'

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="ak-your-key-here",
    base_url="https://api.apexapi.dev/v1"
)

response = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[
        {"role": "user", "content": "What is the capital of France?"}
    ]
)

print(response.choices[0].message.content)

TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "ak-your-key-here",
  baseURL: "https://api.apexapi.dev/v1",
});

const response = await client.chat.completions.create({
  model: "anthropic/claude-3.5-sonnet",
  messages: [
    { role: "user", content: "What is the capital of France?" }
  ],
});

console.log(response.choices[0].message.content);

3. Check the response

The response follows the standard OpenAI chat completions format:

{
  "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": 14,
    "completion_tokens": 8,
    "total_tokens": 22
  }
}

Next steps