🚀 Quick Start
Get your API key and start building in 30 seconds
Our API is fully compatible with OpenAI's format, making migration seamless.
1. Get Your API Key
curl -X POST "${window.location.origin}/api/auth?action=register" \\
-H "Content-Type: application/json" \\
-d '{
"email": "your@email.com",
"password": "your_secure_password",
"name": "Your Name",
"plan": "free"
}'
2. Make Your First Request
curl -X POST "${window.location.origin}/api/chat" \\
-H "Content-Type: application/json" \\
-H "X-API-Key: your-api-key" \\
-d '{
"model": "glm-4.6",
"messages": [
{"role": "user", "content": "Hello, AI!"}
],
"max_tokens": 150
}'
3. Use with OpenAI SDK
# Python
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="${window.location.origin}/api"
)
response = client.chat.completions.create(
model="glm-4.6",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
🔐 Authentication
All API requests require authentication using an API key. Include your API key in the request headers:
X-API-Key: your-api-key-here
Creating an Account
POST /api/auth?action=register
| Parameter |
Type |
Required |
Description |
email |
string |
Required |
Your email address |
password |
string |
Required |
Password (min 8 characters) |
name |
string |
Required |
Your full name |
plan |
string |
Optional |
Plan type: free, pro, enterprise (default: free) |
Response:
{
"user": {
"id": "user_123",
"email": "your@email.com",
"plan": "free",
"usage": {
"requests_this_month": 0,
"tokens_this_month": 0
},
"limits": {
"requests_per_minute": 20,
"requests_per_month": 1000,
"tokens_per_month": 50000
}
},
"api_key": "ak-1234567890abcdef",
"message": "Account created successfully"
}
💬 Chat Completions
Create a chat completion with our advanced AI models. Fully compatible with OpenAI's chat completions API.
POST /api/chat
Request Parameters
| Parameter |
Type |
Required |
Description |
model |
string |
Required |
Model ID: "glm-4.6" or "deepseek-r1" |
messages |
array |
Required |
Array of message objects |
max_tokens |
integer |
Optional |
Maximum tokens to generate (default: 2000) |
temperature |
number |
Optional |
Sampling temperature 0-2 (default: 0.7) |
top_p |
number |
Optional |
Nucleus sampling parameter (default: 0.9) |
Example Request
{
"model": "glm-4.6",
"messages": [
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Explain quantum computing in simple terms."
}
],
"max_tokens": 500,
"temperature": 0.7
}
Response Format
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1699564800,
"model": "glm-4.6",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing uses quantum mechanics..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 150,
"total_tokens": 170
},
"metadata": {
"request_id": "req_123",
"response_time_ms": 1200
}
}
🤖 Available Models
GET /api/models
GLM-4.6
- Model ID:
glm-4.6
- Max Tokens: 8,192
- Strengths: General conversation, coding, creative writing
- Pricing: $0.001/1K input tokens, $0.002/1K output tokens
DeepSeek-R1
- Model ID:
deepseek-r1
- Max Tokens: 4,096
- Strengths: Reasoning, mathematics, step-by-step problem solving
- Pricing: $0.0005/1K input tokens, $0.0015/1K output tokens, $0.001/1K reasoning tokens
📊 Monitoring & Analytics
Usage Statistics
GET /api/dashboard?endpoint=usage
Health Check
GET /api/dashboard?endpoint=health
Billing Information
GET /api/dashboard?endpoint=billing
💰 Pricing
| Plan |
Requests/Month |
Tokens/Month |
Rate Limit |
Price |
| Free |
1,000 |
50,000 |
20/min |
$0 |
| Pro |
10,000 |
500,000 |
100/min |
$29/month |
| Enterprise |
100,000 |
5,000,000 |
500/min |
Custom |
📦 SDKs & Libraries
Official SDKs
Use any OpenAI-compatible SDK by changing the base URL:
# Python
pip install openai
export OPENAI_API_KEY="your-api-key"
export OPENAI_BASE_URL="${window.location.origin}/api"
# Node.js
npm install openai
const openai = new OpenAI({
apiKey: "your-api-key",
baseURL: "${window.location.origin}/api"
});
# cURL
curl -X POST "${window.location.origin}/api/chat" \\
-H "X-API-Key: your-api-key" \\
-H "Content-Type: application/json" \\
-d '{"model": "glm-4.6", "messages": [...]}'