Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

docs fix

Ishaan Jaffer28a90031033f
diff --git a/docs/my-website/docs/providers/anthropic_tool_search.md b/docs/my-website/docs/providers/anthropic_tool_search.md
index de4bc588837..b2a60a23f65 100644
--- a/docs/my-website/docs/providers/anthropic_tool_search.md
+++ b/docs/my-website/docs/providers/anthropic_tool_search.md
@@ -231,15 +231,16 @@ model_list:
#### Client Request
```python showLineNumbers title="Client Request via Proxy"
-import openai
+from anthropic import Anthropic
-client = openai.OpenAI(
+client = Anthropic(
api_key="your-litellm-proxy-key",
base_url="http://0.0.0.0:4000"
)
-response = client.chat.completions.create(
+response = client.messages.create(
model="claude-sonnet",
+ max_tokens=1024,
messages=[
{"role": "user", "content": "What's the weather?"}
],
@@ -249,17 +250,14 @@ response = client.chat.completions.create(
"name": "tool_search_tool_regex"
},
{
- "type": "function",
- "function": {
- "name": "get_weather",
- "description": "Get weather information",
- "parameters": {
- "type": "object",
- "properties": {
- "location": {"type": "string"}
- },
- "required": ["location"]
- }
+ "name": "get_weather",
+ "description": "Get weather information",
+ "input_schema": {
+ "type": "object",
+ "properties": {
+ "location": {"type": "string"}
+ },
+ "required": ["location"]
},
"defer_loading": True
}
@@ -496,45 +494,44 @@ model_list:
#### Client Request
```python showLineNumbers title="Client Request via Proxy (Messages API)"
-import httpx
-
-async with httpx.AsyncClient() as client:
- response = await client.post(
- "http://0.0.0.0:4000/anthropic/v1/messages",
- headers={
- "Authorization": "Bearer your-litellm-proxy-key",
- "anthropic-beta": "advanced-tool-use-2025-11-20"
+from anthropic import Anthropic
+
+client = Anthropic(
+ api_key="your-litellm-proxy-key",
+ base_url="http://0.0.0.0:4000"
+)
+
+response = client.messages.create(
+ model="claude-sonnet-messages",
+ max_tokens=1024,
+ messages=[
+ {
+ "role": "user",
+ "content": "What's the weather?"
+ }
+ ],
+ tools=[
+ {
+ "type": "tool_search_tool_regex_20251119",
+ "name": "tool_search_tool_regex"
},
- json={
- "model": "claude-sonnet-messages",
- "messages": [
- {
- "role": "user",
- "content": "What's the weather?"
- }
- ],
- "tools": [
- {
- "type": "tool_search_tool_regex_20251119",
- "name": "tool_search_tool_regex"
+ {
+ "name": "get_weather",
+ "description": "Get weather information",
+ "input_schema": {
+ "type": "object",
+ "properties": {
+ "location": {"type": "string"}
},
- {
- "name": "get_weather",
- "description": "Get weather information",
- "input_schema": {
- "type": "object",
- "properties": {
- "location": {"type": "string"}
- },
- "required": ["location"]
- },
- "defer_loading": True
- }
- ],
- "max_tokens": 1024
+ "required": ["location"]
+ },
+ "defer_loading": True
}
- )
- print(response.json())
+ ],
+ extra_headers={"anthropic-beta": "advanced-tool-use-2025-11-20"}
+)
+
+print(response)
```
---