STOCKFISH 14–19Latest release: 19Explore engines ↗

Built for agents, not just for people

Start with 100 free requests with a verified email, then add a card for 2,000 units/day and automatic overage billing. The trial is shared across your account, never resets, and is never charged. All prices are in USD.

Agents can discover endpoints and evaluate positions over HTTP. Start a device login, ask your operator to approve once with Google, then collect a scoped key and make REST or MCP requests.

The loop

StepCallWhat comes back
DiscoverGET /llms.txt, GET /openapi.jsonAuth, endpoints, cost annotations in under 800 tokens
TryStatic example responseAn illustrative response; sign in with Google for 100 free requests, then add a card
Log inPOST /v1/auth/device/startPairing code for your operator; collect the key after approval
BudgetGET /v1/price, X-Quota-RemainingUnits for any request before you send it; what is left after
Hit a limitany call → 402next_action, plan options, and a checkout URL for your human
Keep goingsame keyLimits update within 60 s of payment; nothing to reconfigure

Agent and CLI login

No browser cookies or Google credentials are needed in the agent. Its operator signs in and approves the exact scopes and budget on the connection screen. New operators can create their verified account there. Anonymous accounts and self-approved keys are not supported.

  1. Start with POST /v1/auth/device/start. Keep the returned device_code private. Show only verification_uri and user_code to your operator.
  2. The operator enters the code, signs in with Google, checks the requesting agent and account, and explicitly approves or denies access. The request expires after ten minutes.
  3. Poll POST /v1/auth/device/token with the private device code at most once every five seconds. After approval, save access_token securely. It is returned once and expires after 30 days.
  4. Send Authorization: Bearer YOUR_ACCESS_TOKEN to engine endpoints or configure the same token in your MCP client. Never put either secret in URLs, logs, prompts, or committed files.
curl -sS https://stockfishapi.com/v1/auth/device/start   -H 'Content-Type: application/json'   -d '{"client_name":"My chess agent","scopes":["eval"],"budget_units":1000}'

Keep the device code in your agent's private memory. A token poll sends this JSON body, without an Authorization header:

POST /v1/auth/device/token
Content-Type: application/json

{"device_code":"REPLACE_WITH_PRIVATE_DEVICE_CODE"}

Device keys allow only eval, analyze, and/or batch. The default is eval with a 1,000-unit budget per calendar month; you may request 1–10,000 units. Budgets reset each UTC calendar month, so this is not a lifetime or dollar cap. Keys cannot manage billing, mint other keys, or raise their own budget. There is no refresh token. The operator can revoke access anytime in the dashboard.

Existing trial, plan, payment and rate limits still apply. Usage can incur your account's existing overage charges; connecting an agent does not create a paid subscription or add a card.

After collecting a token, make a position request:

// Node.js 18+. Supply STOCKFISH_API_KEY through your secret manager.
const response = await fetch("https://stockfishapi.com/v1/eval", {
  method: "POST",
  headers: { "Authorization": "Bearer " + process.env.STOCKFISH_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", depth: 1 })
});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
console.log(result);

Errors tell you what to do

Engine and account errors use RFC 9457 problem+json with a next_action you can branch on:

next_actionStatusDo this
fix_request400Read detail; the request will never succeed as sent
retry_after429, 503Wait Retry-After seconds, then retry with the same Idempotency-Key
sign_up401, 402, 429 (keyless)Ask your operator to open the signup.url dashboard link
upgrade402Show checkout.url to your operator, or pick a smaller depth
raise_budget402PATCH /v1/keys/{id} if you hold the keys scope, otherwise ask
verify_email403The owner must sign in with Google
contact403, 501Surface the message; a person has to act
HTTP/1.1 402 Payment Required
Content-Type: application/problem+json

{
  "type": "https://stockfishapi.com/errors/quota_exceeded",
  "title": "Daily quota exceeded",
  "status": 402,
  "next_action": "upgrade",
  "retry_after": 31250,
  "plans": [{ "plan": "hobby", "price_usd_month": 9, "included_units": 100000, "max_depth": 22 }],
  "checkout": { "method": "POST", "url": "https://stockfishapi.com/v1/billing/checkout", "body": { "plan": "hobby" } }
}

Scoped keys for sub-tasks

Create a separate key for each integration in the signed-in dashboard. Key creation and rotation require a verified login; an API key alone cannot issue more credentials.

MCP

The MCP endpoint at https://stockfishapi.com/mcp supports Streamable HTTP with evaluate_position, best_move, legal_moves, and validate_position. Configure your API key as a Bearer token. Start with 100 free requests with a verified email, then add a card in the dashboard. Automatic MCP OAuth discovery is not supported. Use the device-login token as a Bearer header in a compatible client.

Retry and backoff

  • Honour Retry-After; it is exact, not a guess.
  • Send an Idempotency-Key on POSTs you may retry.
  • Do not raise depth to "get a better answer" without checking GET /v1/price; cost grows 1.6× per ply.
  • Prefer bestmove when you only need a move; it is half the price of eval.