Skip to main content
This page takes you from no account to a completed decision run: one request that asks three typed questions about a support ticket and returns a probability for every answer. It is for developers making their first call. You need a terminal with curl, or Node.js 18+ or Python 3 with requests.
1

Create an account

Sign up at console.opentype.dev/sign-up and verify your email address. Verifying gives your new organization $5 of free credit (5,000,000 micro-USD), once per email address. At the cost of the run below, that covers more than 250,000 runs.The details, including the sign-in options, are on Create an account.
2

Create an API key

In the console, open API keys and choose + Create key.
  1. Give the key a Name after the process that will hold it, for example Production ticket router. The name is a label, not a credential.
  2. Under Scopes, keep Send requests. It grants runs_write (send runs) and runs_read (read them back), which is all this page needs.
  3. Choose + Create key and show secret.
  4. Choose Copy secret, store it somewhere safe, then choose I have copied it.
Newly created key showing its secret once, with a Copy secret button and the key's id, prefix and scopes
The secret is otsk_ followed by 64 lowercase hex characters. It is shown once. Only a SHA-256 hash of it is stored, so a lost secret cannot be recovered: revoke the key and create another. See API keys.
3

Export the key

Keep the key in an environment variable, never in source code.
Every example on this site reads the key from OPENTYPE_API_KEY.
4

Send a decision run

This run triages a support ticket with three questions: a yes/no (noul), a one-of-N (choice), and an ordered level (score).
The request is synchronous: it returns 200 once the run has finished. kind: "decision" is required here, because a request without kind is treated as a verdict run. think_tokens: 64 lets the model reason for up to 64 hidden tokens before it answers; the reasoning text is never returned.
5

Read the answers

answers keys are always sorted, whatever order you sent. stages shows the order the questions were read in, and thought_tokens how many of the 64 thinking tokens the model used.
6

Read the run back

Every run is stored under its run_id. Fetch it with the same key; it needs runs_read.
The stored run carries the same answers, usage and cost_micros, with replayed: true. It is thinner than the live response: it has no cost_basis, and its decision has no model or stages. See Runs.

Retry safely

Send the same request again with the same Idempotency-Key and you get the stored run back with replayed: true. There is no second model call and no second charge. Reusing a key with a different body is refused with 409 idempotency_conflict. If a run fails with a 503 or 504 before any model served it, send the retry with a new key: the first key stays attached to a pending run, and replaying it answers 202 with that run. The Idempotency guide covers every case.

What goes wrong

Every error body has the same shape. Branch on code, and log request_id:
More causes and fixes are on Troubleshooting and Errors.
  • Decision questions - add dependencies, conditional questions, and more options.
  • Decision runs - turn probabilities into thresholds for a real triage flow.
  • API keys - create, rotate, and revoke keys in the console.
  • Scopes and roles - which scopes a production key should hold.
  • Limits - every size, token, and spend bound in one table.