litellm/tests/integration/cost_calculation/cases/misc.py
yuneng-jiang 4bf1633452
fix!: backport the second batch of rc/1.107.0 CI triage fixes from main (#47090)
* fix(bedrock)!: block realtime replay after an input-first start and reject malformed Nova Sonic session settings (#46936)

* fix(bedrock): block realtime replay after input starts the session and reject non-string instructions and voice

* test(bedrock): name the malformed realtime setting test for its string cases

* fix(bedrock): replay the opening realtime message until Bedrock accepts the stream and refuse any fallback after commit

Also rejects a malformed modalities, input_sample_rate_hertz or tools setting with invalid_type, dropped under drop_params.

* fix(bedrock): replay a refused opening message on any fallback and reject OpenAI voices and non-string audio formats

* fix(realtime): read the client scope only when the websocket has one and reject any-case OpenAI and empty Bedrock voices

* test(bedrock): cover realtime replay, refusal and committed failure through a real proxy

Fix the scripted Bedrock peer's port import and the nested tool call cell's stale expected events, so the Nova Sonic integration file collects again

(cherry picked from commit 3ef0b35255)

* test(integration): write worker configs beside test-supplied configs (#47066)

Under worker isolation the harness rewrote every proxy config into the owned proxy's directory, so modules a test placed next to its own config (custom_auth) no longer resolved and the proxy died at boot. The copy now lands next to a test-supplied config, while configs inside the checkout still go to the worker directory so nothing is written into the repo tree

(cherry picked from commit e754857de9)

* test(e2e): keep the prompt-caching affinity test on the live provider (#47072)

With E2E_PROVIDER_CACHE=1 the test's Anthropic deployment went through the
shared response cache. Each call's recording expires on its own, so a run
could replay the cache-writing call while a follow-up went live against a
cold provider cache, recording creation instead of a read. That recording
then replayed as a failure for 24 hours. Mark the test provider_live, as
PROVIDER_CACHE.md requires for prompt-caching tests

(cherry picked from commit 6b45a196c4)

* test(integration): send post-kill requests on a fresh connection in two worker-kill tests (#47080)

kill() returns once the killed worker's main thread is a zombie, but its other threads can
still be exiting and holding its sockets open. A keep-alive connection pooled to that worker
still looks healthy, so the next request goes out on it and the closing socket answers with
a reset. The old reap wait used to hide this. A new connection can only be accepted by a
live worker, so the surviving-worker assertions now run on a fresh client

(cherry picked from commit c32eea634a)

* fix(caching): keep prompt cache usage on streamed cache hits (#47073)

* fix(caching): keep prompt cache usage on streamed cache hits

A stream=true request served from the response cache rebuilt its usage from
the prompt, completion and total counts only, so prompt_tokens_details and the
cache read and creation counts were dropped on the replayed stream. /v1/messages
clients routed to Bedrock Converse saw input_tokens equal to the whole prompt
and no cache tokens on a hit.

Both replays now build the usage through one helper that also restores
prompt_tokens_details and the integer cache read and creation counts, skipping
cached values that do not validate.

* fix(caching): coerce replayed token counts the way the live usage does

The replay accepted only exact ints for the token counts, so an integral float
or numeric string in a cached entry became 0 where the previous replay kept it.
Counts now go through pydantic int coercion and fall back only when they do not
validate.

(cherry picked from commit d346d769f0)

* fix(logging): keep the async request's logging payload when the sync success thread runs late (#47019)

* fix(logging): keep the async request's logging payload when sync callbacks run late

Treat the "cache" success callback as internal when deciding whether to start
the sync success thread for async requests. It has no branch in the sync
handler, so with `cache: true` that thread did nothing except rebuild and
overwrite model_call_details["standard_logging_object"].

When the sync handler does run for an async request (a real sync-only logger
is configured), it now builds its own payload and hands it only to its own
callbacks. The async handler keeps sole ownership of the shared payload, so
edits made by async logging hooks (for example the v3 rate limiter's mirrored
x-ratelimit headers that Prometheus reads) are no longer discarded. Sync
requests keep their existing behavior.

* fix(logging): keep sync cache hits logged and isolate the async-request payload build

The sync completion cache-hit path reused handle_sync_success_callbacks_for_async_calls,
so treating "cache" as internal silently dropped sync callbacks on sync cache hits. It now
submits the sync handler through its own method, as it effectively always did.

For async requests the sync handler builds its payload from a copy of the call details, so
message redaction cannot rewrite the shared standard_logging_object, and when it builds no
payload its callbacks keep the shared one instead of getting None.

* test(caching): lock sync cache-hit logging for completion, embedding and text_completion

* test(logging): keep sync hook edits off a caller-supplied payload for async requests

* fix(logging): give sync hooks a copy of the async payload when the thread builds none

* test(logging): check every legacy sync logger gets the thread's own payload

* test(logging): cover traceloop and supabase sync logging for async requests

(cherry picked from commit a4e0570bea)

* fix(cost): price exact cost-map names before price-free capability rules, and fix SCIM and MCP integration tests on CircleCI (#47037)

* fix(test-harness): preserve sibling auth modules in isolated worker configs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integration): expect servers in MCP connect-flow descriptions

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integration): expect ptu_hours in daily activity metrics after #43043

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integration): kill every serving worker once the SCIM push blocks on the row lock

* fix(cost): price exact cost-map names before price-free capability rule matches

* test(streaming): price a priced alias stream at its deployment model and keep the unpriceable case unmapped

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(cost): price an explicit base_model under its own provider after candidate reordering

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(cost): retain priced generalized candidates and skip explicit-pricing lookups

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(cost): assert custom pricing makes no remote model-info requests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(cost): keep the per-candidate pricing provider final

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): pin a Bedrock application profile prompt for the one-hour ttl its base model sends

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integration): assert the Nova Sonic tool-call argument delta carries the full arguments

* fix(cost): sort cost candidates from the static cost map and rules, without provider lookups

* test(integration): bill route-priced Bedrock chat streams and responses, and pin application profiles for an hour on messages and cache hits

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Yuneng Jiang <yuneng@berri.ai>
(cherry picked from commit 4a58784fa2)

* test(e2e): warm the memory test up with two batches before the measured one (#47087)

* test(e2e): warm the memory test up with two batches before the measured one

On a cold worker the second batch of failing requests can still raise the
allocator's high-water mark by about 50 MB while the live Python heap stays
flat, so the 48 MB budget failed about 1 in 10 Buildkite runs without a leak.
The test now runs two warmup batches, measures the third against the same
budget, and records every batch's settled growth per worker as an
rss_batch_growth JUnit property for later calibration

* test(e2e): record each memory batch's growth as soon as it settles

A failure in a later batch no longer drops the growth already measured, and
the worker keys are no longer sorted, which raised on a mix of named and
unnamed hosts

* test(e2e): silence the xunit2 record_property warning on the memory test

(cherry picked from commit 1fd7f81f97)

* test: import pytest and Final for the backported #47073 test on rc

On main these imports came from an earlier commit that is not on rc/1.107.0, so the
picked test failed collection with NameError

---------

Co-authored-by: Mateo Wang <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-17 00:20:23 -07:00

1806 lines
69 KiB
Python

"""azure_ai, bedrock, cohere, cohere_chat, dashscope, deepgram, deepseek, groq, mistral, openrouter, text-completion-openai, xai cost tracking cases, one CostTrackingTestCase literal per request shape (moved from cost_tracking_cases.json).
PARITY pairs the streamed case with its plain twin where both bill the same row."""
from typing import Final
from integration.cost_calculation.cost_tracking_case import (
ALWAYS_OPEN_OFF_PEAK_WINDOW,
OffPeakPricing,
CostTrackingTestCase,
Deployment,
EventStreamEvent,
EventStreamResponse,
ExactExpected,
JsonResponse,
RecountExpected,
RecountRates,
SseResponse,
WavUpload,
)
from integration.cost_calculation.stream_parity.case import StreamParityTestCase, sse_frames
from integration.cost_calculation.cases.anthropic import (
CLAUDE_FABLE_5_1_INPUT_TEXT,
CLAUDE_FABLE_5_1_STREAM,
CLAUDE_HAIKU_5_5_INPUT_TEXT,
CLAUDE_HAIKU_5_5_STREAM,
)
# nova-next
NOVA_NEXT_TRANSCRIPTIONS_PER_SECOND: Final = CostTrackingTestCase(
name="nova-next-transcriptions-per-second",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="nova-next",
endpoint="/v1/audio/transcriptions",
upload=WavUpload(kind="wav", seconds=4.0),
request={},
response=JsonResponse(
content_type="application/json",
body={
"results": {"channels": [{"alternatives": [{"transcript": "hello", "confidence": 0.9}]}]},
"metadata": {"duration": 4.0, "channels": 1},
},
),
expected=ExactExpected(spend=0.0012, input_cost=0.0012, output_cost=0, prompt_tokens=0, completion_tokens=0),
)
# amazon.nova-canvas-next
AMAZON_NOVA_CANVAS_NEXT_IMAGES_ONE: Final = CostTrackingTestCase(
name="amazon-nova-canvas-next-images-one",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="amazon.nova-canvas-next",
endpoint="/v1/images/generations",
deployment=Deployment(model="amazon.nova-canvas-next"),
request={"prompt": "a deterministic bedrock image"},
response=JsonResponse(content_type="application/json", body={"images": ["AA=="]}),
expected=ExactExpected(
spend=0.045, input_cost=0.045, output_cost=0, prompt_tokens=0, completion_tokens=0, breakdown_persisted=False
),
)
# embed-v5
COHERE_EMBEDDINGS_V5: Final = CostTrackingTestCase(
name="cohere-embeddings-v5",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="embed-v5",
endpoint="/v1/embeddings",
request={"model": "$MODEL", "input": "cohere embedding", "input_type": "search_query"},
response=JsonResponse(
content_type="application/json",
body={
"id": "emb-1",
"embeddings": {"float": [[0.1, 0.2, 0.3]]},
"meta": {"billed_units": {"input_tokens": 11}},
},
),
expected=ExactExpected(
spend=1.144e-05, input_cost=1.144e-05, output_cost=0.0, prompt_tokens=11, completion_tokens=0
),
)
# amazon.titan-embed-text-v2:0
BEDROCK_EMBEDDINGS_TITAN_V2: Final = CostTrackingTestCase(
name="bedrock-embeddings-titan-v2",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="amazon.titan-embed-text-v2:0",
endpoint="/v1/embeddings",
request={"model": "$MODEL", "input": "titan embedding"},
response=JsonResponse(
content_type="application/json", body={"embedding": [0.1, 0.2, 0.3], "inputTextTokenCount": 10}
),
expected=ExactExpected(spend=1.05e-05, input_cost=1.05e-05, output_cost=0.0, prompt_tokens=10, completion_tokens=0),
)
# cohere.embed-english-v4
BEDROCK_COHERE_EMBEDDINGS_V4: Final = CostTrackingTestCase(
name="bedrock-cohere-embeddings-v4",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="cohere.embed-english-v4",
endpoint="/v1/embeddings",
request={"model": "$MODEL", "input": "bedrock cohere embedding"},
response=JsonResponse(
content_type="application/json",
body={
"embeddings": [[0.1, 0.2, 0.3]],
"id": "emb-bedrock-cohere-1",
"response_type": "embeddings_floats",
"texts": ["bedrock cohere embedding"],
},
),
expected=ExactExpected(spend=5.3e-06, input_cost=5.3e-06, output_cost=0.0, prompt_tokens=5, completion_tokens=0),
)
# rerank-v4
COHERE_RERANK_V4_ONE: Final = CostTrackingTestCase(
name="cohere-rerank-v4-one",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="rerank-v4",
endpoint="/v1/rerank",
request={"model": "$MODEL", "query": "rank this", "documents": ["a", "b"]},
response=JsonResponse(
content_type="application/json",
body={
"id": "rr-$REQUEST_ID",
"results": [{"index": 0, "relevance_score": 0.9}],
"meta": {"api_version": {"version": "2"}, "billed_units": {"search_units": 1}},
},
),
expected=ExactExpected(spend=0.0021, input_cost=0.0021, output_cost=0.0, prompt_tokens=0, completion_tokens=0),
)
COHERE_RERANK_V4_THREE: Final = CostTrackingTestCase(
name="cohere-rerank-v4-three",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="rerank-v4",
endpoint="/v1/rerank",
request={
"model": "$MODEL",
"query": "rank this",
"documents": ["a long document", "another long document", "third long document"],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "rr-three-$REQUEST_ID",
"results": [{"index": 0, "relevance_score": 0.9}],
"meta": {"api_version": {"version": "2"}, "billed_units": {"search_units": 3}},
},
),
expected=ExactExpected(spend=0.0063, input_cost=0.0063, output_cost=0.0, prompt_tokens=0, completion_tokens=0),
)
COHERE_RERANK_V4_TOTAL_TOKENS_FALLBACK: Final = CostTrackingTestCase(
name="cohere-rerank-v4-total-tokens-fallback",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="rerank-v4",
endpoint="/v1/rerank",
request={"model": "$MODEL", "query": "rank this", "documents": ["fallback a", "fallback b"]},
response=JsonResponse(
content_type="application/json",
body={
"id": "rr-fallback-$REQUEST_ID",
"results": [{"index": 0, "relevance_score": 0.8}],
"meta": {"billed_units": {"total_tokens": 99}},
},
),
expected=ExactExpected(spend=0.0, input_cost=0.0, output_cost=0.0, prompt_tokens=0, completion_tokens=0),
)
# cohere.rerank-v4:0
BEDROCK_COHERE_RERANK_V4: Final = CostTrackingTestCase(
name="bedrock-cohere-rerank-v4",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="cohere.rerank-v4:0",
endpoint="/v1/rerank",
request={"model": "$MODEL", "query": "rank this", "documents": ["a", "b"]},
response=JsonResponse(
content_type="application/json",
body={"results": [{"index": 0, "relevanceScore": 0.9}], "response_id": "rr-3", "token_count": 1},
),
expected=ExactExpected(spend=0.0022, input_cost=0.0022, output_cost=0.0, prompt_tokens=0, completion_tokens=0),
)
# gpt-3.5-turbo-instruct-next
TEXT_COMPLETIONS_OPENAI_BASIC: Final = CostTrackingTestCase(
name="text-completions-openai-basic",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-3.5-turbo-instruct-next",
endpoint="/v1/completions",
request={"model": "$MODEL", "prompt": "complete this"},
response=JsonResponse(
content_type="application/json",
body={
"id": "cmpl-basic-$REQUEST_ID",
"object": "text_completion",
"choices": [{"text": "done", "index": 0, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 9, "completion_tokens": 4, "total_tokens": 13},
},
),
expected=ExactExpected(
spend=1.882e-05, input_cost=1.026e-05, output_cost=8.56e-06, prompt_tokens=9, completion_tokens=4
),
)
TEXT_COMPLETIONS_OPENAI_STREAM_USAGE: Final = CostTrackingTestCase(
name="text-completions-openai-stream-usage",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-3.5-turbo-instruct-next",
endpoint="/v1/completions",
request={"model": "$MODEL", "prompt": "complete this", "stream": True, "stream_options": {"include_usage": True}},
response=SseResponse(
content_type="text/event-stream",
frames=sse_frames(
{
"id": "cmpl-$REQUEST_ID",
"object": "text_completion",
"created": 1789789000,
"model": "gpt-3.5-turbo-instruct-next",
"choices": [{"text": "done", "index": 0, "finish_reason": None}],
"usage": None,
},
{
"id": "cmpl-$REQUEST_ID",
"object": "text_completion",
"created": 1789789000,
"model": "gpt-3.5-turbo-instruct-next",
"choices": [],
"usage": {"prompt_tokens": 9, "completion_tokens": 4, "total_tokens": 13},
},
done=True,
),
),
expected=ExactExpected(
spend=1.882e-05, input_cost=1.026e-05, output_cost=8.56e-06, prompt_tokens=9, completion_tokens=4
),
)
TEXT_COMPLETIONS_OPENAI_N_BEST: Final = CostTrackingTestCase(
name="text-completions-openai-n-best",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-3.5-turbo-instruct-next",
endpoint="/v1/completions",
request={"model": "$MODEL", "prompt": "complete this twice", "n": 2},
response=JsonResponse(
content_type="application/json",
body={
"id": "cmpl-n-best-$REQUEST_ID",
"object": "text_completion",
"choices": [
{"text": "done", "index": 0, "finish_reason": "stop"},
{"text": "also done", "index": 1, "finish_reason": "stop"},
],
"usage": {"prompt_tokens": 9, "completion_tokens": 8, "total_tokens": 17},
},
),
expected=ExactExpected(
spend=2.738e-05, input_cost=1.026e-05, output_cost=1.712e-05, prompt_tokens=9, completion_tokens=8
),
)
# dashscope/qwen4-max
DASHSCOPE_QWEN4_MAX_TIERED_INPUT: Final = CostTrackingTestCase(
name="dashscope-qwen4-max-tiered_input",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="dashscope/qwen4-max",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "tiered input"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "$REQUEST_ID",
"object": "chat.completion",
"model": "qwen4-max",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
},
),
expected=ExactExpected(
spend=0.00507, input_cost=0.002392, output_cost=0.002678, prompt_tokens=1840, completion_tokens=412
),
)
DASHSCOPE_QWEN4_MAX_TIERED_BOUNDARY_STAYS_LOWER_TIER: Final = CostTrackingTestCase(
name="dashscope-qwen4-max-tiered_boundary_stays_lower_tier",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="dashscope/qwen4-max",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "tier boundary"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "$REQUEST_ID",
"object": "chat.completion",
"model": "qwen4-max",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 32000, "completion_tokens": 412, "total_tokens": 32412},
},
),
expected=ExactExpected(
spend=0.044278, input_cost=0.0416, output_cost=0.002678, prompt_tokens=32000, completion_tokens=412
),
)
DASHSCOPE_QWEN4_MAX_TIERED_SECOND_TIER: Final = CostTrackingTestCase(
name="dashscope-qwen4-max-tiered_second_tier",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="dashscope/qwen4-max",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "tier two"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "$REQUEST_ID",
"object": "chat.completion",
"model": "qwen4-max",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 40000, "completion_tokens": 412, "total_tokens": 40412},
},
),
expected=ExactExpected(
spend=0.109356, input_cost=0.104, output_cost=0.005356, prompt_tokens=40000, completion_tokens=412
),
)
DASHSCOPE_QWEN4_MAX_TIERED_ABOVE_TOP_RANGE: Final = CostTrackingTestCase(
name="dashscope-qwen4-max-tiered_above_top_range",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="dashscope/qwen4-max",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "top tier"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "$REQUEST_ID",
"object": "chat.completion",
"model": "qwen4-max",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 300000, "completion_tokens": 412, "total_tokens": 300412},
},
),
expected=ExactExpected(
spend=0.936386, input_cost=0.93, output_cost=0.006386, prompt_tokens=300000, completion_tokens=412
),
)
# openrouter/anthropic/claude-sonnet-5
OPENROUTER_ANTHROPIC_CLAUDE_SONNET_5_PROVIDER_REPORTED_COST: Final = CostTrackingTestCase(
name="openrouter-anthropic-claude-sonnet-5-provider_reported_cost",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="openrouter/anthropic/claude-sonnet-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "reported cost"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "anthropic/claude-sonnet-5",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252, "cost": 0.0421},
},
),
expected=ExactExpected(
spend=0.0421,
input_cost=0.0,
output_cost=0.0421,
prompt_tokens=1840,
completion_tokens=412,
breakdown_persisted=False,
),
)
OPENROUTER_ANTHROPIC_CLAUDE_SONNET_5_TOKEN_PRICED: Final = CostTrackingTestCase(
name="openrouter-anthropic-claude-sonnet-5-token_priced",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="openrouter/anthropic/claude-sonnet-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "token pricing"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "anthropic/claude-sonnet-5",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
},
),
expected=ExactExpected(
spend=0.01248, input_cost=0.005888, output_cost=0.006592, prompt_tokens=1840, completion_tokens=412
),
)
# perplexity/sonar-next
PERPLEXITY_SONAR_NEXT_NO_SEARCH: Final = CostTrackingTestCase(
name="perplexity-sonar-next-no_search",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="perplexity/sonar-next",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "no search"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "sonar-next",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
},
),
expected=ExactExpected(
spend=0.0025118, input_cost=0.0020792, output_cost=0.0004326, prompt_tokens=1840, completion_tokens=412
),
)
# deepseek/deepseek-v4-chat
DEEPSEEK_DEEPSEEK_V4_CHAT_PROMPT_CACHE_HIT: Final = CostTrackingTestCase(
name="deepseek-deepseek-v4-chat-prompt_cache_hit",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="deepseek/deepseek-v4-chat",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "cache hit"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "deepseek-v4-chat",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {
"prompt_tokens": 1840,
"completion_tokens": 412,
"total_tokens": 2252,
"prompt_cache_hit_tokens": 1200,
"prompt_cache_miss_tokens": 640,
"prompt_tokens_details": {"cached_tokens": 1200},
},
},
),
expected=ExactExpected(
spend=0.00039756,
input_cost=0.0002204,
output_cost=0.00017716,
cache_read_cost=3.48e-05,
prompt_tokens=1840,
completion_tokens=412,
),
)
DEEPSEEK_DEEPSEEK_V4_CHAT_NO_CACHE_FIELDS_BILLS_ZERO_CACHE: Final = CostTrackingTestCase(
name="deepseek-deepseek-v4-chat-no_cache_fields_bills_zero_cache",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="deepseek/deepseek-v4-chat",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "no cache"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "deepseek-v4-chat",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
},
),
expected=ExactExpected(
spend=0.00071076,
input_cost=0.0005336,
output_cost=0.00017716,
cache_read_cost=0.0,
prompt_tokens=1840,
completion_tokens=412,
),
)
# xai/grok-5
XAI_GROK_5_REASONING_FOLDED_INTO_COMPLETION: Final = CostTrackingTestCase(
name="xai-grok-5-reasoning_folded_into_completion",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="xai/grok-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "reasoning"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "grok-5",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {
"prompt_tokens": 1840,
"completion_tokens": 412,
"total_tokens": 2552,
"completion_tokens_details": {"reasoning_tokens": 300},
},
},
),
expected=ExactExpected(
spend=0.0044064, input_cost=0.002484, output_cost=0.0019224, prompt_tokens=1840, completion_tokens=712
),
)
XAI_GROK_5_LIVE_SEARCH: Final = CostTrackingTestCase(
name="xai-grok-5-live_search",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="xai/grok-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "live search"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "grok-5",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {
"prompt_tokens": 1840,
"completion_tokens": 412,
"total_tokens": 2252,
"server_side_tool_usage_details": {"web_search_calls": 2},
},
},
),
expected=ExactExpected(
spend=0.0135964,
input_cost=0.002484,
output_cost=0.0011124,
tool_usage_cost=0.01,
prompt_tokens=1840,
completion_tokens=412,
),
)
XAI_GROK_5_PROVIDER_REPORTED_COST: Final = CostTrackingTestCase(
name="xai-grok-5-provider_reported_cost",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="xai/grok-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "reported xai cost"}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "grok-5",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252, "cost": 0.0421},
},
),
expected=ExactExpected(
spend=0.0421,
input_cost=0.029078078,
output_cost=0.013021922,
prompt_tokens=1840,
completion_tokens=412,
),
)
# bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0
BEDROCK_INVOKE_HAIKU_JSON: Final = CostTrackingTestCase(
name="bedrock-invoke-haiku-json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "bedrock-invoke-haiku-json"}],
"stream": False,
"max_tokens": 412,
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "anthropic.claude-haiku-4-5-20251001-v1:0",
"content": [{"type": "text", "text": "scripted response"}],
"stop_reason": "end_turn",
"stop_sequence": None,
"usage": {"input_tokens": 1840, "output_tokens": 412},
},
),
expected=ExactExpected(
spend=0.00425372, input_cost=0.0021896, output_cost=0.00206412, prompt_tokens=1840, completion_tokens=412
),
)
BEDROCK_INVOKE_HAIKU_STREAM: Final = CostTrackingTestCase(
name="bedrock-invoke-haiku-stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "bedrock-invoke-haiku-stream"}],
"stream": True,
"max_tokens": 412,
},
response=EventStreamResponse(
content_type="application/vnd.amazon.eventstream",
events=(
EventStreamEvent(
event_type="message_start",
payload={
"type": "message_start",
"message": {
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "anthropic.claude-haiku-4-5-20251001-v1:0",
"content": [],
"stop_reason": None,
"stop_sequence": None,
"usage": {"input_tokens": 1840, "output_tokens": 0},
},
},
),
EventStreamEvent(
event_type="content_block_delta",
payload={
"type": "content_block_delta",
"index": 0,
"delta": {"type": "text_delta", "text": "scripted response"},
},
),
EventStreamEvent(
event_type="message_delta",
payload={
"type": "message_delta",
"delta": {"stop_reason": "end_turn"},
"usage": {"output_tokens": 412},
},
),
EventStreamEvent(event_type="message_stop", payload={"type": "message_stop"}),
),
framing="invoke",
),
expected=ExactExpected(
spend=0.00425372, input_cost=0.0021896, output_cost=0.00206412, prompt_tokens=1840, completion_tokens=412
),
)
BEDROCK_INVOKE_HAIKU_CHAT_STREAM: Final = CostTrackingTestCase(
name="bedrock-invoke-haiku-chat-stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "bedrock-invoke-haiku-chat-stream"}],
"stream": True,
"stream_options": {"include_usage": True},
"max_tokens": 412,
},
response=BEDROCK_INVOKE_HAIKU_STREAM.response,
expected=BEDROCK_INVOKE_HAIKU_STREAM.expected,
)
BEDROCK_INVOKE_HAIKU_RESPONSES: Final = CostTrackingTestCase(
name="bedrock-invoke-haiku-responses",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0",
endpoint="/v1/responses",
request={"model": "$MODEL", "input": "bedrock-invoke-haiku-responses", "max_output_tokens": 412},
response=BEDROCK_INVOKE_HAIKU_JSON.response,
expected=BEDROCK_INVOKE_HAIKU_JSON.expected,
)
# azure_ai/gpt-5.4-mini-2026-03-17
AZURE_AI_GPT_5_4_MINI_LATEST: Final = CostTrackingTestCase(
name="azure-ai-gpt-5.4-mini-latest",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/gpt-5.4-mini-2026-03-17",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "azure-ai-gpt-5.4-mini-latest"}],
"stream": False,
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "$MODEL",
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "scripted response"}, "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
"service_tier": "default",
},
),
expected=ExactExpected(
spend=0.003234, input_cost=0.00138, output_cost=0.001854, prompt_tokens=1840, completion_tokens=412
),
)
AZURE_AI_GPT_5_4_MINI_LATEST_STREAM: Final = CostTrackingTestCase(
name="azure-ai-gpt-5.4-mini-latest-stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="azure_ai/gpt-5.4-mini-2026-03-17",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "azure-ai-gpt-5.4-mini-latest-stream"}],
"stream": True,
},
response=SseResponse(
content_type="text/event-stream",
frames=(
'data: {"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1,"model":"$MODEL","choices":[{"index":0,"delta":{"role":"assistant","content":"ok"},"finish_reason":null}]}\n\n',
'data: {"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1,"model":"$MODEL","choices":[],"usage":{"prompt_tokens":1840,"completion_tokens":412,"total_tokens":2252}}\n\n',
"data: [DONE]\n\n",
),
),
expected=ExactExpected(
spend=0.003234, input_cost=0.00138, output_cost=0.001854, prompt_tokens=1840, completion_tokens=412
),
)
# azure_ai/claude-haiku-4-5 (Azure AI Foundry Anthropic, web search billed per server_tool_use.web_search_requests)
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_WEB_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-messages_web_search_two_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-haiku-4-5",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [{"role": "user", "content": "azure-ai-claude-haiku-4-5-messages_web_search_two_requests"}],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$UNIQUE_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-4-5",
"content": [{"type": "text", "text": "scripted answer a1b2c3d4e5f6"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
rollups=True,
),
)
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_WEB_SEARCH_STREAM: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-messages_web_search_two_requests_stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="azure_ai/claude-haiku-4-5",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [{"role": "user", "content": "azure-ai-claude-haiku-4-5-messages_web_search_two_requests_stream"}],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
"stream": True,
},
response=SseResponse(
content_type="text/event-stream",
frames=(
'event: message_start\ndata: {"type":"message_start","message":{"id":"msg_$REQUEST_ID","type":"message","role":"assistant","model":"claude-haiku-4-5","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":1840}}}',
'event: content_block_start\ndata: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}',
'event: content_block_delta\ndata: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"scripted response"}}',
'event: content_block_stop\ndata: {"type":"content_block_stop","index":0}',
'event: message_delta\ndata: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":412,"server_tool_use":{"web_search_requests":2}}}',
'event: message_stop\ndata: {"type":"message_stop"}',
),
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
),
)
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_WEB_SEARCH_ONE_REQUEST: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-messages_web_search_one_request",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-haiku-4-5",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [{"role": "user", "content": "azure-ai-claude-haiku-4-5-messages_web_search_one_request"}],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-4-5",
"content": [{"type": "text", "text": "scripted answer 0f1e2d3c4b5a"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 1}},
},
),
expected=ExactExpected(
spend=0.0139,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.01,
),
)
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_NO_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-messages_no_server_tool_use",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-haiku-4-5",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [{"role": "user", "content": "azure-ai-claude-haiku-4-5-messages_no_server_tool_use"}],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-4-5",
"content": [{"type": "text", "text": "scripted answer 9a8b7c6d5e4f"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412},
},
),
expected=ExactExpected(
spend=0.0039,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.0,
),
)
AZURE_AI_CLAUDE_HAIKU_4_5_CHAT_WEB_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-chat_web_search_three_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-haiku-4-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "azure-ai-claude-haiku-4-5-chat_web_search_three_requests"}],
"stream": False,
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}],
"allowed_openai_params": ["web_search_options"],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-4-5",
"content": [{"type": "text", "text": "scripted answer 5e4f3a2b1c0d"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 3}},
},
),
expected=ExactExpected(
spend=0.0339,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.03,
),
)
AZURE_AI_CLAUDE_HAIKU_4_5_CHAT_WEB_SEARCH_STREAM: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-chat_web_search_two_requests_stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="azure_ai/claude-haiku-4-5",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "azure-ai-claude-haiku-4-5-chat_web_search_two_requests_stream"}],
"stream": True,
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}],
"allowed_openai_params": ["web_search_options"],
},
response=SseResponse(
content_type="text/event-stream",
frames=sse_frames(
{
"type": "message_start",
"message": {
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-4-5",
"content": [],
"stop_reason": None,
"usage": {"input_tokens": 1840},
},
},
{"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}},
{
"type": "content_block_delta",
"index": 0,
"delta": {"type": "text_delta", "text": "scripted answer 2c3d4e5f6a7b"},
},
{"type": "content_block_stop", "index": 0},
{
"type": "message_delta",
"delta": {"stop_reason": "end_turn"},
"usage": {"output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
{"type": "message_stop"},
),
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
),
)
AZURE_AI_CLAUDE_HAIKU_4_5_RESPONSES_WEB_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-haiku-4-5-responses_web_search_two_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-haiku-4-5",
endpoint="/v1/responses",
request={
"model": "$MODEL",
"input": "azure-ai-claude-haiku-4-5-responses_web_search_two_requests",
"tools": [{"type": "web_search"}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-4-5",
"content": [{"type": "text", "text": "scripted answer 7d6e5f4a3b2c"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
),
)
# azure_ai/claude-sonnet-4-5 (public row has no search price, the deployment owns input, output and search rates)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_WEB_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_rates_messages_web_search_two_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-sonnet-4-5",
endpoint="/v1/messages",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.01),
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [
{"role": "user", "content": "azure-ai-claude-sonnet-4-5-deployment_rates_messages_web_search_two_requests"}
],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$UNIQUE_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [{"type": "text", "text": "scripted answer b1c2d3e4f5a6"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
rollups=True,
),
)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_WEB_SEARCH_STREAM: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_rates_messages_web_search_two_requests_stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="azure_ai/claude-sonnet-4-5",
endpoint="/v1/messages",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.01),
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [
{
"role": "user",
"content": "azure-ai-claude-sonnet-4-5-deployment_rates_messages_web_search_two_requests_stream",
}
],
"stream": True,
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=SseResponse(
content_type="text/event-stream",
frames=sse_frames(
{
"type": "message_start",
"message": {
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [],
"stop_reason": None,
"usage": {"input_tokens": 1840},
},
},
{"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}},
{
"type": "content_block_delta",
"index": 0,
"delta": {"type": "text_delta", "text": "scripted answer c2d3e4f5a6b1"},
},
{"type": "content_block_stop", "index": 0},
{
"type": "message_delta",
"delta": {"stop_reason": "end_turn"},
"usage": {"output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
{"type": "message_stop"},
),
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
),
)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_WEB_SEARCH_ZERO_RATE: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_zero_search_rate_messages_two_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-sonnet-4-5",
endpoint="/v1/messages",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.0),
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [
{"role": "user", "content": "azure-ai-claude-sonnet-4-5-deployment_zero_search_rate_messages_two_requests"}
],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [{"type": "text", "text": "scripted answer d3e4f5a6b1c2"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
),
expected=ExactExpected(
spend=0.0039,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.0,
),
)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_NO_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_rates_messages_no_server_tool_use",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-sonnet-4-5",
endpoint="/v1/messages",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.01),
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [
{"role": "user", "content": "azure-ai-claude-sonnet-4-5-deployment_rates_messages_no_server_tool_use"}
],
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [{"type": "text", "text": "scripted answer e4f5a6b1c2d3"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412},
},
),
expected=ExactExpected(
spend=0.0039,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.0,
),
)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_CHAT_WEB_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_rates_chat_web_search_three_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-sonnet-4-5",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.01),
request={
"model": "$MODEL",
"messages": [
{"role": "user", "content": "azure-ai-claude-sonnet-4-5-deployment_rates_chat_web_search_three_requests"}
],
"stream": False,
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}],
"allowed_openai_params": ["web_search_options"],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [{"type": "text", "text": "scripted answer f5a6b1c2d3e4"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 3}},
},
),
expected=ExactExpected(
spend=0.0339,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.03,
),
)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_CHAT_WEB_SEARCH_STREAM: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_rates_chat_web_search_two_requests_stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="azure_ai/claude-sonnet-4-5",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.01),
request={
"model": "$MODEL",
"messages": [
{
"role": "user",
"content": "azure-ai-claude-sonnet-4-5-deployment_rates_chat_web_search_two_requests_stream",
}
],
"stream": True,
"tools": [{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
"allowed_openai_params": ["web_search_options"],
},
response=SseResponse(
content_type="text/event-stream",
frames=sse_frames(
{
"type": "message_start",
"message": {
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [],
"stop_reason": None,
"usage": {"input_tokens": 1840},
},
},
{"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}},
{
"type": "content_block_delta",
"index": 0,
"delta": {"type": "text_delta", "text": "scripted answer a6b1c2d3e4f5"},
},
{"type": "content_block_stop", "index": 0},
{
"type": "message_delta",
"delta": {"stop_reason": "end_turn"},
"usage": {"output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
{"type": "message_stop"},
),
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
),
)
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_RESPONSES_WEB_SEARCH: Final = CostTrackingTestCase(
name="azure-ai-claude-sonnet-4-5-deployment_rates_responses_web_search_two_requests",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="azure_ai/claude-sonnet-4-5",
endpoint="/v1/responses",
deployment=Deployment(input_cost_per_token=1e-06, output_cost_per_token=5e-06, search_cost_per_query=0.01),
request={
"model": "$MODEL",
"input": "azure-ai-claude-sonnet-4-5-deployment_rates_responses_web_search_two_requests",
"tools": [{"type": "web_search"}],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-5",
"content": [{"type": "text", "text": "scripted answer b1c2d3e4f5a7"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1840, "output_tokens": 412, "server_tool_use": {"web_search_requests": 2}},
},
),
expected=ExactExpected(
spend=0.0239,
input_cost=0.00184,
output_cost=0.00206,
prompt_tokens=1840,
completion_tokens=412,
tool_usage_cost=0.02,
),
)
# groq/qwen/qwen3.8-27b
GROQ_QWEN_3_8_JSON: Final = CostTrackingTestCase(
name="groq-qwen-3.8-json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="groq/qwen/qwen3.8-27b",
request={"model": "$MODEL", "messages": [{"role": "user", "content": "groq-qwen-3.8-json"}], "stream": False},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "$MODEL",
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "scripted response"}, "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
"service_tier": "default",
"x_groq": {"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252}},
},
),
expected=ExactExpected(
spend=0.00312, input_cost=0.001472, output_cost=0.001648, prompt_tokens=1840, completion_tokens=412
),
)
GROQ_QWEN_3_8_STREAM_X_GROQ_RECOUNT: Final = CostTrackingTestCase(
name="groq-qwen-3.8-stream_x_groq_recount",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
model="groq/qwen/qwen3.8-27b",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "groq-qwen-3.8-stream_x_groq_recount"}],
"stream": True,
},
response=SseResponse(
content_type="text/event-stream",
frames=(
'data: {"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1,"model":"$MODEL","choices":[{"index":0,"delta":{"role":"assistant","content":"ok"},"finish_reason":null}]}\n\n',
'data: {"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1,"model":"$MODEL","choices":[],"x_groq":{"usage":{"prompt_tokens":1840,"completion_tokens":412,"total_tokens":2252}}}\n\n',
"data: [DONE]\n\n",
),
),
expected=RecountExpected(recount=RecountRates(input_cost_per_token=8e-07, output_cost_per_token=4e-06)),
)
# cohere_chat/v2/command-a-03-2025
COHERE_COMMAND_A_V2_TOKENS: Final = CostTrackingTestCase(
name="cohere-command-a-v2-tokens",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="cohere_chat/v2/command-a-03-2025",
deployment=Deployment(model="cohere_chat/v2/command-a-03-2025"),
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "cohere-command-a-v2-tokens"}],
"stream": False,
},
response=JsonResponse(
content_type="application/json",
body={
"id": "$REQUEST_ID",
"message": {"role": "assistant", "content": [{"type": "text", "text": "scripted response"}]},
"finish_reason": "COMPLETE",
"usage": {
"tokens": {"input_tokens": 1840, "output_tokens": 412, "total_tokens": 2252},
"billed_units": {"input_tokens": 1800, "output_tokens": 400},
},
},
),
expected=ExactExpected(
spend=0.00874252, input_cost=0.0046184, output_cost=0.00412412, prompt_tokens=1840, completion_tokens=412
),
)
# mistral/mistral-medium-2604
MISTRAL_MEDIUM_2604_JSON: Final = CostTrackingTestCase(
name="mistral-medium-2604-json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="mistral/mistral-medium-2604",
request={"model": "$MODEL", "messages": [{"role": "user", "content": "mistral-medium-2604-json"}], "stream": False},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "$MODEL",
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "scripted response"}, "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
"service_tier": "default",
},
),
expected=ExactExpected(
spend=0.00587252, input_cost=0.0027784, output_cost=0.00309412, prompt_tokens=1840, completion_tokens=412
),
)
# xai/grok-4.7
XAI_GROK_4_7_INPUT_TEXT: Final = CostTrackingTestCase(
name="xai-grok-4.7-input_text",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="xai/grok-4.7",
request={
"model": "$MODEL",
"messages": [{"role": "user", "content": "Say hello."}],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "grok-4.7",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "Hello."}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252},
},
),
expected=ExactExpected(
spend=0.006152, input_cost=0.00368, output_cost=0.002472, prompt_tokens=1840, completion_tokens=412
),
)
AZURE_AI_CLAUDE_FABLE_5_1_INPUT_TEXT: Final = CLAUDE_FABLE_5_1_INPUT_TEXT.model_copy(
update={
"name": "azure_ai/claude-fable-5-1-input_text",
"model": "azure_ai/claude-fable-5-1",
"response": JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-fable-5-1",
"content": [
{"type": "thinking", "thinking": "scripted thought", "signature": "scripted signature"},
{"type": "text", "text": "scripted answer 3d584fa07ae1"},
],
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"container": None,
"diagnostics": None,
"usage": {
"input_tokens": 1840,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 412,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "not_available",
},
},
),
"expected": ExactExpected(
spend=0.0663, input_cost=0.03128, output_cost=0.03502, prompt_tokens=1840, completion_tokens=412
),
}
)
AZURE_AI_CLAUDE_FABLE_5_1_STREAM: Final = CLAUDE_FABLE_5_1_STREAM.model_copy(
update={
"name": "azure_ai/claude-fable-5-1-stream",
"model": "azure_ai/claude-fable-5-1",
"response": SseResponse(
content_type="text/event-stream",
frames=sse_frames(
*(
{
"type": "message_start",
"message": {
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-fable-5-1",
"content": [],
"stop_reason": None,
"stop_sequence": None,
"stop_details": None,
"container": None,
"diagnostics": None,
"usage": {
"input_tokens": 1840,
"output_tokens": 1,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"service_tier": "standard",
"inference_geo": "not_available",
},
},
},
{"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": "", "signature": ""}},
{"type": "ping"},
{"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": ""}},
{
"type": "content_block_delta",
"index": 0,
"delta": {"type": "signature_delta", "signature": "scripted signature"},
},
{"type": "content_block_stop", "index": 0},
{"type": "content_block_start", "index": 1, "content_block": {"type": "text", "text": ""}},
*(
{
"type": "content_block_delta",
"index": 1,
"delta": {"type": "text_delta", "text": text},
}
for text in (
"scripted ",
"answer ",
"3d",
"58",
"4f",
"a0",
"7a",
"e1",
"",
"",
)
),
{"type": "content_block_stop", "index": 1},
{
"type": "message_delta",
"delta": {
"container": None,
"stop_details": None,
"stop_reason": "end_turn",
"stop_sequence": None,
},
"usage": {
"input_tokens": 1840,
"output_tokens": 412,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"output_tokens_details": {"thinking_tokens": 0},
},
},
{"type": "message_stop"},
)
),
),
"expected": ExactExpected(
spend=0.0663, input_cost=0.03128, output_cost=0.03502, prompt_tokens=1840, completion_tokens=412
),
}
)
AZURE_AI_CLAUDE_HAIKU_5_5_INPUT_TEXT: Final = CLAUDE_HAIKU_5_5_INPUT_TEXT.model_copy(
update={
"name": "azure_ai/claude-haiku-5-5-input_text",
"model": "azure_ai/claude-haiku-5-5",
"response": JsonResponse(
content_type="application/json",
body={
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-5-5",
"content": [
{"type": "thinking", "thinking": "scripted thought", "signature": "scripted signature"},
{"type": "text", "text": "scripted answer 10673f3a1db3"},
],
"container": None,
"stop_reason": "end_turn",
"stop_sequence": None,
"stop_details": None,
"usage": {
"input_tokens": 1840,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
"output_tokens": 412,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard",
"inference_geo": "global",
},
"diagnostics": None,
},
),
"expected": ExactExpected(
spend=0.000741, input_cost=0.0003496, output_cost=0.0003914, prompt_tokens=1840, completion_tokens=412
),
}
)
AZURE_AI_CLAUDE_HAIKU_5_5_STREAM: Final = CLAUDE_HAIKU_5_5_STREAM.model_copy(
update={
"name": "azure_ai/claude-haiku-5-5-stream",
"model": "azure_ai/claude-haiku-5-5",
"response": SseResponse(
content_type="text/event-stream",
frames=sse_frames(
*(
{
"type": "message_start",
"message": {
"id": "msg_$REQUEST_ID",
"type": "message",
"role": "assistant",
"model": "claude-haiku-5-5",
"content": [],
"stop_reason": None,
"stop_sequence": None,
"stop_details": None,
"container": None,
"diagnostics": None,
"usage": {
"input_tokens": 1840,
"output_tokens": 1,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {
"ephemeral_5m_input_tokens": 0,
"ephemeral_1h_input_tokens": 0,
},
"service_tier": "standard",
"inference_geo": "global",
},
},
},
{
"type": "content_block_start",
"index": 0,
"content_block": {"type": "thinking", "thinking": "", "signature": ""},
},
{"type": "ping"},
{
"type": "content_block_delta",
"index": 0,
"delta": {"type": "thinking_delta", "thinking": ""},
},
{
"type": "content_block_delta",
"index": 0,
"delta": {"type": "signature_delta", "signature": "scripted signature"},
},
{"type": "content_block_stop", "index": 0},
{
"type": "content_block_start",
"index": 1,
"content_block": {"type": "text", "text": ""},
},
*(
{
"type": "content_block_delta",
"index": 1,
"delta": {"type": "text_delta", "text": text},
}
for text in (
"scripted ",
"ans",
"wer ",
"2",
"b",
"f",
"9",
"b",
"c",
"b",
"a",
"4",
"444",
)
),
{"type": "content_block_stop", "index": 1},
{
"type": "message_delta",
"delta": {
"container": None,
"stop_details": None,
"stop_reason": "end_turn",
"stop_sequence": None,
},
"usage": {
"input_tokens": 1840,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"output_tokens": 412,
"output_tokens_details": {"thinking_tokens": 0},
},
},
{"type": "message_stop"},
)
),
),
"expected": ExactExpected(
spend=0.000741, input_cost=0.0003496, output_cost=0.0003914, prompt_tokens=1840, completion_tokens=412
),
}
)
PERPLEXITY_SONAR_NEXT_OFF_PEAK: Final = PERPLEXITY_SONAR_NEXT_NO_SEARCH.model_copy(
update={
"name": "perplexity-sonar-next-off_peak",
"deployment": Deployment(
off_peak_pricing=OffPeakPricing(
hours_utc=ALWAYS_OPEN_OFF_PEAK_WINDOW, input_cost_per_token=2.26e-06, output_cost_per_token=2.1e-06
)
),
"expected": ExactExpected(
spend=0.0050236, input_cost=0.0041584, output_cost=0.0008652, prompt_tokens=1840, completion_tokens=412
),
}
)
CASES: Final[tuple[CostTrackingTestCase, ...]] = (
PERPLEXITY_SONAR_NEXT_OFF_PEAK,
NOVA_NEXT_TRANSCRIPTIONS_PER_SECOND,
AMAZON_NOVA_CANVAS_NEXT_IMAGES_ONE,
COHERE_EMBEDDINGS_V5,
BEDROCK_EMBEDDINGS_TITAN_V2,
BEDROCK_COHERE_EMBEDDINGS_V4,
COHERE_RERANK_V4_ONE,
COHERE_RERANK_V4_THREE,
COHERE_RERANK_V4_TOTAL_TOKENS_FALLBACK,
BEDROCK_COHERE_RERANK_V4,
TEXT_COMPLETIONS_OPENAI_BASIC,
TEXT_COMPLETIONS_OPENAI_STREAM_USAGE,
TEXT_COMPLETIONS_OPENAI_N_BEST,
DASHSCOPE_QWEN4_MAX_TIERED_INPUT,
DASHSCOPE_QWEN4_MAX_TIERED_BOUNDARY_STAYS_LOWER_TIER,
DASHSCOPE_QWEN4_MAX_TIERED_SECOND_TIER,
DASHSCOPE_QWEN4_MAX_TIERED_ABOVE_TOP_RANGE,
OPENROUTER_ANTHROPIC_CLAUDE_SONNET_5_PROVIDER_REPORTED_COST,
OPENROUTER_ANTHROPIC_CLAUDE_SONNET_5_TOKEN_PRICED,
PERPLEXITY_SONAR_NEXT_NO_SEARCH,
DEEPSEEK_DEEPSEEK_V4_CHAT_PROMPT_CACHE_HIT,
DEEPSEEK_DEEPSEEK_V4_CHAT_NO_CACHE_FIELDS_BILLS_ZERO_CACHE,
XAI_GROK_5_REASONING_FOLDED_INTO_COMPLETION,
XAI_GROK_5_LIVE_SEARCH,
XAI_GROK_5_PROVIDER_REPORTED_COST,
BEDROCK_INVOKE_HAIKU_JSON,
BEDROCK_INVOKE_HAIKU_STREAM,
BEDROCK_INVOKE_HAIKU_CHAT_STREAM,
BEDROCK_INVOKE_HAIKU_RESPONSES,
AZURE_AI_GPT_5_4_MINI_LATEST,
AZURE_AI_GPT_5_4_MINI_LATEST_STREAM,
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_WEB_SEARCH,
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_WEB_SEARCH_STREAM,
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_WEB_SEARCH_ONE_REQUEST,
AZURE_AI_CLAUDE_HAIKU_4_5_MESSAGES_NO_SEARCH,
AZURE_AI_CLAUDE_HAIKU_4_5_CHAT_WEB_SEARCH,
AZURE_AI_CLAUDE_HAIKU_4_5_CHAT_WEB_SEARCH_STREAM,
AZURE_AI_CLAUDE_HAIKU_4_5_RESPONSES_WEB_SEARCH,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_WEB_SEARCH,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_WEB_SEARCH_STREAM,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_WEB_SEARCH_ZERO_RATE,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_MESSAGES_NO_SEARCH,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_CHAT_WEB_SEARCH,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_CHAT_WEB_SEARCH_STREAM,
AZURE_AI_CLAUDE_SONNET_4_5_DEPLOYMENT_RESPONSES_WEB_SEARCH,
GROQ_QWEN_3_8_JSON,
GROQ_QWEN_3_8_STREAM_X_GROQ_RECOUNT,
COHERE_COMMAND_A_V2_TOKENS,
MISTRAL_MEDIUM_2604_JSON,
XAI_GROK_4_7_INPUT_TEXT,
AZURE_AI_CLAUDE_FABLE_5_1_INPUT_TEXT,
AZURE_AI_CLAUDE_FABLE_5_1_STREAM,
AZURE_AI_CLAUDE_HAIKU_5_5_INPUT_TEXT,
AZURE_AI_CLAUDE_HAIKU_5_5_STREAM,
)
PARITY: Final[tuple[StreamParityTestCase, ...]] = (
StreamParityTestCase(plain=TEXT_COMPLETIONS_OPENAI_BASIC, streamed=TEXT_COMPLETIONS_OPENAI_STREAM_USAGE),
StreamParityTestCase(
plain=AZURE_AI_CLAUDE_FABLE_5_1_INPUT_TEXT, streamed=AZURE_AI_CLAUDE_FABLE_5_1_STREAM
),
StreamParityTestCase(
plain=AZURE_AI_CLAUDE_HAIKU_5_5_INPUT_TEXT, streamed=AZURE_AI_CLAUDE_HAIKU_5_5_STREAM
),
)