List Models
Retrieve every AI model the current user can access, including each model's ID, owner, and details.
Model list and token groups
Which models the list returns depends on the token group of the API token you use. You can choose a token group when creating a token on the Console → API Tokens page.
List available models
GET https://ciyuanx.io/v1/models
bash
curl https://ciyuanx.io/v1/models \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://ciyuanx.io/v1",
)
models = client.models.list()
for model in models.data:
print(model.id)typescript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://ciyuanx.io/v1",
});
const models = await client.models.list();
for (const model of models.data) {
console.log(model.id);
}Response
Successful response (200 OK):
json
{
"success": true,
"data": [
{
"id": "gpt-4",
"object": "model",
"created": 1626777600,
"owned_by": "openai",
"supported_endpoint_types": ["chat", "completion"]
},
{
"id": "claude-3-sonnet-20240229",
"object": "model",
"created": 1626777600,
"owned_by": "anthropic",
"supported_endpoint_types": ["chat"]
}
]
}Response fields
Top-level fields:
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the request succeeded |
data | array | The array of models (returned only on success) |
message | string | Error message (returned only on failure) |
Model object fields:
| Field | Type | Description |
|---|---|---|
id | string | Unique model identifier |
object | string | Object type, always model |
created | integer | Model creation timestamp |
owned_by | string | The provider that owns the model |
supported_endpoint_types | array | The API endpoint types the model supports |
Supported endpoint types
| Type | Description |
|---|---|
chat | Chat completions |
completion | Text completions |
embedding | Text embeddings |
image | Image generation |
audio | Audio processing |
rerank | Reranking |
Notes
Authentication
A valid API token is required. The token determines which models the user can access.
Access control
The returned list is filtered by user group and token group, so it only includes models the user is allowed to access.
Common errors
| Status | Meaning |
|---|---|
401 Unauthorized | The API token is invalid or expired |
403 Forbidden | The user does not have access |
500 Internal Server Error | Internal server error |