Skip to main content

What This Example Shows

  • A POST /v1/systemone request in the TypeSafe API’s exact request and response format
  • Authorization: Bearer authentication with a Swarms API key
  • Reading the job ID and the amount charged from the x-typesafe-request-id and x-swarms-total-cost headers
  • Listing models the way the TypeSafe SDKs do, with GET /v1/models and an X-TypeSafe-SDK header

Why This Matters

If your code already talks to the TypeSafe API, you don’t have to rewrite it to run on Swarms. /v1/systemone accepts the same body and returns the same body, so the only changes are the base URL and the key. Charges come out of your Swarms credits, at the prices listed by GET /v1/decision/models.

Step 1: Setup

Step 2: Send a SystemOne Request

model is required here, unlike model_name on /v1/decision/completions.

Step 3: Read the Response

The live response from production:
  • The body has only model, answers and usage token counts, exactly as TypeSafe returns them.
  • model is the version that answered the jev-latest alias.
  • There is no job_id or cost in the body. Read them from the headers: 283 input tokens × $0.0483 / 1M = $0.0000137, the x-swarms-total-cost value.

Step 4: List Models Like a TypeSafe SDK

The TypeSafe SDKs list models with GET /v1/models and send an X-TypeSafe-SDK header. With that header, Swarms returns the decision models in the same shape as GET /v1/decision/models; without it, /v1/models returns the OpenAI-style list of agent models.
The list above is shortened to one model; the full list is every model GET /v1/decision/models returns.

Differences From /v1/decision/completions

Both use the same models, prices, question types, credit checks and errors. A request missing model returns 422.

Next Steps