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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
import json
from typing import Final
from unittest.mock import ANY
from integration.translation.case import TranslationTestCase
from integration.translation.responses.templates import RESPONSES_REQUEST, RESPONSES_RESPONSE
from integration.translation.templates.anthropic import ANTHROPIC_MESSAGES_REQUEST, ANTHROPIC_MESSAGES_RESPONSE
CLAUDE_HAIKU_4_5_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={
"model": "azure_ai/claude-haiku-4-5",
"max_output_tokens": 64,
"instructions": "You are a terse assistant.",
"input": "Say hello.",
"cache": {"no-cache": True},
},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
"model": "claude-haiku-4-5",
"messages": [{"role": "user", "content": [{"type": "text", "text": "Say hello."}]}],
"max_tokens": 64,
"system": [{"type": "text", "text": "You are a terse assistant."}],
},
mock_provider_response={
"model": "claude-haiku-4-5-20251001",
"id": "msg_011Cg7vB393hLWW1Xxq6d6vm",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello."}],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 17,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 5,
"service_tier": "standard",
"inference_geo": "not_available",
"speed": "standard",
},
"diagnostics": None,
},
expected_litellm_response={
"id": ANY,
"created_at": ANY,
"error": None,
"incomplete_details": None,
"instructions": "You are a terse assistant.",
"metadata": {},
"model": "azure_ai/claude-haiku-4-5",
"object": "response",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello.", "annotations": []}],
"phase": None,
}
],
"parallel_tool_calls": False,
"temperature": None,
"tool_choice": "auto",
"tools": [],
"top_p": None,
"max_output_tokens": 64,
"previous_response_id": None,
"reasoning": None,
"status": "completed",
"text": {},
"truncation": None,
"usage": {
"input_tokens": 17,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 17,
"video_tokens": None,
"cache_write_tokens": 0,
},
"output_tokens": 5,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 5},
"total_tokens": 22,
"cost": None,
},
"user": None,
"store": None,
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)
CLAUDE_SONNET_4_6_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={
"model": "azure_ai/claude-sonnet-4-6",
"max_output_tokens": 64,
"instructions": "You are a terse assistant.",
"input": "Say hello.",
"cache": {"no-cache": True},
},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": [{"type": "text", "text": "Say hello."}]}],
"max_tokens": 64,
"system": [{"type": "text", "text": "You are a terse assistant."}],
},
mock_provider_response={
"model": "claude-sonnet-4-6",
"id": "msg_011Cg7vCAx8gxwjwBr2R1kxz",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello!"}],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 18,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 5,
"service_tier": "standard",
"inference_geo": "not_available",
"speed": "standard",
},
"diagnostics": None,
},
expected_litellm_response={
"id": ANY,
"created_at": ANY,
"error": None,
"incomplete_details": None,
"instructions": "You are a terse assistant.",
"metadata": {},
"model": "azure_ai/claude-sonnet-4-6",
"object": "response",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello!", "annotations": []}],
"phase": None,
}
],
"parallel_tool_calls": False,
"temperature": None,
"tool_choice": "auto",
"tools": [],
"top_p": None,
"max_output_tokens": 64,
"previous_response_id": None,
"reasoning": None,
"status": "completed",
"text": {},
"truncation": None,
"usage": {
"input_tokens": 18,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 18,
"video_tokens": None,
"cache_write_tokens": 0,
},
"output_tokens": 5,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 5},
"total_tokens": 23,
"cost": None,
},
"user": None,
"store": None,
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)
CLAUDE_SONNET_5_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={
"model": "azure_ai/claude-sonnet-5",
"max_output_tokens": 64,
"instructions": "You are a terse assistant.",
"input": "Say hello.",
"cache": {"no-cache": True},
},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": [{"type": "text", "text": "Say hello."}]}],
"max_tokens": 64,
"system": [{"type": "text", "text": "You are a terse assistant."}],
},
mock_provider_response={
"model": "claude-sonnet-5",
"id": "msg_011CfjaxuLcxiEd4m9YZqXaA",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello."}],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 21,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 6,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "not_available",
},
"diagnostics": None,
},
expected_litellm_response={
"id": ANY,
"created_at": ANY,
"error": None,
"incomplete_details": None,
"instructions": "You are a terse assistant.",
"metadata": {},
"model": "azure_ai/claude-sonnet-5",
"object": "response",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello.", "annotations": []}],
"phase": None,
}
],
"parallel_tool_calls": False,
"temperature": None,
"tool_choice": "auto",
"tools": [],
"top_p": None,
"max_output_tokens": 64,
"previous_response_id": None,
"reasoning": None,
"status": "completed",
"text": {},
"truncation": None,
"usage": {
"input_tokens": 21,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 21,
"video_tokens": None,
"cache_write_tokens": 0,
},
"output_tokens": 6,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 6},
"total_tokens": 27,
"cost": None,
},
"user": None,
"store": None,
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)
CLAUDE_OPUS_4_8_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={
"model": "azure_ai/claude-opus-4-8",
"max_output_tokens": 64,
"instructions": "You are a terse assistant.",
"input": "Say hello.",
"cache": {"no-cache": True},
},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
"model": "claude-opus-4-8",
"messages": [{"role": "user", "content": [{"type": "text", "text": "Say hello."}]}],
"max_tokens": 64,
"system": [{"type": "text", "text": "You are a terse assistant."}],
},
mock_provider_response={
"model": "claude-opus-4-8",
"id": "msg_011Cg7vBUGeH2HFZFTDxVdBh",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello."}],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 21,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 6,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "global",
"speed": "standard",
},
"diagnostics": None,
},
expected_litellm_response={
"id": ANY,
"created_at": ANY,
"error": None,
"incomplete_details": None,
"instructions": "You are a terse assistant.",
"metadata": {},
"model": "azure_ai/claude-opus-4-8",
"object": "response",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello.", "annotations": []}],
"phase": None,
}
],
"parallel_tool_calls": False,
"temperature": None,
"tool_choice": "auto",
"tools": [],
"top_p": None,
"max_output_tokens": 64,
"previous_response_id": None,
"reasoning": None,
"status": "completed",
"text": {},
"truncation": None,
"usage": {
"input_tokens": 21,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 21,
"video_tokens": None,
"cache_write_tokens": 0,
},
"output_tokens": 6,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 6},
"total_tokens": 27,
"cost": None,
},
"user": None,
"store": None,
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)
CLAUDE_SONNET_5_5_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={
"model": "azure_ai/claude-sonnet-5-5",
"max_output_tokens": 64,
"instructions": "You are a terse assistant.",
"input": "Say hello.",
"cache": {"no-cache": True},
},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": [{"type": "text", "text": "Say hello."}]}],
"max_tokens": 64,
"system": [{"type": "text", "text": "You are a terse assistant."}],
},
mock_provider_response={
"model": "claude-sonnet-5-5",
"id": "msg_011CfjayBjr8GfdBPi3hbif2",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello."}],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 23,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 6,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "not_available",
},
"diagnostics": None,
},
expected_litellm_response={
"id": ANY,
"created_at": ANY,
"error": None,
"incomplete_details": None,
"instructions": "You are a terse assistant.",
"metadata": {},
"model": "azure_ai/claude-sonnet-5-5",
"object": "response",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello.", "annotations": []}],
"phase": None,
}
],
"parallel_tool_calls": False,
"temperature": None,
"tool_choice": "auto",
"tools": [],
"top_p": None,
"max_output_tokens": 64,
"previous_response_id": None,
"reasoning": None,
"status": "completed",
"text": {},
"truncation": None,
"usage": {
"input_tokens": 23,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 23,
"video_tokens": None,
"cache_write_tokens": 0,
},
"output_tokens": 6,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 6},
"total_tokens": 29,
"cost": None,
},
"user": None,
"store": None,
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)
CLAUDE_OPUS_5_5_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={
"model": "azure_ai/claude-opus-5-5",
"max_output_tokens": 64,
"instructions": "You are a terse assistant.",
"input": "Say hello.",
"cache": {"no-cache": True},
},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
"model": "claude-opus-5-5",
"messages": [{"role": "user", "content": [{"type": "text", "text": "Say hello."}]}],
"max_tokens": 64,
"system": [{"type": "text", "text": "You are a terse assistant."}],
},
mock_provider_response={
"model": "claude-opus-5-5",
"id": "msg_011CfjayXnc5jLujSNNoJpS2",
"type": "message",
"role": "assistant",
"content": [{"type": "text", "text": "Hello."}],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 23,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 6,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "not_available",
},
"diagnostics": None,
},
expected_litellm_response={
"id": ANY,
"created_at": ANY,
"error": None,
"incomplete_details": None,
"instructions": "You are a terse assistant.",
"metadata": {},
"model": "azure_ai/claude-opus-5-5",
"object": "response",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "Hello.", "annotations": []}],
"phase": None,
}
],
"parallel_tool_calls": False,
"temperature": None,
"tool_choice": "auto",
"tools": [],
"top_p": None,
"max_output_tokens": 64,
"previous_response_id": None,
"reasoning": None,
"status": "completed",
"text": {},
"truncation": None,
"usage": {
"input_tokens": 23,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 23,
"video_tokens": None,
"cache_write_tokens": 0,
},
"output_tokens": 6,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 6},
"total_tokens": 29,
"cost": None,
},
"user": None,
"store": None,
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)
CLAUDE_HAIKU_5_5_THINKING_SIGNATURE_0: Final = (
"CAQShAYKEAgSGAI4AUIIdGhpbmtpbmcSDEZBSweh3n+zsTFBbxoMzZxq5YKILAjNCjcbIjA/E3kpf/AnHsoj/+k5/+kv+0Zyyl0oHryOrbao"
"+0ht+2v/fbBUPGLQ38xdnNmiFE4qoQXePJCj6Q5is8kKxhEYNop4kKbvzRimV2ER8yql54QSaKONKuCgt0W52r1s0b+7iLw+P2Le5sju8XVy"
"9/c9h06rqUQu2ALeRsVDdTecLqPBWdfLtuePuMrRmLBDNERphdLekxUr9ABAFts/hhybR/HLiDSMkj08Axp+45skaChj7TPaGAQVg/dw7cWi"
"QSA4atcKZk+CfkUu955LX6qaDRoNUOAC4i15y4VbfForUdVk7LBgvI4ynDZ0L4lAtwSIcfNj7sCBY6zyPAD/POQkuTo2jm2UtbMVx4bC6+Ci"
"B6hAtvmA/MY6iIVUTGtordaFtKFcc8hTgr4uya2jeOp1pGN9dmABK2U4wIbyeCiYhJYskqQiVH3Va82hIHkg9oJvc4/4TMLT6nhmuaBsR9Eo"
"8VgFlwmkw9gXF+8FMD/rPdwLjr7aHvyNDe2gW9YxEaiHk5g0ldtyRPj5hLZpMX4CJ1Uqjf2k5LJ5kXljJihoT5/Je516iVPoA0V7alAr1dOY"
"Dxfajmd2o16yOrmJox/BwUGGqh4kPTgaavIKMWNwjaSeGTmd+pccQt4aKEzIk+X/Cst1UOS0vVVGdu/Z0q7MyrRMbfkne8B0i1lPRVhNtNwb"
"32fig40YgYmLIagkHA+jXhBxvLUaB5Xj/TtEMXe6ZVdq7A3fJ72baBTcDQ5uXW4yd0G12QrFEaA2TGt8PNZsA2/G1ZW/iU6oZZIKx5o7Sgeg"
"KNQk/tdXeS3cru7/bIlO6jMaGhYjDn3g42XKj16i6ri5WUVrrFeXq8Oq2Oh3IGIw+tL9RVf/lI/vp487EJcnMPiwWYeuIRwyyN8x/XiudCeE"
"S8mAFwadQyCUHYyeOr/a2tRXwx0o0/lpXb4htqEZHdkOJmXtlR4Whda4NrzO7utcGAE="
)
CLAUDE_HAIKU_5_5_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={**RESPONSES_REQUEST, "model": "azure_ai/claude-haiku-5-5"},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
**ANTHROPIC_MESSAGES_REQUEST,
"model": "claude-haiku-5-5",
"system": [
{
"type": "text",
"text": "You help maintain a synthetic Python project. Read the relevant files before "
"suggesting a fix. Explain which file you need next, then call a read-only tool. "
"Never change files. Use the responses client for this project review. Consider zero, "
"negative and non-integer quantities before choosing the next file to inspect.",
}
],
},
mock_provider_response={
**ANTHROPIC_MESSAGES_RESPONSE,
"model": "claude-haiku-5-5",
"id": "msg_011Cg37NSjwYJSDCvonTBaww",
"content": [
{
"type": "thinking",
"thinking": "I need to look at shop/validation.py to understand its contents, so I'll read "
"through the first chunk of the file.\n\n",
"signature": CLAUDE_HAIKU_5_5_THINKING_SIGNATURE_0,
},
{
"type": "text",
"text": "I'll read `shop/validation.py`, starting with the `validate_quantity` function found "
"in the search.",
},
{
"type": "tool_use",
"id": "toolu_01NiAAsMCJRXggv46Zro96cN",
"name": "read_file",
"input": {"path": "shop/validation.py", "start_line": 1, "end_line": 60},
"caller": {"type": "direct"},
},
],
"usage": {
"input_tokens": 4,
"cache_creation_input_tokens": 873,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 873, "ephemeral_1h_input_tokens": 0},
"output_tokens": 205,
"output_tokens_details": {"thinking_tokens": 73},
"service_tier": "standard",
"inference_geo": "global",
"speed": "standard",
},
},
expected_litellm_response={
**RESPONSES_RESPONSE,
"model": "azure_ai/claude-haiku-5-5",
"output": [
{
"type": "reasoning",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "I need to look at shop/validation.py to understand its contents, so I'll read "
"through the first chunk of the file.\n\n",
"annotations": [],
}
],
"phase": None,
"encrypted_content": json.dumps(
[
{
"type": "thinking",
"thinking": "I need to look at shop/validation.py to understand its contents, so I'll read "
"through the first chunk of the file.\n\n",
"signature": CLAUDE_HAIKU_5_5_THINKING_SIGNATURE_0,
}
],
separators=(",", ":"),
),
},
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "I'll read `shop/validation.py`, starting with the `validate_quantity` function found "
"in the search.",
"annotations": [],
}
],
"phase": None,
},
{
"arguments": '{"path": "shop/validation.py", "start_line": 1, "end_line": 60}',
"call_id": "toolu_01NiAAsMCJRXggv46Zro96cN",
"name": "read_file",
"type": "function_call",
"id": "fc_toolu_01NiAAsMCJRXggv46Zro96cN",
"namespace": None,
"status": "completed",
},
],
"usage": {
"input_tokens": 877,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 4,
"video_tokens": None,
"cache_write_tokens": 873,
},
"output_tokens": 205,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 73, "text_tokens": 132},
"total_tokens": 1082,
"cost": None,
},
"provider_specific_fields": {
"citations": None,
"thinking_blocks": [
{
"type": "thinking",
"thinking": "I need to look at shop/validation.py to understand its contents, so I'll read "
"through the first chunk of the file.\n\n",
"signature": CLAUDE_HAIKU_5_5_THINKING_SIGNATURE_0,
}
],
},
},
)
CLAUDE_FABLE_5_1_TEST_CASE: Final = TranslationTestCase(
scenario="basic",
litellm_endpoint="/v1/responses",
litellm_request={**RESPONSES_REQUEST, "model": "azure_ai/claude-fable-5-1"},
expected_provider_endpoint="/anthropic/v1/messages",
expected_provider_headers={
"x-api-key": "synthetic-azure-ai-key",
"api-key": "synthetic-azure-ai-key",
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
expected_provider_request={
**ANTHROPIC_MESSAGES_REQUEST,
"model": "claude-fable-5-1",
"system": [
{
"type": "text",
"text": "You help maintain a synthetic Python project. Read the relevant files before "
"suggesting a fix. Explain which file you need next, then call a read-only tool. "
"Never change files. Use the responses client for this project review. Consider zero, "
"negative and non-integer quantities before choosing the next file to inspect.",
}
],
},
mock_provider_response={
**ANTHROPIC_MESSAGES_RESPONSE,
"model": "claude-fable-5-1",
"id": "msg_011Cg37P2hrNhVAyq9ahS7H9",
"content": [
{
"type": "text",
"text": "I'll read the validation function; reading the test file at the same time is "
"independent of it, so I'll fetch both now.",
},
{
"type": "tool_use",
"id": "toolu_01XZZ8P93YHKzXM5XGRZN7hs",
"name": "read_file",
"input": {"path": "shop/validation.py", "start_line": 1, "end_line": 40},
"caller": {"type": "direct"},
},
{
"type": "tool_use",
"id": "toolu_01MpgANqoXoBcnhnsz81Q4Q7",
"name": "read_file",
"input": {"path": "tests/test_validation.py", "start_line": 1, "end_line": 30},
"caller": {"type": "direct"},
},
],
"usage": {
"input_tokens": 4,
"cache_creation_input_tokens": 873,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 873, "ephemeral_1h_input_tokens": 0},
"output_tokens": 232,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "not_available",
"speed": "standard",
},
},
expected_litellm_response={
**RESPONSES_RESPONSE,
"model": "azure_ai/claude-fable-5-1",
"output": [
{
"type": "message",
"id": ANY,
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "I'll read the validation function; reading the test file at the same time is "
"independent of it, so I'll fetch both now.",
"annotations": [],
}
],
"phase": None,
},
{
"arguments": '{"path": "shop/validation.py", "start_line": 1, "end_line": 40}',
"call_id": "toolu_01XZZ8P93YHKzXM5XGRZN7hs",
"name": "read_file",
"type": "function_call",
"id": "fc_toolu_01XZZ8P93YHKzXM5XGRZN7hs",
"namespace": None,
"status": "completed",
},
{
"arguments": '{"path": "tests/test_validation.py", "start_line": 1, "end_line": 30}',
"call_id": "toolu_01MpgANqoXoBcnhnsz81Q4Q7",
"name": "read_file",
"type": "function_call",
"id": "fc_toolu_01MpgANqoXoBcnhnsz81Q4Q7",
"namespace": None,
"status": "completed",
},
],
"usage": {
"input_tokens": 877,
"input_tokens_details": {
"audio_tokens": None,
"cached_tokens": 0,
"cached_tokens_details": None,
"image_tokens": None,
"text_tokens": 4,
"video_tokens": None,
"cache_write_tokens": 873,
},
"output_tokens": 232,
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": 232},
"total_tokens": 1109,
"cost": None,
},
"provider_specific_fields": {"citations": None, "thinking_blocks": None},
},
)