Products Pricing Docs Infrastructure Security About
EN 中文 日本語 한국어 العربية

Sign In Get Started

API Documentation

Everything you need to integrate AiPorter into your application. OpenAI-compatible, 70% cheaper.

Quickstart

Getting started with AiPorter takes less than 5 minutes. The API is fully compatible with the OpenAI SDK — just change the base URL.

1. Get your API Key

Create a free account to get your API key.

2. Install the OpenAI SDK

pip install openai          # Python
npm install openai          # Node.js
go get github.com/sashabaranov/go-openai  # Go

3. Make your first API call

from openai import OpenAI

client = OpenAI(
    api_key="aiporter-sk-xxxxx",
    base_url="https://sg1.api.aiporter.io/v1"
)

response = client.chat.completions.create(
    model="aiporter-pro",
    messages=[
        {"role": "user", "content": "Hello, AiPorter!"}
    ]
)

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

Authentication

All API requests require authentication using an API key. Include your key in the Authorization header.

Authorization: Bearer aiporter-sk-xxxxx

API keys can be created and managed from your Dashboard. Keep your keys secure and never share them publicly.

Regional Endpoints

Choose the endpoint closest to your users for optimal latency:

RegionEndpointAvg Latency
Singapore 🇸🇬https://sg1.api.aiporter.io/v1~45ms
Dubai 🇦🇪https://ae1.api.aiporter.io/v1~62ms
Tokyo 🇯🇵https://jp1.api.aiporter.io/v1~38ms
Frankfurt 🇩🇪https://eu1.api.aiporter.io/v1~55ms
Virginia 🇺🇸https://us1.api.aiporter.io/v1~72ms

Chat Completions

Create a chat completion. Compatible with OpenAI's /v1/chat/completions endpoint.

Endpoint

POST /v1/chat/completions

Request Body

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g., aiporter-pro, deepseek-v3). See available models below.
messagesarrayYesArray of message objects with role and content
temperaturenumberNoSampling temperature (0-2). Default: 0.7
max_tokensintegerNoMaximum tokens in response
streambooleanNoEnable streaming. Default: false

Example Request

curl https://sg1.api.aiporter.io/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer aiporter-sk-xxxxx" \
  -d '{
    "model": "aiporter-pro",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain machine learning in simple terms."}
    ],
    "temperature": 0.7,
    "max_tokens": 500
  }'

Available Models

Model IDProviderTypeContextPrice
aiporter-proAuto RouteChat128K$0.50/M tokens
deepseek-v3DeepSeekChat128K$0.50/M tokens
qwen-2.5-72bQwenChat128K$0.35/M tokens
glm-4vGLMVision128K$0.80/M tokens
aiporter-fastAuto RouteChat (Optimized)32K$0.25/M tokens

Rate Limits

PlanRequests/minTokens/min
Starter60100,000
Pro6001,000,000
EnterpriseCustomCustom

Rate limits are applied per API key. Enterprise customers can request custom limits.