# Messages · Quanteex

## Messages

POST /v1/messages

### Prompt caching

For independent questions that reuse a long system prompt, see the Claude example in the prompt caching guide.

Claude prompt caching guide

### Request

Send model, messages and a positive max_tokens within the published output range. Authorization: Bearer is accepted, as is x-api-key.

### Example request

Text is returned in the content array. Use a top-level system field for a system instruction; messages contains user and assistant turns.

```
curl "https://api.quanteex.com/v1/messages" \
  -H "Authorization: Bearer $QUANTEEX_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "claude-fable-5-2",
  "max_tokens": 128,
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}'
```

### Streaming

Set stream: true. Preserve text, thinking, signature, tool JSON and citation deltas. Finish on message_stop and handle error events. The final usage contains cumulative token counts, not a sum of all streamed usage objects.

### Estimate input tokens

POST /v1/messages/count_tokens accepts model, messages, system and applicable tool/thinking settings with the same project key. It returns an approximate input_tokens count without generation or charge. The response headers x-quanteex-token-count-source: local-estimate and x-quanteex-token-count-exact: false identify the estimate; final usage determines billing.

Make your first request with Quanteex.

Retry only when the outcome is safe to repeat.

