What This Example Shows
- A
POST /v1/systemonerequest in the TypeSafe API’s exact request and response format Authorization: Bearerauthentication with a Swarms API key- Reading the job ID and the amount charged from the
x-typesafe-request-idandx-swarms-total-costheaders - Listing models the way the TypeSafe SDKs do, with
GET /v1/modelsand anX-TypeSafe-SDKheader
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.
- cURL
- Python
Step 3: Read the Response
The live response from production:- The body has only
model,answersandusagetoken counts, exactly as TypeSafe returns them. modelis the version that answered thejev-latestalias.- There is no
job_idor cost in the body. Read them from the headers: 283 input tokens × $0.0483 / 1M = $0.0000137, thex-swarms-total-costvalue.
Step 4: List Models Like a TypeSafe SDK
The TypeSafe SDKs list models withGET /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.
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
- Decision Models and SystemOne Reference: every field, header, price and error
- Decision Models Quickstart: the Swarms-format request
- List Decision Models and Estimate Costs: budget a job from the model prices