Quick Start
Get started with xmAI in 3 simple steps. Send your first API request in under 5 minutes.
Step 1: Create an Account
Sign up at XmAI Console to create your account. You'll receive free credits to get started.
Step 2: Get Your API Key
- Log in to the Dashboard
- Navigate to API Keys
- Click Create New Key
- Copy and save your key securely — it won't be shown again
Step 3: Send Your First Request
xmAI is fully compatible with the OpenAI API. Just change the base_url to https://api.xmai.sg/v1.
python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-xmai-key",
base_url="https://api.xmai.sg/v1",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)javascript
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: 'sk-your-xmai-key',
baseURL: 'https://api.xmai.sg/v1',
})
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello!' }],
})
console.log(response.choices[0].message.content)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
body := map[string]interface{}{
"model": "gpt-4o",
"messages": []map[string]string{
{"role": "user", "content": "Hello!"},
},
}
jsonBody, _ := json.Marshal(body)
req, _ := http.NewRequest("POST",
"https://api.xmai.sg/v1/chat/completions",
bytes.NewBuffer(jsonBody))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer sk-your-xmai-key")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
fmt.Println(string(data))
}bash
curl https://api.xmai.sg/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-xmai-key" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'Migrating from OpenAI?
If you're already using the OpenAI SDK, just change the base_url / baseURL to https://api.xmai.sg/v1. No other code changes needed!
What's Next?
- Integrations — pick a CLI/SDK guide (Claude Code, OpenCode, Codex CLI, Cursor, Cline, and more)
- Chat Completions API — Full API reference with streaming support
- Messages API — Anthropic-compatible endpoint for Claude models
- Models — List of available models
- Error Codes — Error handling guide
- FAQ — Frequently asked questions