Hosted platformREST API reference
OpenAI-compatible
OpenAI-compatible chat completions and model listing.
API version 1.0.0openapi.json
OpenAI-compatible chat completions and model listing. Point an OpenAI SDK at the platform base URL and use `model: "auto"`; the router chooses the model per request.
post/v1/chat/completions
Chat
Requires an API key.
Parameters
| Name | In | Type | Default | Description |
|---|---|---|---|---|
| x-osr-tenant | header | string | null |
Request bodyChatCompletionIn
| Field | Type | Default | Description |
|---|---|---|---|
| max_tokens | integer | null | ||
| messages(required) | ChatMessage[] | ||
| metadata | object | ||
| model | string | "auto" | |
| models | string[] | ||
| osr | RoutingOptions | Platform extension carried in the chat body under `osr` (ignored by other providers). | |
| constraints | object | ||
| fallbacks | boolean | true | |
| objective | object<number> | ||
| plan | boolean | null | ||
| tenant | string | null | ||
| stream | boolean | false | |
| temperature | number | null | ||
| user | string | null |
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s -X POST "$OSR_URL/v1/chat/completions" \
-H "Authorization: Bearer $OSR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "messages": [ { "role": "user", "content": "Write a haiku about routing." } ], "model": "auto" }'Bodyjson
{
"messages": [
{
"role": "user",
"content": "Write a haiku about routing."
}
],
"model": "auto"
}get/v1/models
Models
Requires an API key.
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s "$OSR_URL/v1/models" \
-H "Authorization: Bearer $OSR_API_KEY"