API Documentation

AIPower provides an OpenAI-compatible API. If you're using the OpenAI SDK, just change the base URL.

Quick Start

1. Get your API key from the dashboard.

2. Use any OpenAI-compatible SDK with our base URL:

Base URL
https://api.aipower.me/v1

Authentication

Use Bearer token authentication with your API key:

Header
Authorization: Bearer YOUR_API_KEY

Chat Completions

POST /v1/chat/completions

Creates a model response for the given chat conversation. Supports streaming.

curl

curl
curl https://api.aipower.me/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-chat",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is the capital of France?"}
    ],
    "temperature": 0.7,
    "max_tokens": 1000,
    "stream": false
  }'

Python (OpenAI SDK)

Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aipower.me/v1",
    api_key="YOUR_API_KEY",
)

# Non-streaming
response = client.chat.completions.create(
    model="deepseek/deepseek-chat",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="deepseek/deepseek-chat",
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Node.js (OpenAI SDK)

JavaScript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.aipower.me/v1',
  apiKey: 'YOUR_API_KEY',
});

const response = await client.chat.completions.create({
  model: 'deepseek/deepseek-chat',
  messages: [{ role: 'user', content: 'Hello!' }],
});

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

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g., deepseek/deepseek-chat)
messagesarrayYesArray of message objects with role and content
temperaturenumberNoSampling temperature (0-2). Default: 1
max_tokensintegerNoMaximum tokens to generate
streambooleanNoStream response via SSE. Default: false
top_pnumberNoNucleus sampling. Default: 1
stopstring|arrayNoStop sequences

List Models

GET /v1/models

Returns all available models with pricing info.

curl
curl https://api.aipower.me/v1/models

Available Models

Model IDInput $/MOutput $/MContext
deepseek/deepseek-chat$0.50$0.8064K
deepseek/deepseek-reasoner$0.50$0.8064K
qwen/qwen-turbo$0.12$0.50128K
qwen/qwen-plus$0.20$2.80128K
minimax/minimax-text-01$0.50$2.001M

Error Codes

ParameterTypeRequiredDescription
401NoInvalid or missing API key
402NoInsufficient credits. Top up at /dashboard/billing
404NoModel not found
429NoRate limit exceeded
502NoUpstream provider error

Billing

AIPower uses a prepaid credits system. Add credits via Stripe, and usage is deducted per API call based on token count.

Free tier: 1M tokens included on signup.

Check your balance and add credits at /dashboard/billing.