Docs/API
The decision API
Send a state and named questions. Use the returned choice and probabilities in your application.
Make a request
Keep your key on your server. Send JSON over HTTPS with a bearer authorization header.
curl https://api.decoice.com/v1/decisions \
-H "Authorization: Bearer $DECOICE_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "decoice-1.0.0",
"state": {
"message": "I was charged twice."
},
"questions": {
"route": {
"type": "choice",
"instructions": "Choose the team that should handle the message.",
"criteria": {
"billing": "Payments and invoices",
"support": "Product issues"
}
}
}
}'Use choice for named alternatives, noul for a true/false judgment and score for an ordered rubric. Responses include answers keyed by question name, plus usage.input_tokens and usage.output_tokens.
Test your key
Paste a key to check that it works and see what remains of its allowance. Then send an example or your own request to the production model and see the answers as the API returns them.
Your key goes over HTTPS to this site’s server, which passes it to the API for this one request. It is not stored or logged, and it is cleared when you leave the page. Requests use your key’s tokens.
Check key shows the key’s allowance and what remains.
Send request runs the request above on the production model and draws the answers here.
Keys, usage and limits
Read your key’s consumption with an authenticated GET /v1/usage. The response gives used tokens, the configured quota, remaining tokens and completed requests. An unlimited key returns null for its quota and remaining balance.
Errors and what to do
| Status | What to do |
|---|---|
| 401 | Check that the key is valid and has not expired. |
| 403 | Use a key scoped to the requested mode. |
| 413 / 422 | Reduce the input size or fix the decision schema. |
| 429 · token_quota_reached | The remaining allowance cannot cover the request. Check usage or contact the key issuer. |
| 429 · rate_limit_reached | Wait for the Retry-After interval before sending another request. |
| 503 / 504 | The service is unavailable or the response deadline passed. Keep the request ID for support. |
Responses carry an X-Request-ID. The maximum HTTP body size is 256 KiB, and a request may contain up to 128 questions. Each scored input, the state plus one question, may be up to 98,304 tokens; a longer input returns 422 at once. Long inputs take longer: near the limit a decision takes one to two minutes, and the server waits up to 300 seconds for an answer. Send long requests one at a time.