Skip to content

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:

FieldTypeDescription
successbooleanWhether the request succeeded
dataarrayThe array of models (returned only on success)
messagestringError message (returned only on failure)

Model object fields:

FieldTypeDescription
idstringUnique model identifier
objectstringObject type, always model
createdintegerModel creation timestamp
owned_bystringThe provider that owns the model
supported_endpoint_typesarrayThe API endpoint types the model supports

Supported endpoint types

TypeDescription
chatChat completions
completionText completions
embeddingText embeddings
imageImage generation
audioAudio processing
rerankReranking

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

StatusMeaning
401 UnauthorizedThe API token is invalid or expired
403 ForbiddenThe user does not have access
500 Internal Server ErrorInternal server error