From 93908e1349b9c539a3018e4af4cdb7180d84897a Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Wed, 24 Sep 2025 10:45:59 +0200 Subject: [PATCH] test: add claude sonnet 4 --- providertests/openrouter_test.go | 21 +++ ...i_tool_claude-sonnet-4_amazon-bedrock.yaml | 63 ++++++++ .../multi_tool_claude-sonnet-4_anthropic.yaml | 63 ++++++++ ...ti_tool_claude-sonnet-4_google-vertex.yaml | 63 ++++++++ .../europe.yaml | 63 ++++++++ .../global.yaml | 63 ++++++++ ...eaming_claude-sonnet-4_amazon-bedrock.yaml | 133 +++++++++++++++++ ...l_streaming_claude-sonnet-4_anthropic.yaml | 123 ++++++++++++++++ ...reaming_claude-sonnet-4_google-vertex.yaml | 131 +++++++++++++++++ .../europe.yaml | 131 +++++++++++++++++ .../global.yaml | 131 +++++++++++++++++ ...simple_claude-sonnet-4_amazon-bedrock.yaml | 33 +++++ .../simple_claude-sonnet-4_anthropic.yaml | 33 +++++ .../simple_claude-sonnet-4_google-vertex.yaml | 33 +++++ .../europe.yaml | 33 +++++ .../global.yaml | 33 +++++ ...eaming_claude-sonnet-4_amazon-bedrock.yaml | 48 ++++++ ...e_streaming_claude-sonnet-4_anthropic.yaml | 54 +++++++ ...reaming_claude-sonnet-4_google-vertex.yaml | 60 ++++++++ .../europe.yaml | 86 +++++++++++ .../global.yaml | 46 ++++++ .../tool_claude-sonnet-4_amazon-bedrock.yaml | 63 ++++++++ .../tool_claude-sonnet-4_anthropic.yaml | 63 ++++++++ .../tool_claude-sonnet-4_google-vertex.yaml | 63 ++++++++ .../europe.yaml | 63 ++++++++ .../global.yaml | 63 ++++++++ ...eaming_claude-sonnet-4_amazon-bedrock.yaml | 119 +++++++++++++++ ...l_streaming_claude-sonnet-4_anthropic.yaml | 121 ++++++++++++++++ ...reaming_claude-sonnet-4_google-vertex.yaml | 125 ++++++++++++++++ .../europe.yaml | 137 ++++++++++++++++++ .../global.yaml | 133 +++++++++++++++++ 31 files changed, 2394 insertions(+) create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_amazon-bedrock.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_anthropic.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/europe.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/global.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_amazon-bedrock.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_anthropic.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/europe.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/global.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_amazon-bedrock.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_anthropic.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/europe.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/global.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_amazon-bedrock.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_anthropic.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/europe.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/global.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_amazon-bedrock.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_anthropic.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/europe.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/global.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_amazon-bedrock.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_anthropic.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/europe.yaml create mode 100644 providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/global.yaml diff --git a/providertests/openrouter_test.go b/providertests/openrouter_test.go index 8bb368c46194b3e72fa2349e59ec0a8fcdd232bc..0f3b68266bcddc3a6ba071c085c372c9b7ba8607 100644 --- a/providertests/openrouter_test.go +++ b/providertests/openrouter_test.go @@ -21,6 +21,7 @@ func TestOpenRouterCommon(t *testing.T) { models := []openrouterModel{ kimiK2(), grokCodeFast1(), + claudeSonnet4(), } for _, model := range models { @@ -85,3 +86,23 @@ func grokCodeFast1() openrouterModel { }, } } + +func claudeSonnet4() openrouterModel { + return openrouterModel{ + name: "claude-sonnet-4", + builderFunc: func(r *recorder.Recorder) (ai.LanguageModel, error) { + provider := openrouter.New( + openrouter.WithAPIKey(os.Getenv("OPENROUTER_API_KEY")), + openrouter.WithHTTPClient(&http.Client{Transport: r}), + ) + return provider.LanguageModel("anthropic/claude-sonnet-4") + }, + providers: []string{ + "google-vertex", + "google-vertex/global", + "anthropic", + "google-vertex/europe", + "amazon-bedrock", + }, + } +} diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_amazon-bedrock.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_amazon-bedrock.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c1bb0fc08899e0f83dee1cbdae5467214aadcec0 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_amazon-bedrock.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 877 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703529-ZmfakQzYpIkbRFyjUga0\",\"provider\":\"Amazon Bedrock\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703530,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll add and multiply the numbers 2 and 3 for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_bdrk_013934jsFfSCuMPgmnqh3z9z\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"add\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}},{\"id\":\"toolu_bdrk_01CfkhzzfyWsW37jfiZpQ88i\",\"index\":1,\"type\":\"function\",\"function\":{\"name\":\"multiply\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}}]}}],\"usage\":{\"prompt_tokens\":502,\"completion_tokens\":137,\"total_tokens\":639,\"cost\":0.003561,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001506,\"upstream_inference_completions_cost\":0.002055},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.485876875s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1395 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_bdrk_013934jsFfSCuMPgmnqh3z9z","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_bdrk_01CfkhzzfyWsW37jfiZpQ88i","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_bdrk_013934jsFfSCuMPgmnqh3z9z","role":"tool"},{"content":"6","tool_call_id":"toolu_bdrk_01CfkhzzfyWsW37jfiZpQ88i","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703533-IIg4Ym3Dkj1ac59khY8H\",\"provider\":\"Amazon Bedrock\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703533,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The results are:\\n- 2 + 3 = 5\\n- 2 × 3 = 6\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":700,\"completion_tokens\":31,\"total_tokens\":731,\"cost\":0.002565,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.0021,\"upstream_inference_completions_cost\":0.000465},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.23777425s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_anthropic.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_anthropic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..58f3faef0872a09b1471de85127c18470def7200 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_anthropic.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 872 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703475-P2LpdTm5jRxcZoEKNiWU\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703475,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll add and multiply the numbers 2 and 3 for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01RLtnPkZjcn8LBw7DnzgXgc\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"add\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}},{\"id\":\"toolu_01N9pdWYSxvjPN9MqQrKJHkt\",\"index\":1,\"type\":\"function\",\"function\":{\"name\":\"multiply\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}}]}}],\"usage\":{\"prompt_tokens\":502,\"completion_tokens\":137,\"total_tokens\":639,\"cost\":0.003561,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001506,\"upstream_inference_completions_cost\":0.002055},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 3.666857417s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1370 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_01RLtnPkZjcn8LBw7DnzgXgc","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_01N9pdWYSxvjPN9MqQrKJHkt","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_01RLtnPkZjcn8LBw7DnzgXgc","role":"tool"},{"content":"6","tool_call_id":"toolu_01N9pdWYSxvjPN9MqQrKJHkt","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703479-wJyqyWVMv3t3IPeEEt2S\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703479,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The results are:\\n- 2 + 3 = 5\\n- 2 × 3 = 6\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":700,\"completion_tokens\":31,\"total_tokens\":731,\"cost\":0.002565,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.0021,\"upstream_inference_completions_cost\":0.000465},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.50687s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..76f613b8a05c41a8c8e7ec7a926903199d7096ed --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 876 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"usage":{"include":true},"provider":{"only":["google-vertex"]}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703425-d15SjY2ux8c2QzYi6TPn\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703425,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll add and multiply the numbers 2 and 3 for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01CWcnkmJC9pcFYgzPfiWJt1\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"add\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}},{\"id\":\"toolu_vrtx_01VEiBATDE9Ro1puyAzkSyzm\",\"index\":1,\"type\":\"function\",\"function\":{\"name\":\"multiply\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}}]}}],\"usage\":{\"prompt_tokens\":502,\"completion_tokens\":137,\"total_tokens\":639,\"cost\":0.003561,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001506,\"upstream_inference_completions_cost\":0.002055},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.956007208s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1394 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_vrtx_01CWcnkmJC9pcFYgzPfiWJt1","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_vrtx_01VEiBATDE9Ro1puyAzkSyzm","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_vrtx_01CWcnkmJC9pcFYgzPfiWJt1","role":"tool"},{"content":"6","tool_call_id":"toolu_vrtx_01VEiBATDE9Ro1puyAzkSyzm","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703428-NHecdMordMUFZv37xtMl\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703429,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The results are:\\n- Adding 2 + 3 = 5\\n- Multiplying 2 × 3 = 6\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":700,\"completion_tokens\":35,\"total_tokens\":735,\"cost\":0.002625,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.0021,\"upstream_inference_completions_cost\":0.000525},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.061811375s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/europe.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/europe.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b627faf9e4649b53eb42eaa52007358a297881f3 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/europe.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 883 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703503-8Q9qrqUvAu9QUAwulmjn\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703503,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll add and multiply the numbers 2 and 3 for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_013wNjkM9KQsrasC9AJL4DWS\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"add\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}},{\"id\":\"toolu_vrtx_016TcghY6tvnbsi5kJuoZodx\",\"index\":1,\"type\":\"function\",\"function\":{\"name\":\"multiply\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}}]}}],\"usage\":{\"prompt_tokens\":502,\"completion_tokens\":137,\"total_tokens\":639,\"cost\":0.003561,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001506,\"upstream_inference_completions_cost\":0.002055},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.461070292s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1401 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_vrtx_013wNjkM9KQsrasC9AJL4DWS","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_vrtx_016TcghY6tvnbsi5kJuoZodx","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_vrtx_013wNjkM9KQsrasC9AJL4DWS","role":"tool"},{"content":"6","tool_call_id":"toolu_vrtx_016TcghY6tvnbsi5kJuoZodx","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"usage":{"include":true},"provider":{"only":["google-vertex/europe"]}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703505-d4uGS0L6LB4xXh0BK8YC\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703505,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The results are:\\n- Adding 2 + 3 = 5\\n- Multiplying 2 × 3 = 6\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":700,\"completion_tokens\":35,\"total_tokens\":735,\"cost\":0.002625,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.0021,\"upstream_inference_completions_cost\":0.000525},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.445666375s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/global.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/global.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dbc38b48348d596512afc69f89cf365cc055938e --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_claude-sonnet-4_google-vertex/global.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 883 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703445-QkUFYGWcvZu3vyW94D6Q\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703445,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll add and multiply the numbers 2 and 3 for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01SoK6DtD4CqT7dKoa3x1B85\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"add\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}},{\"id\":\"toolu_vrtx_01MmfQ8Y1yrWJPkm41251xJd\",\"index\":1,\"type\":\"function\",\"function\":{\"name\":\"multiply\",\"arguments\":\"{\\\"a\\\": 2, \\\"b\\\": 3}\"}}]}}],\"usage\":{\"prompt_tokens\":502,\"completion_tokens\":137,\"total_tokens\":639,\"cost\":0.003561,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001506,\"upstream_inference_completions_cost\":0.002055},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.023703791s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1401 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_vrtx_01SoK6DtD4CqT7dKoa3x1B85","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_vrtx_01MmfQ8Y1yrWJPkm41251xJd","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_vrtx_01SoK6DtD4CqT7dKoa3x1B85","role":"tool"},{"content":"6","tool_call_id":"toolu_vrtx_01MmfQ8Y1yrWJPkm41251xJd","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703447-VGZedsPlwY5BjItxJplx\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703447,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The results are:\\n- 2 + 3 = 5\\n- 2 × 3 = 6\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":700,\"completion_tokens\":31,\"total_tokens\":731,\"cost\":0.002565,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.0021,\"upstream_inference_completions_cost\":0.000465},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.63970575s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_amazon-bedrock.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_amazon-bedrock.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1436ff46cd1d69786a91ea03c4199223182ecd6e --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_amazon-bedrock.yaml @@ -0,0 +1,133 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 931 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"I","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"'ll","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":" add and multiply the","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":" numbers","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":" 2 an","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"d 3 for","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":" you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_bdrk_01K7wpQi9Yovsdmi5etWgAFd","index":0,"type":"function","function":{"name":"add","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":", \"b\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_bdrk_01Am4YPKG82JDEaf5fgMVRLM","index":1,"type":"function","function":{"name":"multiply","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"{\"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":", \"b\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703536-4vhJkPCJGMrh5CnnHJ3L","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703536,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":502,"completion_tokens":137,"total_tokens":639,"cost":0.003561,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001506,"upstream_inference_completions_cost":0.002055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.659447667s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1449 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_bdrk_01K7wpQi9Yovsdmi5etWgAFd","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_bdrk_01Am4YPKG82JDEaf5fgMVRLM","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_bdrk_01K7wpQi9Yovsdmi5etWgAFd","role":"tool"},{"content":"6","tool_call_id":"toolu_bdrk_01Am4YPKG82JDEaf5fgMVRLM","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"usage":{"include":true},"provider":{"only":["amazon-bedrock"]},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"The","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":" results","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":" are","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n- ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"2 + 3 = ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"5\n- 2 × ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"3 = 6","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703538-BPO0LDwyWlmhK6TiUTV2","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703538,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":700,"completion_tokens":31,"total_tokens":731,"cost":0.002565,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0021,"upstream_inference_completions_cost":0.000465},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.371419125s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_anthropic.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_anthropic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4fe71c7d6ef5822b405d5d79334b9fd5fcea4591 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_anthropic.yaml @@ -0,0 +1,123 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 926 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll add an","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"d multiply the numbers 2 and 3 for","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":" you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_017ez6Y11aFqR8qmZrK7Btae","index":0,"type":"function","function":{"name":"add","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":", \"b\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_019WhQ1ADmF3pqwZB7JowE1A","index":1,"type":"function","function":{"name":"multiply","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"{\"a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":", \"b\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":" 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703483-LOuy7QTH8TDyNbgY30TV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703483,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":502,"completion_tokens":137,"total_tokens":639,"cost":0.003561,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001506,"upstream_inference_completions_cost":0.002055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.673370291s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1424 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_017ez6Y11aFqR8qmZrK7Btae","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_019WhQ1ADmF3pqwZB7JowE1A","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_017ez6Y11aFqR8qmZrK7Btae","role":"tool"},{"content":"6","tool_call_id":"toolu_019WhQ1ADmF3pqwZB7JowE1A","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"The","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":" results are:\n- Adding 2 and 3: **","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"5**\n- Multiplying 2 and 3: **6","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"**","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703487-phKFalHgfAT2v5vbd7KB","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":700,"completion_tokens":35,"total_tokens":735,"cost":0.002625,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0021,"upstream_inference_completions_cost":0.000525},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.686955208s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c389068c0467683435d0be3c56339d7623a120df --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex.yaml @@ -0,0 +1,131 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 930 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll add an","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"d multiply the numbers","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":" 2 and 3 for","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":" you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_01DnmZCpDRnkL5Vr8MhcYtS9","index":0,"type":"function","function":{"name":"add","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":", \"b"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_0116gPZpAB1R3ic89xkD3X7f","index":1,"type":"function","function":{"name":"multiply","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"{\"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":", "}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"\"b\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703430-Rk2SW4cOp81eByfgrDeu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703430,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":502,"completion_tokens":137,"total_tokens":639,"cost":0.003561,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001506,"upstream_inference_completions_cost":0.002055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.211935542s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1448 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_vrtx_01DnmZCpDRnkL5Vr8MhcYtS9","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_vrtx_0116gPZpAB1R3ic89xkD3X7f","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_vrtx_01DnmZCpDRnkL5Vr8MhcYtS9","role":"tool"},{"content":"6","tool_call_id":"toolu_vrtx_0116gPZpAB1R3ic89xkD3X7f","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"The","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":" results are","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n- ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"2 + 3 = ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"5\n- 2 × ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"3 = 6","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703432-un1Z1u4sB9njqU92TwRC","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703432,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":700,"completion_tokens":31,"total_tokens":731,"cost":0.002565,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0021,"upstream_inference_completions_cost":0.000465},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.828443167s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/europe.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/europe.yaml new file mode 100644 index 0000000000000000000000000000000000000000..722ea41657c973bf61e908305808403c761f022f --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/europe.yaml @@ -0,0 +1,131 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 937 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll add an","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"d multiply the","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":" numbers","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":" 2 and 3 for","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":" you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_014BnWyeLJKnwd8vwN2Tqb1P","index":0,"type":"function","function":{"name":"add","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"a\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":", \"b\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_014kjgdkPQosBq4VdJzKeBhS","index":1,"type":"function","function":{"name":"multiply","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"{\"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":", \"b\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703507-qvBSOm5047lKGDodXLIc","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703507,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":502,"completion_tokens":137,"total_tokens":639,"cost":0.003561,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001506,"upstream_inference_completions_cost":0.002055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.564185917s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1455 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_vrtx_014BnWyeLJKnwd8vwN2Tqb1P","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_vrtx_014kjgdkPQosBq4VdJzKeBhS","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_vrtx_014BnWyeLJKnwd8vwN2Tqb1P","role":"tool"},{"content":"6","tool_call_id":"toolu_vrtx_014kjgdkPQosBq4VdJzKeBhS","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"The results","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":" are","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n- ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"2 + 3 = ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"5\n- 2 × ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"3 = 6","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703510-FwkwEiXpP6XDMIhz6pBL","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703510,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":700,"completion_tokens":31,"total_tokens":731,"cost":0.002565,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0021,"upstream_inference_completions_cost":0.000465},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.661794166s diff --git a/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/global.yaml b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/global.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f084d148e6af266b8a62a7be8433e85d19edb268 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/multi_tool_streaming_claude-sonnet-4_google-vertex/global.yaml @@ -0,0 +1,131 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 937 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll add an","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"d multiply the numbers","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":" 2 and 3 for","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":" you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_01SHr5ifKaWhjY1X96UmUrYz","index":0,"type":"function","function":{"name":"add","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":", \"b"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\": "}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_013eyJswYZfviqphDrSVgvDC","index":1,"type":"function","function":{"name":"multiply","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":"{\"a\": 2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"type":"function","function":{"arguments":", \"b\": 3}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703449-yeZI523TurVN5Lz44q5X","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703449,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":502,"completion_tokens":137,"total_tokens":639,"cost":0.003561,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001506,"upstream_inference_completions_cost":0.002055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.428779375s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 1455 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant. Always use both add and multiply at the same time.","role":"system"},{"content":"Add and multiply the number 2 and 3","role":"user"},{"content":"I''ll add and multiply the numbers 2 and 3 for you.","tool_calls":[{"id":"toolu_vrtx_01SHr5ifKaWhjY1X96UmUrYz","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"add"},"type":"function"},{"id":"toolu_vrtx_013eyJswYZfviqphDrSVgvDC","function":{"arguments":"{\"a\": 2, \"b\": 3}","name":"multiply"},"type":"function"}],"role":"assistant"},{"content":"5","tool_call_id":"toolu_vrtx_01SHr5ifKaWhjY1X96UmUrYz","role":"tool"},{"content":"6","tool_call_id":"toolu_vrtx_013eyJswYZfviqphDrSVgvDC","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"add","strict":false,"description":"Add two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"},{"function":{"name":"multiply","strict":false,"description":"Multiply two numbers","parameters":{"properties":{"a":{"description":"first number","type":"integer"},"b":{"description":"second number","type":"integer"}},"required":["a","b"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"The","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":" results","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":" are:\n- ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"2 + 3 = ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"5\n- 2 × ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"3 = 6","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703452-Yj7CAUKZnhqzvljvzK2Q","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703452,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":700,"completion_tokens":31,"total_tokens":731,"cost":0.002565,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0021,"upstream_inference_completions_cost":0.000465},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.222145875s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_amazon-bedrock.yaml b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_amazon-bedrock.yaml new file mode 100644 index 0000000000000000000000000000000000000000..37e4dead9d0950f2b00f105ef77757d6804b5579 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_amazon-bedrock.yaml @@ -0,0 +1,33 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 239 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"provider":{"only":["amazon-bedrock"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703512-Gm4spW8xO5nbEhiclJq1\",\"provider\":\"Amazon Bedrock\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703513,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Olá!\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":16,\"completion_tokens\":7,\"total_tokens\":23,\"cost\":0.000153,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.000048,\"upstream_inference_completions_cost\":0.000105},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.448192541s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_anthropic.yaml b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_anthropic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4e067fd8cbe065219e424ec61857cc3db6815c95 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_anthropic.yaml @@ -0,0 +1,33 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 234 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"usage":{"include":true},"provider":{"only":["anthropic"]}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703454-UI2RCuSlPnY6RYEfhxoh\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703454,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Olá!\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":16,\"completion_tokens\":7,\"total_tokens\":23,\"cost\":0.000153,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.000048,\"upstream_inference_completions_cost\":0.000105},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.994516958s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex.yaml b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6e1015817d9bfff30cc78f62fabd5ad96987a704 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex.yaml @@ -0,0 +1,33 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 238 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"provider":{"only":["google-vertex"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703408-y7IKlbobhYKwJ6L3egiy\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703408,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Olá! \\n\\n(That's \\\"hi\\\" in Portuguese!)\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":16,\"completion_tokens\":18,\"total_tokens\":34,\"cost\":0.000318,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.000048,\"upstream_inference_completions_cost\":0.00027},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.225140833s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/europe.yaml b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/europe.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8d6c3caaad37af7d6ac94216199d1ce0f775e9c4 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/europe.yaml @@ -0,0 +1,33 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 245 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"provider":{"only":["google-vertex/europe"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703489-fCFoX3Q2TlwGqElD2Ukf\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703489,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Olá! (Hello!)\\n\\nOr you could also say \\\"Oi!\\\" which is a more casual way to say hi in Portuguese.\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":16,\"completion_tokens\":33,\"total_tokens\":49,\"cost\":0.000543,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.000048,\"upstream_inference_completions_cost\":0.000495},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.344501125s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/global.yaml b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/global.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5a1a17fd74e99f7af4e05e0013dc64028dc5ef2d --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_claude-sonnet-4_google-vertex/global.yaml @@ -0,0 +1,33 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 245 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"provider":{"only":["google-vertex/global"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n{\"id\":\"gen-1758703435-rmbIOBbD9iDRHTQ4CHjT\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703435,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Olá! \\n\\n(That's \\\"hi\\\" in Portuguese!)\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":16,\"completion_tokens\":18,\"total_tokens\":34,\"cost\":0.000318,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.000048,\"upstream_inference_completions_cost\":0.00027},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.191377875s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_amazon-bedrock.yaml b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_amazon-bedrock.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bf4f593d502ee10189a1875dfa6d78afd546b84f --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_amazon-bedrock.yaml @@ -0,0 +1,48 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 293 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"provider":{"only":["amazon-bedrock"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":"Olá! ","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n(That's \"hi\" in Portuguese!)","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703515-7P3UtpyYBMgVQX1Q7pDa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703515,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":16,"completion_tokens":18,"total_tokens":34,"cost":0.000318,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000048,"upstream_inference_completions_cost":0.00027},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.071447959s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_anthropic.yaml b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_anthropic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..047296e4d5340de3a0f9cfbf80ed2a309ca5c2c5 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_anthropic.yaml @@ -0,0 +1,54 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 288 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"provider":{"only":["anthropic"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"Olá!","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n(That's \"hello\" in Portuguese.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":" You could also say \"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"Oi!\" for a more casual \"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"hi!\")","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703457-azEEMuDqqKhlLMdpq4jl","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703457,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":16,"completion_tokens":33,"total_tokens":49,"cost":0.000543,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000048,"upstream_inference_completions_cost":0.000495},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.166245167s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex.yaml b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b27b9d8749ef6585388cfdf0421c07111ff15c55 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex.yaml @@ -0,0 +1,60 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 292 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"provider":{"only":["google-vertex"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"Olá! (","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"That's \"hi","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"\" in Portuguese)","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\nYou can also say","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":" \"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"Oi!\" which is a","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":" more casual way to say hi","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":" in Portuguese.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703410-VHZouOacr7dEmAytFMJv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703410,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":16,"completion_tokens":38,"total_tokens":54,"cost":0.000618,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000048,"upstream_inference_completions_cost":0.00057},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.17237075s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/europe.yaml b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/europe.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5b0fb79af66b83b7b0dfee75c1d295f9ca889fb6 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/europe.yaml @@ -0,0 +1,86 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 299 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"provider":{"only":["google-vertex/europe"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"Olá! (","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"Oh","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"-LA","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"H","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":")","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\nThis","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" is the","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" most common","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" way","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" to say \"hi\" in Portuguese.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" You","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" coul","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"d also use","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" \"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"Oi!\"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" (","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"OY","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":")","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" which","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" is more","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":" casual and friendly.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703491-ae2BWYa9Vz5ViELaIMv9","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703491,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":16,"completion_tokens":48,"total_tokens":64,"cost":0.000768,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000048,"upstream_inference_completions_cost":0.00072},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.528290833s diff --git a/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/global.yaml b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/global.yaml new file mode 100644 index 0000000000000000000000000000000000000000..77e796d5c888407ab03bbfb64ed0bb7ced897f3b --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/simple_streaming_claude-sonnet-4_google-vertex/global.yaml @@ -0,0 +1,46 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 299 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"Say hi in Portuguese","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"provider":{"only":["google-vertex/global"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703436-WC0BFNzETFmaPHLJTryv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703436,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703436-WC0BFNzETFmaPHLJTryv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703436,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703436-WC0BFNzETFmaPHLJTryv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703436,"choices":[{"index":0,"delta":{"role":"assistant","content":"Olá!","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703436-WC0BFNzETFmaPHLJTryv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703436,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703436-WC0BFNzETFmaPHLJTryv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703436,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703436-WC0BFNzETFmaPHLJTryv","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703436,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":16,"completion_tokens":7,"total_tokens":23,"cost":0.000153,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000048,"upstream_inference_completions_cost":0.000105},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.38509775s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_amazon-bedrock.yaml b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_amazon-bedrock.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e76f2803681ef24e70ebb12fab3078669bb9d0d9 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_amazon-bedrock.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 531 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703517-FBbA9Qwjylq5Vh2ttqNS\",\"provider\":\"Amazon Bedrock\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703518,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll get the current weather information for Florence, Italy for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_bdrk_01133QJCcK6yWJt13uwf1mGw\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"location\\\": \\\"Florence, Italy\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":394,\"completion_tokens\":68,\"total_tokens\":462,\"cost\":0.002202,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001182,\"upstream_inference_completions_cost\":0.00102},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.552577875s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 878 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the current weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_bdrk_01133QJCcK6yWJt13uwf1mGw","function":{"arguments":"{\"location\": \"Florence, Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_bdrk_01133QJCcK6yWJt13uwf1mGw","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703519-xZcWXhTZkzEEsnH8V01c\",\"provider\":\"Amazon Bedrock\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703520,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The current weather in Florence, Italy shows a temperature of 40°C (104°F). That's quite hot! If you're planning to visit or are currently there, make sure to stay hydrated and seek shade during the hottest parts of the day.\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":477,\"completion_tokens\":57,\"total_tokens\":534,\"cost\":0.002286,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001431,\"upstream_inference_completions_cost\":0.000855},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.387195833s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_anthropic.yaml b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_anthropic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a5b8bbaaa9f5de54ba036aacad35aa9760c85398 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_anthropic.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 526 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703460-rTzOvm2FJz6sthbubHKf\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703460,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll get the current weather information for Florence, Italy for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_01VpXHw245gvhY576DNBm4dA\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"location\\\": \\\"Florence, Italy\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":394,\"completion_tokens\":68,\"total_tokens\":462,\"cost\":0.002202,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001182,\"upstream_inference_completions_cost\":0.00102},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 3.289189458s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 863 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the current weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_01VpXHw245gvhY576DNBm4dA","function":{"arguments":"{\"location\": \"Florence, Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_01VpXHw245gvhY576DNBm4dA","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703464-xJ6ex0SApRHg2BL0FAFd\",\"provider\":\"Anthropic\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703464,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The current temperature in Florence, Italy is 40°C (104°F). That's quite hot! If you're planning to visit or are currently there, make sure to stay hydrated and seek shade during the hottest parts of the day.\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":477,\"completion_tokens\":54,\"total_tokens\":531,\"cost\":0.002241,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001431,\"upstream_inference_completions_cost\":0.00081},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 3.285610791s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex.yaml b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..111f370ef49cfd6327701c35c587c8b347687004 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 530 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"usage":{"include":true},"provider":{"only":["google-vertex"]}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703413-ERxe0D2fb24VfJZfTQbm\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703414,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll get the weather information for Florence, Italy for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01848AGdQVwuJai5pGHs1qLc\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"location\\\": \\\"Florence, Italy\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":394,\"completion_tokens\":67,\"total_tokens\":461,\"cost\":0.002187,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001182,\"upstream_inference_completions_cost\":0.001005},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.082400292s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 869 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_vrtx_01848AGdQVwuJai5pGHs1qLc","function":{"arguments":"{\"location\": \"Florence, Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_vrtx_01848AGdQVwuJai5pGHs1qLc","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703416-TQYUZitL5pOORy43S1V8\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703417,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The current temperature in Florence, Italy is 40°C (104°F). That's quite hot! It's a very warm day in Florence.\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":476,\"completion_tokens\":34,\"total_tokens\":510,\"cost\":0.001938,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001428,\"upstream_inference_completions_cost\":0.00051},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 2.168670042s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/europe.yaml b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/europe.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4207f2b7f68437fe89cb2fe08a83a4cbc25ef14a --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/europe.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 537 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703494-ENZenpXpStP7Gc4QpQtn\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703494,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll get the weather information for Florence, Italy for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01BcsiXWv3JrF1WBdpDCKLVg\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"location\\\": \\\"Florence,Italy\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":394,\"completion_tokens\":67,\"total_tokens\":461,\"cost\":0.002187,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001182,\"upstream_inference_completions_cost\":0.001005},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.529066208s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 875 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_vrtx_01BcsiXWv3JrF1WBdpDCKLVg","function":{"arguments":"{\"location\": \"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_vrtx_01BcsiXWv3JrF1WBdpDCKLVg","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703496-6VGPeVOMNdOl1x686mFY\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703496,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The current weather in Florence, Italy is 40°C (104°F). That's quite hot! It would be a good idea to stay hydrated and seek shade or air conditioning if you're planning to be outdoors.\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":476,\"completion_tokens\":50,\"total_tokens\":526,\"cost\":0.002178,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001428,\"upstream_inference_completions_cost\":0.00075},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.46968225s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/global.yaml b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/global.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4ab040b31cf8f1cce14dc0c5614984fc4d3c76c0 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_claude-sonnet-4_google-vertex/global.yaml @@ -0,0 +1,63 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 537 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n{\"id\":\"gen-1758703437-Uqs9OLONHyxiiapyhEWo\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703438,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"I'll get the weather information for Florence, Italy for you.\",\"refusal\":null,\"reasoning\":null,\"tool_calls\":[{\"id\":\"toolu_vrtx_01RU7jk5NKWkLSbVvZ44b62G\",\"index\":0,\"type\":\"function\",\"function\":{\"name\":\"weather\",\"arguments\":\"{\\\"location\\\": \\\"Florence,Italy\\\"}\"}}]}}],\"usage\":{\"prompt_tokens\":394,\"completion_tokens\":67,\"total_tokens\":461,\"cost\":0.002187,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001182,\"upstream_inference_completions_cost\":0.001005},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.028780958s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 875 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_vrtx_01RU7jk5NKWkLSbVvZ44b62G","function":{"arguments":"{\"location\": \"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_vrtx_01RU7jk5NKWkLSbVvZ44b62G","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"usage":{"include":true},"provider":{"only":["google-vertex/global"]}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + uncompressed: true + body: "\n \n\n \n\n \n\n \n{\"id\":\"gen-1758703439-5thSpZgRqsbt3xs7flBD\",\"provider\":\"Google\",\"model\":\"anthropic/claude-sonnet-4\",\"object\":\"chat.completion\",\"created\":1758703439,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"native_finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"The current weather in Florence, Italy is 40°C (104°F). That's quite hot! Make sure to stay hydrated and seek shade if you're planning to be outdoors.\",\"refusal\":null,\"reasoning\":null}}],\"usage\":{\"prompt_tokens\":476,\"completion_tokens\":43,\"total_tokens\":519,\"cost\":0.002073,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":null,\"upstream_inference_prompt_cost\":0.001428,\"upstream_inference_completions_cost\":0.000645},\"completion_tokens_details\":{\"reasoning_tokens\":0,\"image_tokens\":0}}}" + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 1.341619958s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_amazon-bedrock.yaml b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_amazon-bedrock.yaml new file mode 100644 index 0000000000000000000000000000000000000000..630723220087c1665d172e35a7e5acbfba3b82f4 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_amazon-bedrock.yaml @@ -0,0 +1,119 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 585 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll get the weather information","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":" for Florence, Italy for you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_bdrk_013pCiWByeyQJP6mCFLWb3y3","index":0,"type":"function","function":{"name":"weather","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"loca"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"tion\": \"F"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"lorence"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":",Ital"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"y\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703523-RvVV9U7LMp8PSHwBqyFa","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":394,"completion_tokens":67,"total_tokens":461,"cost":0.002187,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001182,"upstream_inference_completions_cost":0.001005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.730769417s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 923 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_bdrk_013pCiWByeyQJP6mCFLWb3y3","function":{"arguments":"{\"location\": \"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_bdrk_013pCiWByeyQJP6mCFLWb3y3","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["amazon-bedrock"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":"The current","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":" temperature in Florence, Italy is 40°","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":"C (104°F). That's quite","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":" hot! If you're planning to","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":" visit or are currently there, make sure to","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":" stay hydrated and seek shade during the hottest parts of the","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":" day.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703526-qwN9g0fFIE8IDXhx6MJO","provider":"Amazon Bedrock","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703527,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":476,"completion_tokens":54,"total_tokens":530,"cost":0.002238,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001428,"upstream_inference_completions_cost":0.00081},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.336130292s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_anthropic.yaml b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_anthropic.yaml new file mode 100644 index 0000000000000000000000000000000000000000..47534a34afba0ed7a36b8fbfcc571ac9db5fba1c --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_anthropic.yaml @@ -0,0 +1,121 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 580 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll get","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":" the weather information for Florence, Italy for you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_01GJYtQvdcS73pmDMzbEaxxo","index":0,"type":"function","function":{"name":"weather","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"location"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\": \"Flore"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"nce,I"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"taly"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703468-PZBsTS61Zv8dC4gFmkdP","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703468,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":394,"completion_tokens":67,"total_tokens":461,"cost":0.002187,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001182,"upstream_inference_completions_cost":0.001005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.985700666s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 908 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_01GJYtQvdcS73pmDMzbEaxxo","function":{"arguments":"{\"location\": \"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_01GJYtQvdcS73pmDMzbEaxxo","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["anthropic"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"The current","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":" weather in Florence, Italy shows","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":" a temperature of 40°C (","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"104°F). That's quite hot","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"! Make sure to","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":" stay hydrated and seek","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":" shade if you're planning","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":" to be outdoors.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703472-eEvBb5ewHGcTPuquejTV","provider":"Anthropic","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703472,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":476,"completion_tokens":46,"total_tokens":522,"cost":0.002118,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001428,"upstream_inference_completions_cost":0.00069},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.426378875s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex.yaml b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1323ec155331730dd53704a34d7c8bb64c4759f9 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex.yaml @@ -0,0 +1,125 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 584 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll get the weather information","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":" for Florence, Italy for you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_01KAtCYAhJncFvXBrmP8TvYj","index":0,"type":"function","function":{"name":"weather","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"location\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":": \"Flo"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"ren"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"ce,Italy\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703419-91uUKXxCtEVQul9RRUiN","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703419,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":394,"completion_tokens":67,"total_tokens":461,"cost":0.002187,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001182,"upstream_inference_completions_cost":0.001005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.208934459s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 922 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_vrtx_01KAtCYAhJncFvXBrmP8TvYj","function":{"arguments":"{\"location\": \"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_vrtx_01KAtCYAhJncFvXBrmP8TvYj","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"The","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":" current","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":" weather in Florence, Italy is 40","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"°C (104°F). That","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"'s quite","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":" hot! It","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"'s a","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":" very","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":" warm day in","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":" Florence","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":".","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703422-TIBE56DbHfmidVSPDzKu","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703423,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":476,"completion_tokens":34,"total_tokens":510,"cost":0.001938,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001428,"upstream_inference_completions_cost":0.00051},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.153385584s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/europe.yaml b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/europe.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ab1492ae55eb0de6f04a73ac87a65ed109b37a72 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/europe.yaml @@ -0,0 +1,137 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 591 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll get the weather information","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":" for Florence, Italy for you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_018gxNZKGPB561WXyjqCZDPA","index":0,"type":"function","function":{"name":"weather","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"location\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \"Fl"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"orence"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":",I"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"taly\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703498-fM9ZsDQAfy71vyjAQGOF","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703498,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":394,"completion_tokens":67,"total_tokens":461,"cost":0.002187,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001182,"upstream_inference_completions_cost":0.001005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.036525917s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 929 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_vrtx_018gxNZKGPB561WXyjqCZDPA","function":{"arguments":"{\"location\": \"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_vrtx_018gxNZKGPB561WXyjqCZDPA","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/europe"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"The current","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" temperature","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" in Florence, Italy is 40°","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"C (104°F). That","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"'s quite hot","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"! If","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" you're planning to visit or","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" are currently","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" there","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":", make","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" sure to","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" stay","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" hydrated and seek","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" shade during the hottest parts","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":" of the day.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703501-F3TPZJvH25uBXpA02kYe","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703501,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":476,"completion_tokens":54,"total_tokens":530,"cost":0.002238,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001428,"upstream_inference_completions_cost":0.00081},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.330429834s diff --git a/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/global.yaml b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/global.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c862753431696de9f29b4b30440ec09a1c817618 --- /dev/null +++ b/providertests/testdata/TestOpenRouterCommon/tool_streaming_claude-sonnet-4_google-vertex/global.yaml @@ -0,0 +1,133 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 591 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll get","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":" the current","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":" weather information","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":" for Florence, Italy for you.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"toolu_vrtx_018YAYcRRh2FsSEMXgs9sADK","index":0,"type":"function","function":{"name":"weather","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\"location\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \"Flore"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"nce, Italy"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1758703441-x2a6sIg6KNtgAe47OkdJ","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703441,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":394,"completion_tokens":68,"total_tokens":462,"cost":0.002202,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001182,"upstream_inference_completions_cost":0.00102},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.352287166s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 938 + host: "" + body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"content":"I''ll get the current weather information for Florence, Italy for you.","tool_calls":[{"id":"toolu_vrtx_018YAYcRRh2FsSEMXgs9sADK","function":{"arguments":"{\"location\": \"Florence, Italy\"}","name":"weather"},"type":"function"}],"role":"assistant"},{"content":"40 C","tool_call_id":"toolu_vrtx_018YAYcRRh2FsSEMXgs9sADK","role":"tool"}],"model":"anthropic/claude-sonnet-4","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"provider":{"only":["google-vertex/global"]},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.3.0 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"The current","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" temperature","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" in Florence, Italy is 40°","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"C (104°F). That","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"'s quite","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" hot! Make","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" sure to","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" stay","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" hydrated and seek","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" shade if","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" you're planning to be","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":" out","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"doors.","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":null,"reasoning_details":[]},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1758703443-tUSMqvyVWt5awRRvXeqm","provider":"Google","model":"anthropic/claude-sonnet-4","object":"chat.completion.chunk","created":1758703443,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":477,"completion_tokens":43,"total_tokens":520,"cost":0.002076,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001431,"upstream_inference_completions_cost":0.000645},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 937.009042ms