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: "model": "@preset/souk-bot", on /v1/chat/completions, /v1/messages or /v1/responses. With openai-go, pass the name wherever the model goes. The preset fills in what the request leaves out; a value the request sets itself wins. 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.
body, _ := json.Marshal(map[string]any{
"model": "anthropic/claude-sonnet-5",
"messages": []map[string]string{
{"role": "system", "content": "You answer Souk customers in French and Darja."},
},
"temperature": 0.3,
"provider": map[string]string{"sort": "price"},
})
req, _ := http.NewRequest("POST",
"https://opendunes.com/v1/presets/souk-bot/chat/completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPENDUNES_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
// resp body: { "data": { "slug": "souk-bot", "designated_version": { "version": 1, "config": { … }, "system_prompt": "…" } } }Saving again under the same slug adds a version and makes it current. The 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 |