Models
Listing available models and reading the details of one.
List models#
text
GET /openai/v1/modelsbash
curl https://api.portmodels.com/openai/v1/models \
-H "Authorization: Bearer $PORTMODELS_API_KEY"json
{
"object": "list",
"data": [
{
"id": "model-owner/example-model",
"object": "model",
"created": 1700000000,
"owned_by": "model-owner",
"root": "model-owner/example-model",
"parent": null
}
]
}The id is the model key — the exact string to send as model in a
chat completion. owned_by identifies the
model's owner.
Get one model#
text
GET /openai/v1/models/{model_key}bash
curl https://api.portmodels.com/openai/v1/models/model-owner/example-model \
-H "Authorization: Bearer $PORTMODELS_API_KEY"Model keys often contain a slash. The path accepts it directly, so no encoding is needed here.
Choosing a model#
- Don't hard-code a single model forever. The catalogue changes; read the list at startup and fall back gracefully.
- Match the model to the job. Most app work does not need the largest model available, and the price difference is large. See Pricing and markup.
- Test cost, not just quality. Run the same realistic prompt through two
candidates and compare
usage.cost.
Allowed models for published apps#
A published app has an allowed_models list. When your app runs models with a
Connect token, that list applies — a model
outside it is rejected even if it appears in /v1/models. Keep the list current
as you change which models your app uses.