Allowed models
GET /v1/models/user lists the models on sale that your settings allow the key to call, with
their prices in DADAThe Algerian dinar, the one currency the docs show.More on Balance and charges →.
Request
Send it with an API keyAPI keyThe key you create and send with every request that calls a model.More on API keys →. The settings read are the guardrails assigned to that key: a model a guardrail leaves out is not listed, and where several are assigned, their model lists intersect. On a key with no guardrail, it lists what All models lists. The models guide shows how to pick a model and read its ID.
Yacine gives Souk Bot's key a guardrail that allows two models. This route, on that key, lists those two, and no other.
| Field | Needed | You send |
|---|---|---|
output_modalities | no | text when left out · a list such as image,audio · all |
output_modalities takes text, image, embeddings, audio, video, rerank, decisions,
speech and transcription. A model is listed when it answers in any of them.
import json
import os
import urllib.request
API_KEY = os.environ["OPENDUNES_API_KEY"]
ADDRESS = "https://opendunes.com/v1/models/user?output_modalities=all"
request = urllib.request.Request(
ADDRESS,
headers={"Authorization": "Bearer " + API_KEY},
)
with urllib.request.urlopen(request) as response:
models = json.load(response)["data"]
for model in models:
print(model["id"])Response
200 OK.
| Field | Holds |
|---|---|
data | every model the key may call, newest first; an empty list when its guardrails allow none on sale |
id | in each: its ID, lab/model: the name a request sends |
pricing | in each: its prices in DA, one per meter it has, each a string per unit of that meter, with discount beside them |
Each model carries every field All models describes, in the same shape.
What it cost
Free. Reading the catalogue is never charged.
Errors
error.code carries the status, and error.message says why.
| Status | When |
|---|---|
| 401 | the key is missing, wrong, disabled or expired |
| 403 | the key answers only from the addresses set on it, and this request came from another |
Last modified on