Skip to main content

What is Anthropic Native Format?

Samurai AI supports two API formats side-by-side: If you already use the official anthropic Python or TypeScript SDK — or call api.anthropic.com directly — you can switch to Samurai AI by changing one line: the base_url.
Base URL for Anthropic format: https://www.samuraiapi.in/apiThe Anthropic SDK appends /v1/messages automatically. Do not include it in the base URL.

Supported Claude Models

You can also use Claude models through the OpenAI-compatible /v1/chat/completions endpoint — Samurai AI converts the format automatically. Use whichever endpoint matches your existing SDK.

Key Differences from OpenAI Format

1. System prompt is a top-level field

2. max_tokens is required

The Anthropic API always requires max_tokens. There is no default.

3. Response is a Message object, not a ChatCompletion

4. Tool definitions use input_schema instead of parameters

5. Auth header is x-api-key


Quick Start


SDK Installation


Authentication

Use your Samurai AI API key in the x-api-key header. The same key works for both OpenAI-compatible and Anthropic-native endpoints.
The anthropic-version: 2023-06-01 header is required by the official SDK — Samurai AI accepts it and forwards it as needed.

Rate Limits & Quotas

Anthropic-format requests use the same quotas and rate limits as OpenAI-format requests. Your plan limits apply across both endpoints.

Next Steps

Messages API

Full reference for the /v1/messages endpoint — parameters, streaming, tool use, vision.

Function Calling

Tool use with the OpenAI-compatible format (also works with Claude models).