This guide has an independently written Vietnamese edition. Đọc bằng Tiếng Việt
List available models
GET /v1/models returns the routing aliases and concrete model names visible to the authenticated application. The list includes aliases even when the application currently has no eligible provider; a request can still fail if no configured model can serve it. Model visibility depends on the application’s model pool, active model/provider records, configured provider credentials, and enabled providers.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["TASKWAY_API_KEY"],
base_url=os.environ["TASKWAY_BASE_URL"],
)
for model in client.models.list().data:
print(model.id)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.TASKWAY_API_KEY,
baseURL: process.env.TASKWAY_BASE_URL,
});
const models = await client.models.list();
for (const model of models.data) {
console.log(model.id);
}
Choose a routing alias
For Chat Completions and Responses, the required model field can select the gateway’s routing behavior:
| Value | Behavior |
|---|---|
auto | Use the objective configured for the application. |
auto:cheap | Prefer lower-cost eligible tiers. |
auto:quality | Prefer higher-quality eligible tiers. |
auto:fast | Prefer faster tiers and do not decompose the task. |
auto:code | Route through the system’s coding task template. An application-specific three-tier pool remains in effect. |
An alias is not a promise about a particular provider or model name. The request is constrained to providers/models configured for that application.
Pin a model
To request one concrete model, set model to its exact name from GET /v1/models. The gateway constrains this request to that model. If the name is not available in the application’s catalog, the request returns 404 model_not_found; the gateway does not silently pick a different model.
Embeddings use a concrete model
POST /v1/embeddings requires a concrete embedding model. auto routing aliases describe text generation and do not select an embedding model. Use a supported embedding name that your application can access. The implementation profile recognizes text-embedding-3-small and text-embedding-3-large, subject to application visibility, provider configuration, and enabled-provider settings.