> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqwish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Send your first request and use its result safely.

## 1. Create a key and find a model

Sign in to the [console](https://console.sqwish.ai) and check your account status. An active account can create an API key. Copy the key when it is shown and keep it on your server.

```bash theme={null}
export D1_API_URL='https://console.sqwish.ai'
export D1_API_KEY='your-api-key'

curl --fail-with-body "$D1_API_URL/v1/models" \
  -H "Authorization: Bearer $D1_API_KEY"
```

The response is a `data` list. Choose an available base model; catalogue entries can also be unavailable or require early access. A waitlisted account can view the catalogue and its own account, but cannot run authenticated decisions yet.

## 2. Send a decision

This request routes a message and defers uncertain cases. The `0.8` threshold is an example policy to evaluate on your own messages.

```bash theme={null}
curl --fail-with-body --connect-timeout 5 --max-time 40 \
  "$D1_API_URL/v1/decide" \
  -H "Authorization: Bearer $D1_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @- <<'JSON'
{
  "model": "sqwish-d1-core",
  "context": "You charged my card twice. Please refund the duplicate payment.",
  "decisions": [{
    "id": "team",
    "kind": "single",
    "question": "Which team should handle this message?",
    "outcomes": {
      "billing": "Charges, invoices and refunds.",
      "support": "Other requests for help.",
      "other": "No request for billing or support."
    },
    "abstain": {"min_probability": 0.8}
  }]
}
JSON
```

The timeout above is your client's waiting budget. A timeout does not prove that the server stopped or that no charge occurred.

## 3. Use the action

Given the parsed response as `result`:

```javascript theme={null}
const decision = result.decisions.team;
const queue = decision.abstained ? "manual_review" : decision.action;
console.log({ queue, model: result.model, fallback: result.fallback ?? null });
```

`top` is the most probable raw outcome. `action` also accounts for any weights, costs and abstention policy. When you declare a policy, use its action and handle `abstained` explicitly.

Inspect `usage.input_tokens` and `usage.decisions` for the request's usage. Use the account usage endpoints for costs. Record `X-Request-ID` when diagnosing an error; the decision `id` identifies the returned decision and can be used for [feedback](/guides/feedback) if you requested storage.

<Warning>
  Persist an `Idempotency-Key` with the request and reuse both after a timeout. Successful inference responses can be replayed for 24 hours without another charge. Once the response expires, that key returns an explicit error and never runs another inference. `store: true` independently enables feedback. See [reliable retries](/examples/reliable-retries).
</Warning>

## Next steps

Try [support routing](/examples/customer-support) to combine all three kinds, or [write clearer decisions](/guides/writing-decisions). The [API behavior guide](/api) covers errors, limits and pagination.

The API reference's interactive playground sends requests through Mintlify's proxy to the live console API. The supplied key and request pass through that proxy; successful calls can consume credit or create resources. Use sample data and a key you can revoke.
