> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asklethe.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Messages API

> POST /v1/messages and /v1/messages/count_tokens, Anthropic Messages API-compatible.

`POST https://asklethe.ai/v1/messages` accepts the same request shape as Anthropic's Messages API. This is the endpoint to use if you're porting code written against the Anthropic SDK, or pointing Claude Code at LETHE (see the [Quickstart](/api-reference/quickstart) Claude Code snippet).

<CodeGroup>
  ```bash cURL theme={null}
  curl https://asklethe.ai/v1/messages \
    -H "x-api-key: $LETHE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "lethe",
      "max_tokens": 1024,
      "messages": [{ "role": "user", "content": "Say hi in five words." }]
    }'
  ```
</CodeGroup>

## Model aliasing

Any `claude-*` or `anthropic.*` model id (e.g. Claude Code's default `opus`/`sonnet`/`haiku` picker ids) is automatically mapped to `lethe`, you don't need to change model names in existing Anthropic-SDK code.

## `thinking` / `output_config` normalization

LETHE normalizes a couple of Anthropic-shape edge cases before forwarding upstream:

* `"thinking": false` is rewritten to `{"type": "disabled"}`.
* `output_config.effort: "none"` is dropped in favor of `thinking: {"type": "disabled"}`.

You don't need to do anything for this. It happens automatically if your client sends the older shape.

## Count tokens

`POST https://asklethe.ai/v1/messages/count_tokens` mirrors Anthropic's token-counting endpoint, same request body shape as `/v1/messages` minus generation params.

Both endpoints share auth, quota, and error format with the rest of the API. See [Authentication](/api-reference/authentication), [Rate Limits](/api-reference/rate-limits), and [Errors](/api-reference/errors).
