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

# Anthropic SDK Drop-in

> Use the Anthropic SDK with Nito.

Nito serves `POST /v1/messages` and `POST /v1/messages/count_tokens` in the Anthropic shape. Point the SDK at Nito directly, or use the OpenAI shape through Chat Completions.

## Messages

Base URL `https://app.trynito.ai` (the SDK appends `/v1/messages`); your Nito key as the auth token.

<CodeGroup>
  ```python Python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from anthropic import Anthropic

  client = Anthropic(
      base_url="https://app.trynito.ai",
      auth_token="z_sk_your_key_here",   # sent as Authorization: Bearer
  )

  resp = client.messages.create(
      model="anthropic/claude-sonnet-5",  # a Nito catalog ID
      max_tokens=300,
      system="You are a concise assistant.",
      messages=[{"role": "user", "content": "Say hello in one short sentence."}],
  )

  print(resp.content[0].text)
  ```

  ```typescript TypeScript wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import Anthropic from "@anthropic-ai/sdk";

  const client = new Anthropic({
    baseURL: "https://app.trynito.ai",
    authToken: "z_sk_your_key_here",
  });

  const resp = await client.messages.create({
    model: "anthropic/claude-sonnet-5",
    max_tokens: 300,
    system: "You are a concise assistant.",
    messages: [{ role: "user", content: "Say hello in one short sentence." }],
  });

  console.log(resp.content[0].type === "text" ? resp.content[0].text : "");
  ```
</CodeGroup>

Accepted: `system`, `messages` (`user` and `assistant`), `max_tokens`, `temperature`, `top_p`, `tools`, `tool_choice`, `thinking`, `stream`. Model IDs are catalog IDs. `:confidential` model IDs work here too; the Chat Completions feature suffixes (`?reasoning_effort=...`) do not. Full fields: [Messages endpoint](/api/api-reference/endpoints/messages/createanthropicmessage).

## Chat Completions

<CodeGroup>
  ```python Python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI

  client = OpenAI(
      api_key="z_sk_your_key_here",
      base_url="https://app.trynito.ai/v1",
  )

  resp = client.chat.completions.create(
      model="anthropic/claude-sonnet-5",
      messages=[
          {"role": "system", "content": "You are a concise assistant."},
          {"role": "user", "content": "Say hello in one short sentence."},
      ],
  )

  print(resp.choices[0].message.content)
  ```

  ```typescript TypeScript wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: "z_sk_your_key_here",
    baseURL: "https://app.trynito.ai/v1",
  });

  const resp = await client.chat.completions.create({
    model: "anthropic/claude-sonnet-5",
    messages: [
      { role: "system", content: "You are a concise assistant." },
      { role: "user", content: "Say hello in one short sentence." },
    ],
  });

  console.log(resp.choices[0].message.content);
  ```
</CodeGroup>

## Mapping

* Anthropic's top-level `system` string becomes a `role: "system"` message on Chat Completions.
* Anthropic model names are not Nito IDs. Use `anthropic/claude-sonnet-5`.
* Claude models run at Anonymous. For attested calls, choose an open-weight model with a `:confidential` variant on either endpoint. See [Privacy Levels](/privacy/levels).

## Related

<CardGroup cols={3}>
  <Card title="OpenAI SDK Drop-in" icon="plug" href="/api/get-started/quickstart-openai-sdk">
    The OpenAI shape.
  </Card>

  <Card title="Anthropic Mapping Notes" icon="arrows-left-right" href="/api/sdks/anthropic-drop-in/mapping-notes">
    Field-by-field translation.
  </Card>

  <Card title="Messages Endpoint" icon="message" href="/api/api-reference/endpoints/messages/createanthropicmessage">
    Reference.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.