Models
GET /v1/models
Lists the available models. This endpoint is compatible with the OpenAI Models API.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer sk-your-xmai-keyResponse
json
{
"object": "list",
"data": [
{
"id": "gpt-4o",
"object": "model",
"created": 1710000000,
"owned_by": "openai"
},
{
"id": "claude-sonnet-4-20250514",
"object": "model",
"created": 1710000000,
"owned_by": "anthropic"
},
{
"id": "gemini-2.5-pro",
"object": "model",
"created": 1710000000,
"owned_by": "google"
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
object | string | Always "list" |
data | array | Array of model objects |
data[].id | string | The model identifier, used in API requests |
data[].object | string | Always "model" |
data[].created | number | Unix timestamp of when the model was added |
data[].owned_by | string | The model provider (e.g. openai, anthropic, google) |
Code Examples
python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-xmai-key",
base_url="https://api.xmai.sg/v1",
)
models = client.models.list()
for model in models.data:
print(f"{model.id} ({model.owned_by})")javascript
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: 'sk-your-xmai-key',
baseURL: 'https://api.xmai.sg/v1',
})
const models = await client.models.list()
for (const model of models.data) {
console.log(`${model.id} (${model.owned_by})`)
}go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.xmai.sg/v1/models", nil)
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/models \
-H "Authorization: Bearer sk-your-xmai-key"Available Models
Visit the Models page for the full list of available models with real-time pricing. Use the model's id field from the API response (or from the Models page) as the model parameter in your requests.