HridaSpro Docs

Integrations

Anthropic SDK

Point the Anthropic SDK at Spro — keep your code, get every provider plus guardrails.

Spro is Anthropic-compatible. The Messages API (/v1/messages) speaks the exact wire format the Anthropic SDK sends — system prompts, tool use, streaming, everything. If your code uses the Anthropic SDK today, integrating Spro takes two changes: point the client at Spro's base URL, and use your Spro API key.

Both auth styles are accepted, so nothing about your headers needs to change:

  • x-api-key: spro-xxxxxxxx — what the Anthropic SDK sends natively
  • Authorization: Bearer spro-xxxxxxxx — the OpenAI-style header

What changes

Only two values:

from anthropic import Anthropic
client = Anthropic(    base_url="https://spro.hridaai.com/v1",  # was https://api.anthropic.com    api_key="YOUR_SPRO_API_KEY",             # your Spro key, starts with spro-)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({  baseURL: "https://spro.hridaai.com/v1",  // was https://api.anthropic.com  apiKey: "YOUR_SPRO_API_KEY",             // your Spro key, starts with spro-});

The one thing to know: model names. Use provider-prefixed model IDs — anthropic/claude-sonnet-4, openai/gpt-oss-120b, google/gemini-2.5-flash — or a plain model name for automatic routing. See Models.

Example: create a message

from anthropic import Anthropic
client = Anthropic(    base_url="https://spro.hridaai.com/v1",    api_key="YOUR_SPRO_API_KEY",)
message = client.messages.create(    model="anthropic/claude-sonnet-4",    max_tokens=1024,    system="You are a helpful assistant.",    messages=[        {"role": "user", "content": "What is the capital of France?"}    ],)
print(message.content[0].text)

Example: streaming

stream=True works unchanged — Anthropic SSE events (message_start, content_block_delta, message_stop) are forwarded as-is:

with client.messages.stream(    model="anthropic/claude-sonnet-4",    max_tokens=1024,    messages=[{"role": "user", "content": "Write a haiku about routing"}],) as stream:    for text in stream.text_stream:        print(text, end="", flush=True)

Example: tool use

Tools follow the native Anthropic format — no normalization needed:

message = client.messages.create(    model="anthropic/claude-sonnet-4",    max_tokens=1024,    tools=[        {            "name": "get_weather",            "description": "Get the current weather for a city.",            "input_schema": {                "type": "object",                "properties": {"city": {"type": "string"}},                "required": ["city"],            },        }    ],    messages=[{"role": "user", "content": "What's the weather in Paris?"}],)

One client, every provider

The best part: the same Anthropic client can call models from any provider in the catalog — Spro normalizes the request on the way in and the response on the way out:

# Claude, through the Anthropic SDKclient.messages.create(model="anthropic/claude-sonnet-4", ...)
# GPT and Gemini, through the same clientclient.messages.create(model="openai/gpt-oss-120b", ...)client.messages.create(model="google/gemini-2.5-flash", ...)

Every call gets the same guardrails, usage tracking, and BYOK/managed key resolution.

Migrating from the Anthropic API directly?

See Migrate from Direct Providers — or if you'd rather standardize on the OpenAI SDK across all providers, see OpenAI SDK Compatibility.

What's Next