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

# Quickstart

> Get an API key and ask Nimble your first question.

## Get an API key

Sign in to the [Bespoke Labs console](https://console.bespokelabs.ai/home/keys) and create a key. Save it in an environment variable.

```bash theme={null}
export BESPOKE_API_KEY="your-key"
```

Nimble uses prepaid credit. You can see your credit and buy more in the console.

## Make a request

Send the state and your questions to `POST /v1/systemone`.

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.bespokelabs.ai/v1/systemone \
    -H "Authorization: Bearer $BESPOKE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "nimble-latest",
      "state": "The customer was charged twice and asks for a refund. The service still works.",
      "questions": {
        "refund": {
          "type": "noul",
          "instructions": "Does the customer request a refund?"
        },
        "department": {
          "type": "choice",
          "instructions": "Which department should handle this request?",
          "criteria": {
            "billing": "Charges, payments and refunds",
            "technical": "Software bugs and outages"
          }
        }
      }
    }'
  ```

  ```python Python theme={null}
  from bespokelabs import BespokeLabs

  client = BespokeLabs()  # reads BESPOKE_API_KEY

  response = client.nimble.system_one(
      model="nimble-latest",
      state="The customer was charged twice and asks for a refund. The service still works.",
      questions={
          "refund": {
              "type": "noul",
              "instructions": "Does the customer request a refund?",
          },
          "department": {
              "type": "choice",
              "instructions": "Which department should handle this request?",
              "criteria": {
                  "billing": "Charges, payments and refunds",
                  "technical": "Software bugs and outages",
              },
          },
      },
  )
  print(response.answers)
  ```
</CodeGroup>

## Read the answer

The response uses the same IDs that you gave your questions.

```json theme={null}
{
  "model": "nimble-latest",
  "answers": {
    "refund": { "type": "noul", "noul": 0.998 },
    "department": {
      "type": "choice",
      "choice": "billing",
      "probabilities": { "billing": 1.0, "technical": 0.0 },
      "confidence": 1.0
    }
  },
  "usage": { "input_tokens": 241, "output_tokens": 3 }
}
```

The customer asked for a refund with a probability of 0.998, and the request belongs to billing. `usage.input_tokens` is the number of input tokens that you pay for.

## Use another model

Change `model` to use another Nimble model at the same endpoint. This request uses fact check to test two claims against a document. Each claim is a `noul` question.

```bash theme={null}
curl https://api.bespokelabs.ai/v1/systemone \
  -H "Authorization: Bearer $BESPOKE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nimble-factcheck",
    "state": "The board moved the vote to Tuesday because the CFO was travelling.",
    "questions": {
      "moved": { "type": "noul", "instructions": "The vote was moved to Tuesday." },
      "ceo": { "type": "noul", "instructions": "The CEO was travelling." }
    }
  }'
```

The document supports the first claim and not the second.

```json theme={null}
{
  "model": "nimble-factcheck",
  "answers": {
    "moved": { "type": "noul", "noul": 0.99 },
    "ceo": { "type": "noul", "noul": 0.002 }
  },
  "usage": { "input_tokens": 25, "output_tokens": 0 },
  "request_id": "6b57f82e-6905-48a1-bc44-fe0af138d8c5"
}
```

## Next steps

* Learn the three [question types](/nimble/questions).
* Check claims with [fact check](/nimble/factcheck), or score files with [code search](/nimble/codegrep).
* Use Nimble from the [Bespoke Labs SDK](/nimble/python-sdk) or [TypeSafe's SDK](/nimble/typesafe-sdk).
