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 OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://opendunes.com/v1",
apiKey: process.env.OPENDUNES_API_KEY,
});
const resp = await 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.
const headers = {
Authorization: `Bearer ${process.env.OPENDUNES_API_KEY}`,
"Content-Type": "application/json",
};
const res = await fetch("https://opendunes.com/v1/presets/souk-bot/chat/completions", {
method: "POST",
headers,
body: JSON.stringify({
model: "anthropic/claude-sonnet-5",
messages: [{ role: "system", content: "You answer Souk customers in French and Darja." }],
temperature: 0.3,
provider: { sort: "price" },
}),
});
const { data: preset } = await res.json();
console.log(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.
| Path | Answers |
|---|---|
GET /v1/presets | every preset |
GET /v1/presets/{slug} | one, with its current version |
GET /v1/presets/{slug}/versions | its versions |
GET /v1/presets/{slug}/versions/{version} | one version |