test(cost): sync tier 1 pricing and Terra coverage

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
devin-ai-integration[bot] 2026-11-01 17:45:15 +00:00 • committed by GitHub
parent 60fc121ce8
commit 26bab93015
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 894 additions and 8 deletions

View file

@ -6069,6 +6069,21 @@ PARITY: Final[tuple[StreamParityTestCase, ...]] = (
)
BRIDGE_COST_PARITY: Final[tuple[BridgeCostParityTestCase, ...]] = (
*bridge_pairs(
(AZURE_GPT_6_ASTRA_RESPONSES_JSON,),
("/v1/chat/completions",),
deployment=Deployment(model="azure/responses/gpt-6-astra"),
),
*bridge_pairs(
(AZURE_GPT_6_LUNA_RESPONSES_JSON,),
("/v1/chat/completions",),
deployment=Deployment(model="azure/responses/gpt-6-luna"),
),
*bridge_pairs(
(AZURE_GPT_6_1_SOL_RESPONSES_JSON,),
("/v1/chat/completions",),
deployment=Deployment(model="azure/responses/gpt-6.1-sol"),
),
*bridge_pairs(
(AZURE_GPT_5_6_INPUT_TEXT, AZURE_GPT_5_6_CACHE_READ, AZURE_GPT_5_6_STREAM, AZURE_GPT_5_6_REASONING),
("/v1/messages",),

View file

@ -23,6 +23,7 @@ def _gemini_case_response(
response: JsonResponse | SseResponse,
model_version: str,
usage_fields: dict[str, JsonValue] | None = None,
omit_usage_fields: frozenset[str] = frozenset(),
) -> JsonResponse | SseResponse:
match response:
case JsonResponse():
@ -35,11 +36,11 @@ def _gemini_case_response(
**(
{
"usageMetadata": {
**cast(dict[str, JsonValue], usage),
**usage_fields,
**{key: value for key, value in usage.items() if key not in omit_usage_fields},
**(usage_fields or {}),
}
}
if usage_fields is not None and isinstance(usage, dict)
if (usage_fields is not None or omit_usage_fields) and isinstance(usage, dict)
else {}
),
}
@ -49,17 +50,21 @@ def _gemini_case_response(
return response.model_copy(
update={
"frames": tuple(
_gemini_case_frame(frame, model_version, usage_fields) for frame in response.frames
_gemini_case_frame(frame, model_version, usage_fields, omit_usage_fields)
for frame in response.frames
)
}
)
def _gemini_case_frame(
frame: str, model_version: str, usage_fields: dict[str, JsonValue] | None
frame: str,
model_version: str,
usage_fields: dict[str, JsonValue] | None,
omit_usage_fields: frozenset[str] = frozenset(),
) -> str:
replaced: Final = frame.replace("gemini-3.8-flash", model_version)
if usage_fields is None:
if usage_fields is None and not omit_usage_fields:
return replaced
prefix, separator, payload = replaced.partition("data: ")
if not separator or payload == "[DONE]":
@ -68,7 +73,11 @@ def _gemini_case_frame(
usage: Final = event.get("usageMetadata")
if not isinstance(usage, dict):
return replaced
return f"{prefix}data: {json.dumps({**event, 'usageMetadata': {**usage, **usage_fields}})}"
updated_usage: Final = {
**{key: value for key, value in usage.items() if key not in omit_usage_fields},
**(usage_fields or {}),
}
return f"{prefix}data: {json.dumps({**event, 'usageMetadata': updated_usage})}"
def _gemini_case(
@ -79,13 +88,14 @@ def _gemini_case(
expected: ExactExpected,
*,
usage_fields: dict[str, JsonValue] | None = None,
omit_usage_fields: frozenset[str] = frozenset(),
) -> CostTrackingTestCase:
return sibling.model_copy(
update={
"name": name,
"model": model,
"response": _gemini_case_response(
cast(JsonResponse | SseResponse, sibling.response), model_version, usage_fields
cast(JsonResponse | SseResponse, sibling.response), model_version, usage_fields, omit_usage_fields
),
"expected": expected,
}
@ -3398,21 +3408,25 @@ GEMINI_GEMINI_4_ARGON_INPUT_TEXT: Final = _gemini_case(
GEMINI_GEMINI_3_8_FLASH_INPUT_TEXT, "gemini-gemini-4-argon-input_text", "gemini/gemini-4-argon",
"gemini-4-argon", ExactExpected(spend=0.00858, input_cost=0.004048, output_cost=0.004532, prompt_tokens=1840, completion_tokens=412),
usage_fields={"candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 412}]},
omit_usage_fields=frozenset({"serviceTier"}),
)
GEMINI_GEMINI_4_ARGON_STREAM: Final = _gemini_case(
GEMINI_GEMINI_3_8_FLASH_STREAM, "gemini-gemini-4-argon-stream", "gemini/gemini-4-argon",
"gemini-4-argon", ExactExpected(spend=0.00858, input_cost=0.004048, output_cost=0.004532, prompt_tokens=1840, completion_tokens=412),
usage_fields={"candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 412}]},
omit_usage_fields=frozenset({"serviceTier"}),
)
GEMINI_GEMINI_4_ARGON_CACHE_READ: Final = _gemini_case(
GEMINI_GEMINI_3_8_FLASH_CACHE_READ, "gemini-gemini-4-argon-cache_read", "gemini/gemini-4-argon",
"gemini-4-argon", ExactExpected(spend=0.00693968, input_cost=0.00275968, output_cost=0.00418, prompt_tokens=12928, completion_tokens=380),
usage_fields={"candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 380}]},
omit_usage_fields=frozenset({"serviceTier"}),
)
GEMINI_GEMINI_4_ARGON_REASONING: Final = _gemini_case(
GEMINI_GEMINI_3_8_FLASH_REASONING, "gemini-gemini-4-argon-reasoning", "gemini/gemini-4-argon",
"gemini-4-argon", ExactExpected(spend=0.047168, input_cost=0.002728, output_cost=0.04444, prompt_tokens=1240, completion_tokens=4040),
usage_fields={"candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 560}]},
omit_usage_fields=frozenset({"serviceTier"}),
)
GEMINI_GEMINI_4_ARGON_SERVICE_TIER_FLEX: Final = _gemini_case(
GEMINI_GEMINI_3_8_FLASH_SERVICE_TIER_FLEX,

View file

@ -12075,7 +12075,791 @@ GATEWAY_REPORTED_COST_OPENROUTER_OPERATOR_PRICED_STREAM: Final = (
)
)
GPT_6_1_TERRA_INPUT_TEXT: Final = CostTrackingTestCase(
name="gpt-6.1-terra-input_text",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
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",
"created": 1793550477,
"model": "gpt-6.1-terra",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Hello!", "refusal": None, "annotations": []},
"finish_reason": "stop",
}
],
"usage": {
"prompt_tokens": 1840,
"completion_tokens": 412,
"total_tokens": 2252,
"prompt_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0, "audio_tokens": 0},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0,
},
},
"service_tier": "default",
"system_fingerprint": None,
},
),
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_STREAM: Final = CostTrackingTestCase(
name="gpt-6.1-terra-stream",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
request={
"model": "$MODEL",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a deterministic pricing-harness assistant. Keep answers to a "
"single short line.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "fe2e0078a155 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": True,
"stream_options": {"include_usage": True},
"allowed_openai_params": [],
},
response=SseResponse(
content_type="text/event-stream",
frames=(
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"V6maPTGAg2ee7"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Please"},"finish_reason":null}],"usage":null,"obfuscation":"DeB2F5WWE"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'attach"},"finish_reason":null}],"usage":null,"obfuscation":"vhKBOJ81"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'the"},"finish_reason":null}],"usage":null,"obfuscation":"INVpNKhs7DW"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'material"},"finish_reason":null}],"usage":null,"obfuscation":"0O1Pvm"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'and"},"finish_reason":null}],"usage":null,"obfuscation":"MuEX4UDBYtT"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'specify"},"finish_reason":null}],"usage":null,"obfuscation":"ndkC0Cl"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'the"},"finish_reason":null}],"usage":null,"obfuscation":"q6k4WZYcNRM"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'city"},"finish_reason":null}],"usage":null,"obfuscation":"IpYix0p3PR"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'for"},"finish_reason":null}],"usage":null,"obfuscation":"rKxPKxRq4qx"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'the"},"finish_reason":null}],"usage":null,"obfuscation":"H3i2dOw4fnn"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" '
'weather"},"finish_reason":null}],"usage":null,"obfuscation":"SYkCNCB"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"KwuEGDWIiki1oD"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"FHSsHelue"}',
"data: "
'{"id":"chatcmpl-$REQUEST_ID","object":"chat.completion.chunk","created":1793550481,"model":"gpt-6.1-terra","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":1840,"completion_tokens":412,"total_tokens":2252,"prompt_tokens_details":{"cached_tokens":0,"cache_write_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"0MOoQz"}',
"data: [DONE]",
),
),
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_RESPONSES_NATIVE_JSON: Final = CostTrackingTestCase(
name="gpt-6.1-terra-responses_native_json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
endpoint="/v1/responses",
request={"model": "$MODEL", "input": "responses native fixture", "stream": False},
response=JsonResponse(
content_type="application/json",
body={
"id": "resp_$REQUEST_ID",
"object": "response",
"created_at": 1793550478,
"status": "completed",
"access_programs": {"cyber": "standard"},
"background": False,
"billing": {"payer": "developer"},
"completed_at": 1793550480,
"error": None,
"frequency_penalty": 0.0,
"incomplete_details": None,
"instructions": None,
"max_output_tokens": None,
"max_tool_calls": None,
"model": "gpt-6.1-terra",
"moderation": None,
"output": [
{
"id": "rs_$REQUEST_ID",
"type": "reasoning",
"content": [],
"encrypted_content": "gAAAAABq52iQo3ILWVDdQ9urPwquhcD7cD3bBTTat3yuH4RGh0k47sW-tcihEoa2U-3cTXx3sbe8M_zsmc-x3bBxuNOSDtdMGki6W5QlQAKXOawPDaJZfBXS6D_s1KquRjnZveQU5tSCyV61MYFnIBoxtTap_MD3CgyabiddVA2-1zLyyNf2gzGnuzW75-GScgzKPGDD-k-F7bJw4r0T8ZLzmLGG_OR2blLygTvAPu9MkRlm9swj70PCmvOojv2TVrSBTCcIBHa91DsNKr03e1IFDPAQ_63FuNqwv3H2O3BjtQxW2EcwlO2pn5pCinwRHp5dYG0-sXDYZqZRixQ65bvwT0yKsF1-Ehda1HwZnYmEUluJrPQMZs5IqTQmziRqdxo5xQmNdu_nfz0qpE-R0eLF4uOPcDaYlwbmwUC99G7vIgD2nC4l18R_iU213FN_R-Zb3z1VGG4Qy9p86mUep91AlEk0-49badioVT7DUgYMbgPXmzv9zfQY6EqXRqW4mhdYhLUDcwNcO7PK5lySX1occbZOdyyGOaypeGb8I1eX8vK32PlI-v8WZge0l673_sMTfPaOpsUAMw2yYoCQ3Ky5flxiDhv_26DSDVRBWwm1HqvsW-lqTKeTFXv9VWu753a6QbGS9fG1TcCy_v0_cilG02kVoX7uXH9U1EtUz_fu-jjE4to_NdULJS4anC6I--0na2nHQBjTmJ2Pg2CRdf8yQdJ-xXcP9EP_jrXEEze6wCfjBVUbEUwB4CIVM4IVWBz4h3eXAK-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saOPJPfLVoV5RfvJx5ID3CyLjD7FIx8iFXgwfEJdajjulUuSE0SvecHaO3y9dEEsGFUgi9WLc1cNOsplxPeOk1QjUoYZHPm2MxGvZ9j9G2wYb7GIAYPe3s6HgbZHZEH73vilA2RtlUwupChfBHaxA18HqJPHInA8wnazb94Gnjhdep5UswhmMdBtGnl6bl8cvveXHJY6f_eIEbEXm4qEs-qvqdqz3e-NjXTqb18BknQD79Npv3963SQduPeWEzz5TlFoqBXqPROx1U3MMQvHIIGu988dA-OszWTDyovY1yDkXRNqW5flJ8taID-Dpl0sDwNJPxq4ixnrlwQUG8FbMyGXVXdVbsykOoIJnqBZ-V69nzk9AqjjxcrRtzApR0zn8xh103WpQpB5BMkqwVOyWIkMkYQ0u0Ph5S3u4k5LmjqO-4oXdxmRMcSOgy3WYXiFO-tXGgNEPfT5lqRiA7Q6lA0lHc06K-pyu23KR2hBkpN7WLwH0nnUjtz7_CmU=",
"summary": [],
},
{
"id": "msg_$REQUEST_ID",
"type": "message",
"status": "completed",
"content": [
{"type": "output_text", "annotations": [], "logprobs": [], "text": "scripted response"}
],
"phase": "final_answer",
"role": "assistant",
},
],
"parallel_tool_calls": True,
"presence_penalty": 0.0,
"previous_response_id": None,
"prompt_cache_key": None,
"prompt_cache_retention": "24h",
"reasoning": {"context": "all_turns", "effort": "medium", "mode": "standard", "summary": None},
"safety_identifier": None,
"service_tier": "default",
"store": True,
"temperature": 1.0,
"text": {"format": {"type": "text"}, "verbosity": "medium"},
"tool_choice": "auto",
"tool_usage": {
"image_gen": {
"input_tokens": 0,
"input_tokens_details": {"image_tokens": 0, "text_tokens": 0},
"output_tokens": 0,
"output_tokens_details": {"image_tokens": 0, "text_tokens": 0},
"total_tokens": 0,
},
"web_search": {"num_requests": 0},
},
"tools": [],
"top_logprobs": 0,
"top_p": 0.98,
"truncation": "disabled",
"usage": {
"input_tokens": 1840,
"input_tokens_details": {"cache_write_tokens": 0, "cached_tokens": 0},
"output_tokens": 412,
"output_tokens_details": {"reasoning_tokens": 0},
"total_tokens": 2252,
},
"user": None,
"metadata": {},
},
),
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_RESPONSES_NATIVE_STREAM: Final = CostTrackingTestCase(
name="gpt-6.1-terra-responses_native_stream",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
endpoint="/v1/responses",
request={"model": "$MODEL", "input": "responses native fixture", "stream": True},
response=SseResponse(
content_type="text/event-stream",
frames=(
"event: response.created\n"
"data: "
'{"type":"response.created","response":{"id":"resp_$REQUEST_ID","object":"response","created_at":1793550482,"status":"in_progress","access_programs":{"cyber":"standard"},"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-6.1-terra","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"24h","reasoning":{"context":"all_turns","effort":"medium","mode":"standard","summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":0.98,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0}',
"event: response.in_progress\n"
"data: "
'{"type":"response.in_progress","response":{"id":"resp_$REQUEST_ID","object":"response","created_at":1793550482,"status":"in_progress","access_programs":{"cyber":"standard"},"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-6.1-terra","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"24h","reasoning":{"context":"all_turns","effort":"medium","mode":"standard","summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":0.98,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1}',
"event: response.output_item.added\n"
"data: "
'{"type":"response.output_item.added","item":{"id":"rs_$REQUEST_ID","type":"reasoning","content":[],"encrypted_content":"gAAAAABq52iT_lK9OyCJUuDXlzdJ3FX1QD01svdydIIJBHfWCL4eWlT26dAxoavxpPSzcTXNUZtcdR7EzrVqR0IyhCd-kPJJ9FdF_pomv_LUSaQf3Xal2znb3ByAz642c8jmew8nkfNiqHsgclkggndAbe13DZt_jmEb07JtnhKFEsu7qbQA4lVksJOe9ovwGqC5fKxYs2OSQz-hDrFkBPKZbtCNgRNixPq7D79_v9_azyHfVxK7MvpqvIBfiObNtZwBhLlL4HXKnA__BHGjAVYveH4RDKKTvHCcfObqw0RE00I9IMe3AE5LjkdwiUAXPVJe9IbinfcLeXWAXMOAbJCSF4k-OWBYtmbpaibyCZQZN6Yh_BubpFnJtsGiQVdZMtlyx4HuxvLAetIo9ppz7UEPLe0teaPWaxHUqMOpERl1ZcQJFmQEghxMPM2rk5sBBFgBr3tlQUmpxJEYT9A3N5WK9izrs9khZc9fazDDZrrSJ2wJdo5Yo0oXbJV3it2a_7UlfNNfLe_GHal4GSor5C_iki1dLhCkHLZAFdv-MgHeUXd9BTaH7Uc-yyCcN_LUpCS30QRVLOPZB86sr6ximq6nHasYknhDv4e52kHyGIgFMlFZxumypFe4JMVNBpHHBdNBpsdeD_Z1EPO8kpn7RNF6qch0KO2LDkNkSbW-NU5-OUXEosDW5wb84DF-1kctFpUfTwtI_vk0KwINbVcRLh0vHgNPwXEIUKPHKi4SU_tKyXc2m9DCirhhCjcdbRgAI2cEezxlLoE3qqrUg1VK1RxhEDcb7djiec4uZ9W8yZhLQURx9QnK5NXH_59MiNZpS54EbmiVYLkh19EQ1Widqm8eMz1xgv7Lyox-faHsUeESUbIb3BowijB_w3inKxzBbIipc0IdbRq2OSqbfLDEXn9ffcdIpjmpKcctgw0zjkIxU7_LuL3o2EM--iSgXPHN8v54EBpTpGrOKqKhJhleKkeAFwX_XR5lzGuwr78xf4H_h-ERbEoypFTI6e9r8Brrbkd3Ai4kjDy5lrZ6wh5LMpCpOuoFBu6DCl2GQtcSmimdKkx1QpjKAVwpx6OdlOAUr_Uf17XXvhQe_BACsL6F5l3dYFHwZ7-IPnhvXGvW3-EaeD35x9TaZQ-d3DRKHlvKBgtZ6c7wgk969UOB1cxLvd975MGZsuZbg2CjSqfD12U3rW35gnDDW7j2lBrUYuOKTF1bf2nO5ocl","summary":[]},"output_index":0,"sequence_number":2}',
"event: response.output_item.done\n"
"data: "
'{"type":"response.output_item.done","item":{"id":"rs_$REQUEST_ID","type":"reasoning","content":[],"encrypted_content":"gAAAAABq52iUqG8tEb_xF36BEfJWBH58SYtrRaBLB3-SJOeRPsdWLdX9L98t_9G6f9D11g6oIqiUS93TVazEp8z4jT1KZYIZb26G_i5LC_Xl72OqnIMDW2JoOopESrZ_ozSnTf9T6GANMZHhaUfQyx8mmUm3phdC1xYtFC_RKsXiNjDUL_7Tm6XE2SCgLICljezY17L94CNpuL0zrhQPoFOjdXeo4mCsKiBn4SAzC4-Y1qbM7KZOlCZSDxg-Dj5GEco1r2qzdq04RhvfVwDgHgvz4SXWLoDEfl4DkARGzkEflQAzjb7Ob_bB7vIjmEtaiI8fpAutCFTrDHSIuhmCuQVZMFaY-Hs6cuZ7TnFJlwEZV0Uz1mdD1-Z0E7UAZ9_H4uVsVTq256GHDl-Y6aaRhw0gqNzGg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ckVn8tjCabG6sX25hf1HcYmSNI7z6yLHnQWtYmIrR5pRjti2Mm069ezFHVuMkPZq7OlO6zo-ZWRMR1k5-cNcB0K_542rNST-mu87Qxv1gBMoAsN7RH-pQRD7yX--fdPfudQiIADessceNMtHpgK3oqVN4G3wCbkdE-z5UYBmAWschMjymShjR5Y5p9VmFe92_xW_D68O_Arj3mqTEl024Byf7MIiJVR3Ks49aPtfc2_-fDeKfwvu5nL-JiOPMeve8HAFI-k--5a5sp_Br3K0yzE5TfcVi2mAdMN18AGMvHk6u9fj0GI2DxlCPcI3hhRwBK2pVOZBRShzecHdYLgj8Bu2WT4zLiJMEXbqQQ_0MZS6C0cmnkSjjgvrZu7V5j0n7ivOOSKkMVKcC57pcqrwWCOLWSbeIakPFDCf5JeGnXQgaueI2wElpnalKn8J4g7Xf-q9rmW7Kxcw03hTabY-QlQC3QPLF7F3XsHadqecRZEb2-qVqksGW1nyVaDgwojdj6qCoGTHwls3vmYFnTwPwWnYgkEzQfyRefmCOkeUUat_kkXtcGmwmqbTwc-XTLHTbcPjy8WUAQc2gvctGhavLAotLT-G9vt4_0wbPgd297k5D9rRIF3z0kjOT1rEJRbDiEuCwsXQYT1WQEEFayko3XOy0wWzGDqvk7LFU4jZUaemP6TK2QfY50D4wwfoBCOhfZzfPqW8YcCLRTPiFQAu3ch-c90UdQqGgDf1v6uUP7-7_QkCugHq83eeL3JHAGGd4DcUZv_PlSF5EFpaHvE60iIOBIaC-lBqOs_5BWWhS0o=","summary":[]},"output_index":0,"sequence_number":3}',
"event: response.output_item.added\n"
"data: "
'{"type":"response.output_item.added","item":{"id":"msg_$REQUEST_ID","type":"message","status":"in_progress","content":[],"phase":"final_answer","role":"assistant"},"output_index":1,"sequence_number":4}',
"event: response.content_part.added\n"
"data: "
'{"type":"response.content_part.added","content_index":0,"item_id":"msg_$REQUEST_ID","output_index":1,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"scripted '
'response"},"sequence_number":5}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"BNlrxoKanmvoh","output_index":1,"sequence_number":6}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"d6wAn19psL70","output_index":1,"sequence_number":7}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"jMGY8bec","output_index":1,"sequence_number":8}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"HmpVCzj8PFzc","output_index":1,"sequence_number":9}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"9Vjs4mK0JawGR1","output_index":1,"sequence_number":10}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"HqaRQ2JEQ","output_index":1,"sequence_number":11}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"gdho1n5Vt","output_index":1,"sequence_number":12}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"K87IZj","output_index":1,"sequence_number":13}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"x5JBl1t1t7fr","output_index":1,"sequence_number":14}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"gjt97uyl","output_index":1,"sequence_number":15}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"q1LP8GolRM9Pfk7","output_index":1,"sequence_number":16}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"TYZMPgoiJYwGJ","output_index":1,"sequence_number":17}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"I3Gw9kr6Cq7g8","output_index":1,"sequence_number":18}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"Zz0A6WnHpDAVPnP","output_index":1,"sequence_number":19}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"5LEGsKITSF","output_index":1,"sequence_number":20}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"Nr6ahaM","output_index":1,"sequence_number":21}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"hEetz35s15FDz","output_index":1,"sequence_number":22}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"O5kMNPuVTYr","output_index":1,"sequence_number":23}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"HHChpZ","output_index":1,"sequence_number":24}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"aYh85gozY4Zp","output_index":1,"sequence_number":25}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"gQG8S0pMKCom","output_index":1,"sequence_number":26}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"jqOoYUeCiN","output_index":1,"sequence_number":27}',
"event: response.output_text.delta\n"
'data: {"type":"response.output_text.delta","content_index":0,"delta":"scripted '
'response","item_id":"msg_$REQUEST_ID","logprobs":[],"obfuscation":"FLNhK86Yqg2gYgq","output_index":1,"sequence_number":28}',
"event: response.output_text.done\n"
"data: "
'{"type":"response.output_text.done","content_index":0,"item_id":"msg_$REQUEST_ID","logprobs":[],"output_index":1,"sequence_number":29,"text":"scripted '
'response"}',
"event: response.content_part.done\n"
"data: "
'{"type":"response.content_part.done","content_index":0,"item_id":"msg_$REQUEST_ID","output_index":1,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"scripted '
'response"},"sequence_number":30}',
"event: response.output_item.done\n"
"data: "
'{"type":"response.output_item.done","item":{"id":"msg_$REQUEST_ID","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"scripted '
'response"}],"phase":"final_answer","role":"assistant"},"output_index":1,"sequence_number":31}',
"event: response.completed\n"
"data: "
'{"type":"response.completed","response":{"id":"resp_$REQUEST_ID","object":"response","created_at":1793550482,"status":"completed","access_programs":{"cyber":"standard"},"background":false,"completed_at":1793550484,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-6.1-terra","moderation":null,"output":[{"id":"rs_$REQUEST_ID","type":"reasoning","content":[],"encrypted_content":"gAAAAABq52iUDgldbCdlDfQqIlheMaTv1sfoxtG261Dz8GrQlERV2ayPHJ69kxZNRAN1bCj6d-W2ssHd962G1wjgtm-8BLs8RZluhpSxA-JaIERag4nuIzMeMAZWJGNCaXSHKsqO9hZl50GLt0EfC_VUD2KvZov4FN-uG31ydbOVojI5SspKq-iRh4HQ0cJPq67gQ47gep8zg2xUToLoQdm1sy4N_CnR0JJ-qKsHo19Mwi07y3ZYBJOm3bBGVRwjkqkkC85oP7xkWHU_CmHVYnOCLvtXfej8VEpHQ2kUJj6ZWSh7VfMCKynvj1vnZb2aVJ-IngO8qVpKjFx_hatfJH2HVOiu0Tg5pXZZkcihdR_nTBX_qFVvFuyxvFtafg45R8kL9nWfBNmM59yVuTz4rv2PTyAc2rKe59L_yBO_s9GJ8ENywKZICvB1tbbCIzBLgA7ovBhfnQPxY1VedCO2geHKwFlEcU2ePNzg58C-I9C3qG6ywU50-gbEiy4ECLayaOIVyjJbjwjcu8HLmmko_UKqhNOZ_PvQyt3Gg4QLeY2nTatNL71iPj3DobKSQq_gi2n7oJ0wN7asqPMWfec5EPq7lQxDlwpUas28Yu0Lpf_uEgLJn-VHPeVAw3vpeRblKdC_df6Y6v8jY5H9Htg0bV1qvg1Ow_hnHVHvB4QZyf46hU89lAwYiOPzofrUd_rUO3EHRZ_4Bu4gulI0LySulXbBSM98PXLwN8Ml-lVPqpJ2FZ6gRQtgZyTGmFk_DOdGdUz-1vwR61zYolDajZu6y7Y9Xlg8JydYBAOZN2Clf8BKbZ-5O13W5ks9UyNHIe7AUnYjIuu8a38T5zof1W1nRFDfrJFYiu5ul_zcNyIWF6v5fEAKIbnNYSXdTWwVZEBEkz3dHdZoJ_AEJIIUTzd5GN-JlBijdiwarOFqgGtOpNHr89MC1pSEOK9AucKWsOsYZxRTnSVYHGxWn9tgDLG733Skm7-r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ETsQCWv-MLdS3mQpZfCkhr9afabZXxyjvKkeje9G-RkAa3D8B-bqGTMoBsfu5zTDEAFLUP2Af8qsOzoRpEh8VYvnHQVO4LT_h4KLEVuswCzS1v3MWHjbZ4Bmi7UkyRf_a0LTJXjyMYTQyhMf21k92ghq8UL8_z-DC2SxIPylOIwsipgeIUzoHx_bNNAwwyuQhZhQ1eMsrbnpCzH9WmjQWSlnQ5rKcFmnWw=","summary":[]},{"id":"msg_$REQUEST_ID","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"scripted '
'response"}],"phase":"final_answer","role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"24h","reasoning":{"context":"all_turns","effort":"medium","mode":"standard","summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":0.98,"truncation":"disabled","usage":{"input_tokens":1840,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":412,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":2252},"user":null,"metadata":{}},"sequence_number":32}',
),
),
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_MESSAGES_BRIDGED_JSON: Final = CostTrackingTestCase(
name="gpt-6.1-terra-messages_bridged_json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [{"role": "user", "content": "responses native fixture"}],
},
response=GPT_6_1_TERRA_RESPONSES_NATIVE_JSON.response,
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_MESSAGES_BRIDGED_STREAM: Final = CostTrackingTestCase(
name="gpt-6.1-terra-messages_bridged_stream",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
endpoint="/v1/messages",
request={
"model": "$MODEL",
"max_tokens": 412,
"messages": [{"role": "user", "content": "responses native fixture"}],
"stream": True,
},
response=GPT_6_1_TERRA_RESPONSES_NATIVE_STREAM.response,
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_RESPONSES_DEPLOYMENT_JSON: Final = CostTrackingTestCase(
name="gpt-6.1-terra-responses_deployment_json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
endpoint="/v1/responses",
deployment=Deployment(model="openai/responses/gpt-6.1-terra"),
request={"model": "$MODEL", "input": "responses native fixture", "stream": False},
response=GPT_6_1_TERRA_RESPONSES_NATIVE_JSON.response,
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_CHAT_BRIDGED_JSON: Final = CostTrackingTestCase(
name="gpt-6.1-terra-chat_bridged_json",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
deployment=Deployment(model="openai/responses/gpt-6.1-terra"),
request={"model": "$MODEL", "messages": [{"role": "user", "content": "responses native fixture"}], "stream": False},
response=GPT_6_1_TERRA_RESPONSES_NATIVE_JSON.response,
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_CACHE_READ: Final = CostTrackingTestCase(
name="gpt-6.1-terra-cache_read",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
request={
"model": "$MODEL",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a deterministic pricing-harness assistant. Keep answers to a "
"single short line.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "b770f5df16a2 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"created": 1793550524,
"model": "gpt-6.1-terra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Material: alpha, beta, gamma, and delta; city and weather not specified.",
"refusal": None,
"annotations": [],
},
"finish_reason": "stop",
}
],
"usage": {
"prompt_tokens": 12928,
"completion_tokens": 380,
"total_tokens": 13308,
"prompt_tokens_details": {"cached_tokens": 12288, "cache_write_tokens": 0, "audio_tokens": 0},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0,
},
},
"service_tier": "default",
"system_fingerprint": None,
},
),
expected=ExactExpected(
spend=0.01167128, input_cost=0.00464128, output_cost=0.00703, prompt_tokens=12928, completion_tokens=380
),
)
GPT_6_1_TERRA_CACHE_WRITE_5M: Final = CostTrackingTestCase(
name="gpt-6.1-terra-cache_write_5m",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
request={
"model": "$MODEL",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a deterministic pricing-harness assistant. Keep answers to a "
"single short line.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "b770f5df16a2 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"created": 1793550522,
"model": "gpt-6.1-terra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The material mentions alpha, beta, gamma, and delta; no city or "
"weather is specified.",
"refusal": None,
"annotations": [],
},
"finish_reason": "stop",
}
],
"usage": {
"prompt_tokens": 12928,
"completion_tokens": 380,
"total_tokens": 13308,
"prompt_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 12288, "audio_tokens": 0},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0,
},
},
"service_tier": "default",
"system_fingerprint": None,
},
),
expected=ExactExpected(
spend=0.06623, input_cost=0.0592, output_cost=0.00703, prompt_tokens=12928, completion_tokens=380
),
)
GPT_6_1_TERRA_REASONING: Final = CostTrackingTestCase(
name="gpt-6.1-terra-reasoning",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
request={
"model": "$MODEL",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a deterministic pricing-harness assistant. Keep answers to a "
"single short line.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "6450817d8662 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
"reasoning_effort": "medium",
"allowed_openai_params": ["reasoning_effort"],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"created": 1793550519,
"model": "gpt-6.1-terra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Please attach the material and specify the city for the weather.",
"refusal": None,
"annotations": [],
},
"finish_reason": "stop",
}
],
"usage": {
"prompt_tokens": 1240,
"completion_tokens": 4040,
"total_tokens": 5280,
"prompt_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0, "audio_tokens": 0},
"completion_tokens_details": {
"reasoning_tokens": 3480,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0,
},
},
"service_tier": "default",
"system_fingerprint": None,
},
),
expected=ExactExpected(
spend=0.079328, input_cost=0.004588, output_cost=0.07474, prompt_tokens=1240, completion_tokens=4040
),
)
GPT_6_1_TERRA_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
name="gpt-6.1-terra-service_tier_priority",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
request={
"model": "$MODEL",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a deterministic pricing-harness assistant. Keep answers to a "
"single short line.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "27c98f26478e summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
"service_tier": "priority",
"allowed_openai_params": [],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"created": 1793550517,
"model": "gpt-6.1-terra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Please attach the material and specify the city.",
"refusal": None,
"annotations": [],
},
"finish_reason": "stop",
}
],
"usage": {
"prompt_tokens": 1840,
"completion_tokens": 412,
"total_tokens": 2252,
"prompt_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0, "audio_tokens": 0},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0,
},
},
"service_tier": "fast",
"system_fingerprint": None,
},
),
expected=ExactExpected(
spend=0.02886, input_cost=0.013616, output_cost=0.015244, prompt_tokens=1840, completion_tokens=412
),
)
GPT_6_1_TERRA_TOOL_CALL: Final = CostTrackingTestCase(
name="gpt-6.1-terra-tool_call",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
model="gpt-6.1-terra",
request={
"model": "$MODEL",
"messages": [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are a deterministic pricing-harness assistant. Keep answers to a "
"single short line.",
}
],
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "29a8fbc85239 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather and a short forecast for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"},
"days": {"type": "integer", "description": "Forecast horizon in days"},
"units": {"type": "string", "enum": ["metric", "imperial"]},
},
"required": ["city"],
},
},
}
],
"tool_choice": {"type": "function", "function": {"name": "get_weather"}},
"reasoning_effort": "none",
"allowed_openai_params": ["tool_choice", "reasoning_effort"],
},
response=JsonResponse(
content_type="application/json",
body={
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"created": 1793553086,
"model": "gpt-6.1-terra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": None,
"tool_calls": [
{
"id": "call_$REQUEST_ID",
"type": "function",
"function": {"name": "get_weather", "arguments": '{"city":"Paris"}'},
}
],
"refusal": None,
"annotations": [],
},
"finish_reason": "tool_calls",
}
],
"usage": {
"prompt_tokens": 1840,
"completion_tokens": 412,
"total_tokens": 2252,
"prompt_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0, "audio_tokens": 0},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0,
},
},
"service_tier": "default",
"system_fingerprint": None,
},
),
expected=ExactExpected(
spend=0.01443, input_cost=0.006808, output_cost=0.007622, prompt_tokens=1840, completion_tokens=412
),
)
CASES: Final[tuple[CostTrackingTestCase, ...]] = (
GPT_6_1_TERRA_INPUT_TEXT,
GPT_6_1_TERRA_STREAM,
GPT_6_1_TERRA_RESPONSES_NATIVE_JSON,
GPT_6_1_TERRA_RESPONSES_NATIVE_STREAM,
GPT_6_1_TERRA_MESSAGES_BRIDGED_JSON,
GPT_6_1_TERRA_MESSAGES_BRIDGED_STREAM,
GPT_6_1_TERRA_RESPONSES_DEPLOYMENT_JSON,
GPT_6_1_TERRA_CHAT_BRIDGED_JSON,
GPT_6_1_TERRA_CACHE_READ,
GPT_6_1_TERRA_CACHE_WRITE_5M,
GPT_6_1_TERRA_REASONING,
GPT_6_1_TERRA_SERVICE_TIER_PRIORITY,
GPT_6_1_TERRA_TOOL_CALL,
GATEWAY_REPORTED_COST,
GATEWAY_REPORTED_COST_STREAM,
GATEWAY_REPORTED_COST_OPERATOR_PRICED,
@ -12329,6 +13113,9 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
)
PARITY: Final[tuple[StreamParityTestCase, ...]] = (
StreamParityTestCase(plain=GPT_6_1_TERRA_INPUT_TEXT, streamed=GPT_6_1_TERRA_STREAM),
StreamParityTestCase(plain=GPT_6_1_TERRA_RESPONSES_NATIVE_JSON, streamed=GPT_6_1_TERRA_RESPONSES_NATIVE_STREAM),
StreamParityTestCase(plain=GPT_6_1_TERRA_MESSAGES_BRIDGED_JSON, streamed=GPT_6_1_TERRA_MESSAGES_BRIDGED_STREAM),
StreamParityTestCase(plain=GATEWAY_REPORTED_COST, streamed=GATEWAY_REPORTED_COST_STREAM),
StreamParityTestCase(
plain=GATEWAY_REPORTED_COST_OPERATOR_PRICED, streamed=GATEWAY_REPORTED_COST_OPERATOR_PRICED_STREAM
@ -12384,6 +13171,11 @@ PARITY: Final[tuple[StreamParityTestCase, ...]] = (
)
BRIDGE_COST_PARITY: Final[tuple[BridgeCostParityTestCase, ...]] = (
BridgeCostParityTestCase(native=GPT_6_1_TERRA_RESPONSES_NATIVE_JSON, bridged=GPT_6_1_TERRA_MESSAGES_BRIDGED_JSON),
BridgeCostParityTestCase(
native=GPT_6_1_TERRA_RESPONSES_NATIVE_STREAM, bridged=GPT_6_1_TERRA_MESSAGES_BRIDGED_STREAM
),
BridgeCostParityTestCase(native=GPT_6_1_TERRA_RESPONSES_DEPLOYMENT_JSON, bridged=GPT_6_1_TERRA_CHAT_BRIDGED_JSON),
*bridge_pairs(
(
GPT_5_6_RESPONSES_NATIVE_JSON,

View file

@ -7,6 +7,47 @@ from typing import Final
from pydantic import JsonValue
COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"gpt-6.1-terra": {
"cache_creation_input_token_cost": 4.625e-06,
"cache_creation_input_token_cost_above_12hr": 9.25e-06,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens": 1.85e-05,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_flex": 9.25e-06,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_priority": 3.7e-05,
"cache_creation_input_token_cost_above_12hr_flex": 4.625e-06,
"cache_creation_input_token_cost_above_12hr_priority": 1.85e-05,
"cache_creation_input_token_cost_above_272k_tokens": 9.25e-06,
"cache_creation_input_token_cost_above_272k_tokens_flex": 4.625e-06,
"cache_creation_input_token_cost_above_272k_tokens_priority": 1.85e-05,
"cache_creation_input_token_cost_flex": 2.3125e-06,
"cache_creation_input_token_cost_priority": 9.25e-06,
"cache_read_input_token_cost": 1.85e-07,
"cache_read_input_token_cost_above_272k_tokens": 3.7e-07,
"cache_read_input_token_cost_above_272k_tokens_flex": 1.85e-07,
"cache_read_input_token_cost_above_272k_tokens_priority": 7.4e-07,
"cache_read_input_token_cost_flex": 9.25e-08,
"cache_read_input_token_cost_priority": 3.7e-07,
"input_cost_per_token": 3.7e-06,
"input_cost_per_token_above_272k_tokens": 7.4e-06,
"input_cost_per_token_above_272k_tokens_flex": 3.7e-06,
"input_cost_per_token_above_272k_tokens_priority": 1.48e-05,
"input_cost_per_token_flex": 1.85e-06,
"input_cost_per_token_priority": 7.4e-06,
"litellm_provider": "openai",
"max_input_tokens": 922000,
"max_output_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 1.85e-05,
"output_cost_per_token_above_272k_tokens": 2.775e-05,
"output_cost_per_token_above_272k_tokens_flex": 1.3875e-05,
"output_cost_per_token_above_272k_tokens_priority": 5.55e-05,
"output_cost_per_token_flex": 9.25e-06,
"output_cost_per_token_priority": 3.7e-05,
"supported_endpoints": ["/v1/chat/completions", "/v1/batch", "/v1/responses"],
"supports_function_calling": True,
"supports_none_reasoning_effort": True,
"supports_prompt_caching": True,
"supports_reasoning": True,
},
"dashscope/qwen4-max": {
"litellm_provider": "dashscope",
"mode": "chat",
@ -1289,6 +1330,7 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"supports_function_calling": True,
},
"claude-opus-5-5": {
"provider_specific_entry": {"us": 1.1, "fast": 2},
"cache_creation_input_token_cost_above_1hr": 8e-06,
"litellm_provider": "anthropic",
"mode": "chat",
@ -1302,6 +1344,14 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"supports_function_calling": True,
},
"gpt-6.1-sol": {
"cache_creation_input_token_cost_above_12hr": 5e-06,
"cache_creation_input_token_cost_above_12hr_ultrafast": 3e-05,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens": 1e-05,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_flex": 5e-06,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_priority": 2e-05,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_ultrafast": 6e-05,
"cache_creation_input_token_cost_above_12hr_flex": 2.5e-06,
"cache_creation_input_token_cost_above_12hr_priority": 1e-05,
"output_cost_per_token_priority": 2e-05,
"input_cost_per_token_priority": 4e-06,
"output_cost_per_token_flex": 5e-06,
@ -1342,6 +1392,7 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"output_cost_per_token_ultrafast": 6e-05,
},
"claude-sonnet-5-5": {
"provider_specific_entry": {"us": 1.1},
"cache_creation_input_token_cost": 4.125e-06,
"cache_creation_input_token_cost_above_1hr": 6.6e-06,
"cache_read_input_token_cost": 3.3e-07,
@ -1355,6 +1406,7 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"supports_function_calling": True,
},
"claude-haiku-5-5": {
"provider_specific_entry": {"us": 1.1},
"cache_creation_input_token_cost": 1.375e-06,
"cache_creation_input_token_cost_above_1hr": 2.2e-06,
"cache_read_input_token_cost": 1.1e-07,
@ -1386,6 +1438,7 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"supports_function_calling": True,
},
"claude-fable-5-1": {
"provider_specific_entry": {"us": 1.1},
"cache_creation_input_token_cost": 2e-05,
"cache_creation_input_token_cost_above_1hr": 3.2e-05,
"cache_read_input_token_cost": 1.6e-06,
@ -1504,6 +1557,14 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"cache_read_input_token_cost_above_272k_tokens": 4.4e-07,
},
"gpt-6-astra": {
"cache_creation_input_token_cost_above_12hr": 3e-05,
"cache_creation_input_token_cost_above_12hr_ultrafast": 0.00018,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens": 6e-05,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_flex": 3e-05,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_priority": 0.00012,
"cache_creation_input_token_cost_above_12hr_above_272k_tokens_ultrafast": 0.00036,
"cache_creation_input_token_cost_above_12hr_flex": 1.5e-05,
"cache_creation_input_token_cost_above_12hr_priority": 6e-05,
"cache_read_input_token_cost": 1.2e-06,
"cache_creation_input_token_cost": 1.5e-05,
"cache_creation_input_token_cost_above_272k_tokens": 3e-05,
@ -1619,6 +1680,10 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"cache_read_input_token_cost_above_272k_tokens": 2.6e-08,
},
"azure/gpt-6-astra": {
"cache_creation_input_token_cost_above_272k_tokens_flex": 1.5625e-05,
"cache_read_input_token_cost_above_272k_tokens_flex": 1.25e-06,
"input_cost_per_token_above_272k_tokens_flex": 1.25e-05,
"output_cost_per_token_above_272k_tokens_flex": 4.6875e-05,
"cache_read_input_token_cost": 1.25e-06,
"cache_creation_input_token_cost": 1.5625e-05,
"cache_creation_input_token_cost_above_272k_tokens": 3.125e-05,