Hosted platformREST API reference
Routing
Route a request to a target and return the decision with its trace; optionally build a plan or execute it.
API version 1.0.0openapi.json
Route a request to a target and return the decision with its trace; optionally build a plan or execute it. Report outcomes for the learners and read statistics and the audit trail.
get/api/v1/audit
Audit
Requires an API key.
Parameters
| Name | In | Type | Default | Description |
|---|---|---|---|---|
| limit | query | integer | 100 |
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s "$OSR_URL/api/v1/audit?limit=100" \
-H "Authorization: Bearer $OSR_API_KEY"post/api/v1/feedback
Feedback
Requires an API key.
Request bodyFeedbackIn
| Field | Type | Default | Description |
|---|---|---|---|
| complexity | number | null | ||
| cost_usd | number | null | ||
| domains | string[] | ||
| latency_ms | number | null | ||
| preferred_over | string | null | ||
| quality | number | null | ||
| request_id(required) | string | ||
| success(required) | boolean | ||
| target_id(required) | string |
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s -X POST "$OSR_URL/api/v1/feedback" \
-H "Authorization: Bearer $OSR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "request_id": "7f3c0e2a9b1d4f6e8a0c2b4d6e8f0a1b", "success": true, "quality": 0.9 }'Bodyjson
{
"request_id": "7f3c0e2a9b1d4f6e8a0c2b4d6e8f0a1b",
"success": true,
"quality": 0.9
}post/api/v1/route
Route
Requires an API key.
Parameters
| Name | In | Type | Default | Description |
|---|---|---|---|---|
| x-osr-tenant | header | string | null |
Request bodyRouteIn
| Field | Type | Default | Description |
|---|---|---|---|
| constraints | object | ||
| context | object | ||
| execute | boolean | false | |
| history | object<string>[] | ||
| kinds | string[] | null | ||
| objective | object<number> | ||
| plan | boolean | false | |
| profile | object | ||
| text(required) | string | ||
| top_k | integer | 3 |
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s -X POST "$OSR_URL/api/v1/route" \
-H "Authorization: Bearer $OSR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "text": "Prove that sqrt(2) is irrational.", "objective": { "quality": 1, "cost": 0.3 }, "top_k": 3 }'Bodyjson
{
"text": "Prove that sqrt(2) is irrational.",
"objective": {
"quality": 1,
"cost": 0.3
},
"top_k": 3
}get/api/v1/stats
Stats
Requires an API key.
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s "$OSR_URL/api/v1/stats" \
-H "Authorization: Bearer $OSR_API_KEY"get/api/v1/targets
Targets
Requires an API key.
Responses
| 200 | Successful Response |
| 422 | Validation ErrorHTTPValidationError |
| 401 | Missing, invalid or revoked API key |
Requestbash
curl -s "$OSR_URL/api/v1/targets" \
-H "Authorization: Bearer $OSR_API_KEY"