ThinkThen

Backends

Any System One server

ThinkThen posts every question to BASE/systemone. Any server that answers there in the System One shape can be a backend.

By address

Set THINKTHEN_BASE_URL to the server's base, or pass --url on one command. The key comes from THINKTHEN_API_KEY. The model is the default unless you pass --model.

THINKTHEN_BASE_URL names the server. The address came from the environment, and the key will come from THINKTHEN_API_KEY.
export THINKTHEN_BASE_URL=http://localhost:8080/v1

thinkthen status --json |
jq '.backend | {url, url_source, key_variable}'
Output
{
  "url": "http://localhost:8080/v1/systemone",
  "url_source": "environment",
  "key_variable": "THINKTHEN_API_KEY"
}
exit 0

By name

The configuration file can name a server under backends. An entry gives the server's url, the name of the variable that holds its key in key_env, and its model. The file never holds the key itself. Then --backend NAME or THINKTHEN_BACKEND picks the entry, and backend in the file makes it the default.

config/thinkthen/config.json, the configuration file
{
  "schema": "thinkthen.config/1",
  "backends": {
    "local-d1": {
      "url": "http://127.0.0.1:8080/v1",
      "key_env": "LOCAL_D1_KEY",
      "model": "d1:free",
      "requests_per_minute": 120
    }
  }
}
The entry local-d1 brings its own address, model, and key variable.
export XDG_CONFIG_HOME="$PWD/config"

thinkthen status --backend local-d1 --json |
jq '.backend | {name, url, model, key_variable}'
Output
{
  "name": "local-d1",
  "url": "http://127.0.0.1:8080/v1/systemone",
  "model": "d1:free",
  "key_variable": "LOCAL_D1_KEY"
}
exit 0

A name uses 1 to 32 lowercase letters, digits, and hyphens, and may not reuse a built-in name. The Configuration page says where the file lives.

Pace the requests

ThinkThen sets no pace of its own. requests_per_minute on an entry caps how many requests one process starts each minute, retries included. It takes a whole number from 1 to 60,000. A built-in's name may appear under backends with a rate and nothing else. THINKTHEN_REQUESTS_PER_MINUTE outranks the file. The limit holds within one process. Requests a minute gives the rule.

bad/thinkthen/config.json, a rate out of range
{
  "schema": "thinkthen.config/1",
  "backends": {
    "typesafe": {"requests_per_minute": 0}
  }
}
A rate of 0 is out of range. The command names the field, exits 5, and sends nothing.
export XDG_CONFIG_HOME="$PWD/bad"

thinkthen status
Output
thinkthen: configuration backend field `requests_per_minute` must be a whole number from 1 to 60000
exit 5

Check the server

thinkthen check --url BASE sends four fixed questions that cover every question shape ThinkThen asks. It prints one row each for the connection, the key, the endpoint, the four questions, and the usage counts. A row reads ok, warning or critical. It exits 0 only when no row is critical. Every request is real, so a hosted server may charge for it. The check reference explains every row.

The check would post its four fixed questions to the server's systemone address.
thinkthen check \
  --url http://localhost:8080/v1 \
  --plan |
head -n 4
Output
url http://localhost:8080/v1/systemone
provider systemone
model asked unspecified
model sent jev-1.13.0
exit 0

A threshold tuned on one model does not carry to another. Grade the new model on your own labeled records with audit before you trust it.

From your language

Each page shows how its language names a backend.