Save a request's settings under a name, and use them by naming the preset as the model.
A preset is a request's settings saved under a name: the model or its fallbacks, the provider routing, the system prompt, the parameters, the helpers and the response cache. Every version is kept. The preset routes are free and take an API key.
Name it as the model — the openai SDK needs nothing else:
import os
from openai import OpenAI
client = OpenAI(base_url="https://opendunes.com/v1", api_key=os.environ["OPENDUNES_API_KEY"])
resp = client.chat.completions.create(
model="@preset/souk-bot",
messages=[{"role": "user", "content": "Wach kayen iPhone 16?"}],
)The preset fills in what the request leaves out; a value the request sets itself wins. It works the same on client.responses.create(...). An unknown preset answers 404 before any model runs.
Send the body you would send to the route, to the preset route of the same shape. Only the settings are kept; the conversation, stream and user are ignored.
import httpx
headers = {"Authorization": f"Bearer {os.environ['OPENDUNES_API_KEY']}"}
resp = httpx.post(
"https://opendunes.com/v1/presets/souk-bot/chat/completions",
headers=headers,
json={
"model": "anthropic/claude-sonnet-5",
"messages": [{"role": "system", "content": "You answer Souk customers in French and Darja."}],
"temperature": 0.3,
"provider": {"sort": "price"},
},
)
preset = resp.json()["data"]
print(preset["designated_version"]["version"]) # 1 the first time; saving again adds a versionThe same save works from a Messages body at /v1/presets/{slug}/messages and from a Responses body at /v1/presets/{slug}/responses.
httpx.get("https://opendunes.com/v1/presets", headers=headers) # every preset
httpx.get("https://opendunes.com/v1/presets/souk-bot", headers=headers) # one, with its current version
httpx.get("https://opendunes.com/v1/presets/souk-bot/versions", headers=headers) # its versions
httpx.get("https://opendunes.com/v1/presets/souk-bot/versions/1", headers=headers) # one version