Interactive API reference
which-llm API docs
Deterministic routing, payments, and explainable decisions
Live spec
Interactive Reference
Search operations, inspect schemas, and run requests directly against the live API.

Start here

Begin with a POST to https://api.which-llm.com/decision/optimize. If payment is required, the response body tells you the exact amount, supported chains, and receiver address to use before retrying the same request.

  • 1. Call optimize Use a stable Idempotency-Key when you want safe retries.
  • 2. Read the 402 body Use required_amount, accepts[].chain, and accepts[].pay_to.
  • 3. Retry with proof Send payment proof headers after the on-chain transfer settles.

Core endpoints

Most integrations only need one paid decision call and one follow-up reporting call.

Payment retry headers

After a successful payment, retry the exact request with the headers below. The amount must match the required value exactly.

  • X-Payment-Chain Required on the paid retry request.
  • X-Payment-Tx Required on the paid retry request.
  • X-Payer Required on the paid retry request.
  • X-Payment-Amount Required on the paid retry request.
  • X-Payment-Asset Required on the paid retry request.