Presets

A preset is a named tier you can reuse. It is not a second API. The call is still a chat completion to your model.

Agent loop

Tool traces are where the bill grows. measured shrinks tool bodies. aggressive keeps the tool name and drops the old body.

await client.chat.completions.create({
  model: "gpt-4.1",
  tier: "measured",
  messages, // includes prior tool results
})

Fail-open

If Tokand times out or errors, the SDK skips it and sends the request to your provider.

const ai = withTokand(openai, {
  apiKey: process.env.TOKAND_KEY,
  timeoutMs: 80,
  bypassOnError: true,
})

Install steps are in the quickstart. Tier names are on tiers.