Skip to main content
This quickstart sends one request to POST /v1/decision/completions that asks three questions about a support ticket, then reads the answers and the cost. Every request and response on this page was run against production.

1. Get an API Key

Create a key at swarms.world/platform/api-keys and export it. Your account needs more than $1.00 of purchased credit.

2. Ask One Question

A noul question returns the probability that a statement is true. model_name defaults to jev-latest, so it can be left out.
noul is 0.98: almost certainly a billing ticket. Branch on it with a threshold, such as > 0.5.

3. Ask Three Kinds of Question at Once

Add a choice question to pick a team and a score question to rate severity. All three are answered in one request, and the ticket’s tokens are billed once.
  • choice is the most likely option, and probabilities holds all of them: payments 0.92, infra 0.07, support 0.01.
  • score is 2.99 on levels numbered from 0, so legend["3"] names it: Critical.
  • model is the version that answered the jev-latest alias.

4. Check the Cost

The request used 393 input tokens at $0.0483 per 1M, and output tokens are free: 393 × $0.0483 / 1,000,000 = $0.0000190, the usage.total_cost above. The same charge is in the x-swarms-total-cost response header. At that rate 10,000 tickets cost about $0.19. Prices come from GET /v1/decision/models.

5. Already Using TypeSafe?

POST /v1/systemone takes and returns the TypeSafe API’s exact format, so point TypeSafe code at https://api.swarms.world with your Swarms key:

Next Steps