Gateway Overview

The Creor Gateway is an OpenAI-compatible API endpoint that gives you access to models from Anthropic, OpenAI, Google, and other providers through a single API key and a unified billing system.

What Is the Gateway

Instead of managing separate API keys and SDKs for each model provider, the Creor Gateway provides a single /v1/chat/completions endpoint that is fully compatible with the OpenAI SDK. Point any OpenAI-compatible client at https://api.creor.ai/v1 and use your Creor API key to access all supported models.

Key Benefits

  • Single API key for all providers -- no need to manage keys for Anthropic, OpenAI, Google, and others separately.
  • OpenAI SDK compatible -- swap the base URL and API key; your existing code works without changes.
  • Unified billing -- all usage across all models appears on a single invoice.
  • Automatic model routing -- the gateway routes your request to the correct provider based on the model ID.
  • Built-in rate limiting and retry logic on the server side for provider-level errors.

Quick Start

Make your first request in under a minute. You need a Creor API key from the dashboard (Settings > API Keys).

curl

curl https://api.creor.ai/v1/chat/completions \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "messages": [
      {"role": "user", "content": "What is the Creor Gateway?"}
    ]
  }'

OpenAI SDK (JavaScript)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import OpenAI from "openai";
 
const client = new OpenAI({
apiKey: process.env.CREOR_API_KEY,
baseURL: "https://api.creor.ai/v1",
});
 
const completion = await client.chat.completions.create({
model: "claude-sonnet-4-20250514",
messages: [
{ role: "user", content: "What is the Creor Gateway?" },
],
});
 
console.log(completion.choices[0].message.content);

OpenAI SDK (Python)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import openai
import os
 
client = openai.OpenAI(
api_key=os.environ["CREOR_API_KEY"],
base_url="https://api.creor.ai/v1",
)
 
completion = client.chat.completions.create(
model="claude-sonnet-4-20250514",
messages=[
{"role": "user", "content": "What is the Creor Gateway?"}
],
)
 
print(completion.choices[0].message.content)

Tip

You can use any model available in the Creor Gateway by changing the model parameter. Run "GET /v1/models" to see the full list.

Request Format

The Gateway accepts the same request format as the OpenAI Chat Completions API. All standard parameters are supported.

POST https://api.creor.ai/v1/chat/completions
Content-Type: application/json
Authorization: Basic base64(YOUR_API_KEY:)

{
  "model": "claude-sonnet-4-20250514",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Explain TCP/IP in simple terms."}
  ],
  "temperature": 0.7,
  "max_tokens": 1024,
  "stream": false
}

Supported Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g., claude-sonnet-4-20250514, gpt-4o, gemini-2.5-pro).
messagesarrayYesArray of message objects with role and content fields.
temperaturenumberNoSampling temperature (0-2). Default varies by model.
max_tokensintegerNoMaximum tokens in the response. Default varies by model.
streambooleanNoEnable SSE streaming. Default: false.
top_pnumberNoNucleus sampling parameter (0-1).
stopstring | arrayNoStop sequence(s) to end generation.
nintegerNoNumber of completions to generate. Default: 1.

Message Roles

RoleDescription
systemSets the behavior and context for the assistant. Sent once at the start.
userThe user's input message.
assistantA previous response from the assistant (for multi-turn conversations).

Note

Not all parameters are supported by every model. For example, the n parameter is not available for Claude models. The gateway silently ignores unsupported parameters rather than returning an error.

Response Format

Non-streaming responses follow the OpenAI Chat Completions response format. The gateway normalizes responses from all providers into this consistent shape.

{
  "id": "chatcmpl-9f8g7h6j5k4l3m2n1",
  "object": "chat.completion",
  "created": 1712937600,
  "model": "claude-sonnet-4-20250514",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "TCP/IP is a set of rules that computers use..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 156,
    "total_tokens": 198
  }
}

Response Fields

FieldTypeDescription
idstringUnique identifier for the completion.
objectstringAlways "chat.completion" for non-streaming responses.
createdintegerUnix timestamp when the response was generated.
modelstringThe model that generated the response.
choicesarrayArray of completion choices (usually one).
choices[].messageobjectThe assistant's response message with role and content.
choices[].finish_reasonstringWhy generation stopped: "stop", "length", or "content_filter".
usageobjectToken counts for billing and context tracking.

Streaming

Set "stream": true to receive Server-Sent Events (SSE) as tokens are generated. This is the recommended approach for interactive applications where you want to display text as it arrives.

curl https://api.creor.ai/v1/chat/completions \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "stream": true,
    "messages": [
      {"role": "user", "content": "Write a short poem about code"}
    ]
  }'

See the dedicated Streaming page for the full event format, error handling, and complete SDK examples.

Usage & Billing

All requests through the Gateway are billed based on token usage. Each model has its own per-token pricing, which you can view on the Models page or in the dashboard.

How Billing Works

  • Input tokens (your messages) and output tokens (the response) are billed separately.
  • Pricing is per million tokens and varies by model.
  • Usage is tracked in real time and visible in the dashboard under Usage & Analytics.
  • Free plan users have a monthly credit allowance. Starter and Pro plans have higher or unlimited credits.
  • If you exceed your credit balance, requests return a 402 Payment Required error until you add credits or upgrade.

Checking Your Usage

curl https://api.creor.ai/v1/usage \
  -u YOUR_API_KEY:
{
  "period_start": "2026-04-01T00:00:00Z",
  "period_end": "2026-04-30T23:59:59Z",
  "total_tokens": 1284560,
  "total_cost_usd": 3.42,
  "credit_remaining_usd": 16.58,
  "breakdown_by_model": [
    { "model": "claude-sonnet-4-20250514", "tokens": 820000, "cost_usd": 2.46 },
    { "model": "gpt-4o", "tokens": 464560, "cost_usd": 0.96 }
  ]
}

Note

The usage object in each completion response includes token counts. Use these for real-time cost tracking in your application without making additional API calls.

Next Steps