Skip to content
OpenSmartRoute

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.0

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

NameInTypeDefaultDescription
limitqueryinteger100

Responses

200Successful Response
422Validation ErrorHTTPValidationError
401Missing, 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

FieldTypeDefaultDescription
complexitynumber | null
cost_usdnumber | null
domainsstring[]
latency_msnumber | null
preferred_overstring | null
qualitynumber | null
request_id(required)string
success(required)boolean
target_id(required)string

Responses

200Successful Response
422Validation ErrorHTTPValidationError
401Missing, 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

NameInTypeDefaultDescription
x-osr-tenantheaderstring | null

Request bodyRouteIn

FieldTypeDefaultDescription
constraintsobject
contextobject
executebooleanfalse
historyobject<string>[]
kindsstring[] | null
objectiveobject<number>
planbooleanfalse
profileobject
text(required)string
top_kinteger3

Responses

200Successful Response
422Validation ErrorHTTPValidationError
401Missing, 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

200Successful Response
422Validation ErrorHTTPValidationError
401Missing, 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

200Successful Response
422Validation ErrorHTTPValidationError
401Missing, invalid or revoked API key
Requestbash
curl -s "$OSR_URL/api/v1/targets" \
  -H "Authorization: Bearer $OSR_API_KEY"