PathFinder

POST /v1/chat

Route a chat completion request to the best model for your task.

Request headers

HeaderRequiredDescription
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
x-pathfinder-filtersNoComma-separated routing filters (see Routing)
Idempotency-KeyNoDedup key for non-streaming requests (see API Key Config)

Request body

FieldTypeRequiredDescription
messagesarrayYesArray of message objects with role and content
streambooleanNoEnable SSE streaming (default: false). See Streaming
max_tokensnumberNoMaximum tokens to generate. May be capped by per-key config
temperaturenumberNoSampling temperature (0–2)

Example

curl https://api.pathfinder.dev/v1/chat \
  -H "Authorization: Bearer pf_live_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "Solve x^2 - 5x + 6 = 0" }
    ],
    "max_tokens": 1024
  }'

Response body

Standard Chat Completions response from the selected provider, returned as-is.

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "..." },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 128,
    "total_tokens": 170
  }
}

Response headers

Every response includes routing metadata. These are exposed via CORS so browser clients can read them.

HeaderExampleDescription
X-Routed-Modelclaude-sonnet-4Model that handled the request
X-Task-TypecodingDetected task type
X-ProvideranthropicProvider that served the request
X-Routing-Fee0.0004Routing fee in USD
X-Classification-Confidence0.95Task classifier confidence (0–1)
X-Data-Confidence0.82Benchmark data coverage (0–1)
X-Benchmark-Score87.3Model's score for this task (0–100)