Configuration
By default, ThinkThen sends each question and its text to a model service, which answers it and bills your account. You choose the service, the model and the key with options on each command or with THINKTHEN_ environment variables.
ThinkThen keeps no answer cache, so each run asks the service again. File operations keep recovery artifacts for completed answers. Where your text goes explains their defaults, contents and cleanup.
| What you have | What to set |
|---|---|
| A TypeSafe account, or no account yet | THINKTHEN_API_KEY. This is the default. |
| An OpenAI account | OPENAI_API_KEY and THINKTHEN_BACKEND=openai |
| A gateway or a model server of your own | THINKTHEN_URL for System One or OPENAI_BASE_URL for OpenAI, plus the model and key it expects |
An option on the command line wins over its variable. --backend openai on one command, for example, uses OpenAI for that command only.
Jev on System One, the default
Section titled “Jev on System One, the default”ThinkThen asks Jev, model jev-1.13.0, through TypeSafe's System One service at https://api.typesafe.ai/v1. You need a TypeSafe account, and each call counts against it.
- Sign in to the TypeSafe console.
- Create a key on its keys page.
- Set the key in your shell:
export THINKTHEN_API_KEY='your key'ThinkThen reads this key from THINKTHEN_API_KEY and from no other variable.
To check which service and model answered, ask for the details with --json and keep the source:
echo 'Please refund my order.' | thinkthen decide --json \ 'Does the customer request a refund?' | jq -c '.source | {backend, model}'Output
{"backend":"systemone","model":"jev-1.13.0"}
There is no config file.
OpenAI
Section titled “OpenAI”The openai backend calls OpenAI's decisions API at https://api.openai.com/v1. Its default model is gpt-6-luna. Each call counts against your OpenAI account.
- Create a key on your OpenAI account's API keys page.
- Set the key, and choose OpenAI for every command in this shell:
export OPENAI_API_KEY='your key'export THINKTHEN_BACKEND=openaiTo use OpenAI for one command only, leave out THINKTHEN_BACKEND and add --backend openai to that command. To use another OpenAI model, set THINKTHEN_MODEL or add --model NAME.
Your own server
Section titled “Your own server”--url sends the same requests to another address, such as a gateway or a model you host. --model names the model that server should use. The server must speak the API of the backend you point at it:
| Backend | Request it sends | Key it sends |
|---|---|---|
systemone |
POST URL/systemone |
THINKTHEN_API_KEY |
openai |
POST URL/decisions |
OPENAI_API_KEY |
Each request is JSON, with the key as a bearer token in the authorization header. ThinkThen doesn't call a chat or completions endpoint.
To point System One at your server for every command in this shell:
export THINKTHEN_API_KEY='your server key'export THINKTHEN_URL=https://models.example.com/v1export THINKTHEN_MODEL=my-modelFour rules apply to the address:
- It must use HTTPS, or plain HTTP to
localhost,127.0.0.1or[::1]. Any otherhttp://address stops withusage.urlbefore a request is sent. - It must not hold a user name or password, as in
https://name:password@host, because ThinkThen prints the address in its settings. It stops withusage.url. Put the key in the backend's key variable instead. THINKTHEN_URLsets only the System One address, taking precedence overTHINKTHEN_BASE_URL. OpenAI readsOPENAI_BASE_URL. An explicit--urlor SDKSettings.urloverrides the address for the chosen backend, including whenTHINKTHEN_BACKENDchooses it.- If your server's certificate comes from your own certificate authority, set
THINKTHEN_CA_FILEto that authority's PEM file. ThinkThen trusts it as well as your system's certificates.
The source in --json names the backend and model, so the check above shows the route each answer took.
Every model setting
Section titled “Every model setting”| Option | Variable | Default |
|---|---|---|
--backend NAME |
THINKTHEN_BACKEND |
systemone |
--model MODEL |
THINKTHEN_MODEL |
jev-1.13.0, or gpt-6-luna for openai |
--url URL |
THINKTHEN_URL (System One), OPENAI_BASE_URL (OpenAI) |
The backend's own address |
| none | THINKTHEN_API_KEY |
The System One key |
| none | OPENAI_API_KEY |
The OpenAI key |
| none | THINKTHEN_CA_FILE |
Your system's certificates only |
THINKTHEN_MODEL applies only to commands. In an SDK, set the model on your client; without an explicit model setting, it uses the chosen backend's default model.
Command keys come only from these variables. Keep them in your shell or a secret manager, never in a script or a toolbox file. For a live backend call, a missing or blank key stops ThinkThen with usage.key-missing and exit code 2 before it sends anything. Troubleshooting lists that error and the others.
A bar you tuned on one model belongs to that model. If you change the model, check your bars again on your own messages.
Options lists every other setting.
Where an SDK finds its native library
Section titled “Where an SDK finds its native library”The Go, Swift, Zig, C#, Java, Kotlin and Ruby SDKs load the native ThinkThen library when your program starts using them. They all follow one rule:
- If
THINKTHEN_LIBRARYis set, the SDK loads that file and no other. The value must be an absolute path. A relative path stops withTHINKTHEN_LIBRARY must be an absolute path, and a file that won't load stops with alocal.ioerror that names it. An empty value counts as unset. - If it isn't set, the SDK loads the library it installed, by its full path. Swift and Zig look beside your program. C# and Ruby look inside their installed package. Java, Kotlin and Go unpack the library they carry into your user cache folder and load it from there.
An SDK doesn't look in the working folder or on a system search path, so a file of the same name left there can't take the library's place. On Windows too, the SDK always gives the system a full path.
The rule has these limits:
- It covers the ThinkThen library, not the libraries that library needs. On Windows, Go, Swift, Zig and C# keep that search to the library's own folder and the system folder. Java and Ruby can't, so Windows searches for those in its usual places.
- On a Mac,
DYLD_LIBRARY_PATHcan still win over a full path, because the system checks it first. - A Go program built with the
thinkthen_systemtag links the installed library. The system loads that library when your program starts, before the SDK can readTHINKTHEN_LIBRARY.
The Python, TypeScript and R packages build the engine into their own module, and C, C++ and Rust link it when you build your program, so THINKTHEN_LIBRARY doesn't apply to them.