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

# Endpoints

> Every open-source chat model serves both the OpenAI and Anthropic wire formats

Base URL `https://api.morphllm.com`. One API key, two wire formats:

| Endpoint                    | Format                  | Serves                                                 |
| :-------------------------- | :---------------------- | :----------------------------------------------------- |
| `/v1/chat/completions`      | OpenAI Chat Completions | All models                                             |
| `/v1/messages`              | Anthropic Messages      | [Open-source chat models](/sdk/components/fast-models) |
| `/v1/messages/count_tokens` | Anthropic               | Same                                                   |

Docs examples use OpenAI-SDK tabs. For any open-source chat model, the Anthropic Messages API works equivalently: same models, same per-token billing, same rate limits. Specialized model APIs ([Fast Apply](/sdk/components/fast-apply), [WarpGrep](/sdk/components/warp-grep/index), [Compact](/sdk/components/compact), [Reflex](/sdk/components/reflexes/index)) are OpenAI-format only.

Auth accepts both conventions: `Authorization: Bearer YOUR_API_KEY` or `x-api-key: YOUR_API_KEY`.

<Tabs>
  <Tab title="Anthropic SDK (Python)">
    ```python theme={null}
    import anthropic

    client = anthropic.Anthropic(
        api_key="YOUR_API_KEY",
        base_url="https://api.morphllm.com",
    )

    message = client.messages.create(
        model="morph-glm52-744b",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Write a tiny rate limiter in TS."}],
    )
    print(message.content[0].text)
    ```
  </Tab>

  <Tab title="Anthropic SDK (TypeScript)">
    ```typescript theme={null}
    import Anthropic from "@anthropic-ai/sdk";

    const client = new Anthropic({
      apiKey: "YOUR_API_KEY",
      baseURL: "https://api.morphllm.com",
    });

    const message = await client.messages.create({
      model: "morph-glm52-744b",
      max_tokens: 1024,
      messages: [{ role: "user", content: "Write a tiny rate limiter in TS." }],
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.morphllm.com/v1/messages" \
      -H "x-api-key: YOUR_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "morph-glm52-744b",
        "max_tokens": 1024,
        "messages": [{"role": "user", "content": "Write a tiny rate limiter in TS."}]
      }'
    ```
  </Tab>
</Tabs>

Streaming, tools (`tool_use` / `tool_result` blocks), system prompts, and multi-turn history all work as the Anthropic API documents them. Model reasoning surfaces as `thinking` content blocks; a `thinking` request config maps to the models' [reasoning effort tiers](/sdk/components/fast-models) (budgets under 8k → `low`, under 24k → `medium`, above → `high`).

This is what makes [Claude Code work natively](/guides/coding-agents) with Morph models: point `ANTHROPIC_BASE_URL` at `https://api.morphllm.com` and go.
