Reason

Add the exchange to Reason as a Custom provider. Reason then sends its model requests to the exchange. The exchange auctions each request, sets a cap before the first token and charges for the measured use.

Reason is a hosted coding agent, built on Pi. The agent runs on the Reason servers, and its commands run on your computer. The model requests come from the Reason servers, so the base URL must be the public URL of the exchange.

liquid connect reason prints the values to paste, with your model filled in.

curl -fsSL https://inference.ai.exchange/cli/install.sh | bash
liquid login
liquid connect reason

Before you start

1. Install Reason and log in

curl -fsSL https://reasonmachines.com/install.sh | bash
reason login

2. Connect a Custom provider

Do 2a or 2b. Both save the same four values.

2a. In the Reason settings

Open Reason's model settings (Settings → Models). Then select Custom → ⋯ → Add another API key. Enter these values in the order of the dialog:

API key

sk-liquid-...

Base URL

https://router.inference.ai.exchange/v1

API format

openai-completions

Model IDs

liquid.auto

2b. From a terminal

This command calls the Reason API with the login of the Reason CLI and the key in LIQUID_API_KEY. It replaces the Custom provider of your Reason organization.

creds="$HOME/.config/reason/credentials.json"
curl --fail-with-body -sS -X PUT \
  "https://api.reasonmachines.com/v3/organizations/$(jq -r .orgId "$creds")/provider-credentials/custom-endpoint" \
  -H "Authorization: Bearer $(jq -r .accessToken "$creds")" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --arg key "$LIQUID_API_KEY" --arg models "liquid.auto" '{
    key: $key,
    config: {
      CUSTOM_ENDPOINT_BASE_URL: "https://router.inference.ai.exchange/v1",
      CUSTOM_ENDPOINT_API: "openai-completions",
      CUSTOM_ENDPOINT_MODELS: $models
    }
  }')"

If the command fails with 401, run reason login again.

3. Run it

Reason adds the prefix byok:custom-endpoint: to each model name.

reason --model byok:custom-endpoint:liquid.auto

To run one task and print the result, add a prompt: reason "fix the flaky test" --model byok:custom-endpoint:liquid.auto.

Notes

Troubleshooting

Symptom Cause and fix
Reason refuses the key with api_keys_require_team_plan. Reason connects an API key only on its Team plan. Change the plan in Reason.
The provider check fails. The URL is missing /v1, or it is not the public URL of the exchange.
The model does not appear in the picker. The name is not in the Model IDs list. Add it and save the provider again.
A request is refused for lack of funds. The workspace balance cannot cover the cap. Add funds on the Credits page.

Next steps