---
title: Quickstart
description: Install ThinkThen, set your key, ask your first question about a customer message, and act on the answer in a script.
goal: A newcomer with a shell installs ThinkThen, sets the key, gets a first real answer, and uses that answer in a script, in that order.
reader: A developer with a shell who has never used ThinkThen
kind: tutorial
verified: 2026-11-03
---

# Quickstart

Install ThinkThen, set your key, and ask your first question about a customer message.

## 1. Install ThinkThen

On macOS or Linux:

```sh
curl -fsSL https://thinkthen.dev/install.sh | sh
```

In Windows PowerShell:

```powershell
irm https://thinkthen.dev/install.ps1 | iex
```

Open a new terminal, then check that it worked:

```sh
thinkthen --version
```

Output

```text
thinkthen 0.2.0
```


[Installation](/install/) covers Homebrew, Cargo and downloads.

## 2. Set your key

ThinkThen sends each question to TypeSafe's System One service, which bills your TypeSafe account for each call. Get a key on the [TypeSafe keys page](https://console.typesafe.ai/keys), then set it in your shell:

```sh
export THINKTHEN_API_KEY='your key'
```

In Windows PowerShell:

```powershell
$env:THINKTHEN_API_KEY = 'your key'
```

To use OpenAI or your own server instead, see [Configuration](/configuration/).

## 3. Ask a question

Pipe in the text, and put the question in quotes:

```sh
echo 'Please refund my order.' |
  thinkthen decide 'Does the customer request a refund?'
```

Output

```text
true
```


`true` means yes: the message asks for a refund. If you see `usage.key-missing` instead, the key isn't set in this shell.

## 4. Act on the answer

`--check` turns the answer into the exit code, so a script can branch on it. Here the answer is yes, so the script sends the message to the refunds queue:

```sh
message='Please refund my order.'
if echo "$message" |
    thinkthen decide --check \
      'Does the customer request a refund?' > /dev/null
then
  echo 'send to the refunds queue'
else
  status=$?
  case "$status" in
    1|3) ;;
    *) exit "$status" ;;
  esac
fi
```

Output

```text
send to the refunds queue
```


In Windows PowerShell, `$LASTEXITCODE` holds the exit code:

```powershell
'Please refund my order.' |
  thinkthen decide --check `
    'Does the customer request a refund?' > $null
if ($LASTEXITCODE -eq 0) {
  'send to the refunds queue'
}
```

Output

```text
send to the refunds queue
```


## Next steps

- [decide](/functions/decide/): yes, no and not sure.
- [The ten functions](/#pick-the-function-that-fits-your-question): pick the one that fits your question.
- [File types](/command-line/file-types/): answer every row of a CSV file.
- [Python SDK](/sdks/python/) and the other SDKs: the same functions in your code.
