Quick Start
Connect to Aize API in 2 minutes
Quick Start
Aize accepts OpenAI-compatible chat completions. Point your SDK to https://api.aize.dev/v1 and use an exact model name from the current model list. Global and IR accounts use this same base URL.
Before making a request, sign in and create an API key. Key creation currently requires at least $5 of wallet balance. The examples below use GLM 5.3 Flash, which is in the gateway catalog and the default API model set.
Authentication
All API requests require authentication using your API key.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonUsing the OpenAI SDK
The easiest way to integrate is using the official OpenAI SDKs.
Python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.aize.dev/v1"
)
response = client.chat.completions.create(
model="GLM 5.3 Flash",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! Can you help me?"}
]
)
print(response.choices[0].message.content)TypeScript / JavaScript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://api.aize.dev/v1',
});
async function main() {
const response = await client.chat.completions.create({
model: 'GLM 5.3 Flash',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello! Can you help me?' }
]
});
console.log(response.choices[0].message.content);
}
main();Using the API Directly
You can use raw HTTP requests to interact with the API.
curl https://api.aize.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "GLM 5.3 Flash",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello! Can you help me?"
}
]
}'Streaming Responses
We support server-side events (SSE) for real-time streaming.
Python Streaming
stream = client.chat.completions.create(
model="GLM 5.3 Flash",
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="")cURL Streaming
curl -N https://api.aize.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "GLM 5.3 Flash",
"stream": true,
"messages": [{"role":"user","content":"Stream a 2-line poem"}]
}'Advanced Usage
JSON Mode
Force the model to output valid JSON.
const completion = await client.chat.completions.create({
model: "GLM 5.3 Flash",
response_format: { type: "json_object" },
messages: [{ role: "user", content: "Give a todo list as JSON" }],
});Function Calling (Tools)
Connect external tools and functions.
response = client.chat.completions.create(
model="GLM 5.3 Flash",
messages=[{"role": "user", "content": "What's the weather in SF?"}],
tools=[{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}}
}
}
}]
)
tool_calls = response.choices[0].message.tool_callsVision
Analyze images using compatible models.
curl https://api.aize.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "GLM 5.3 Flash",
"messages": [{
"role": "user",
"content": [
{"type":"text","text":"What is in this image?"},
{"type":"image_url","image_url":{"url":"https://example.com/cat.jpg"}}
]
}]
}'