Skip to content

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

feat(fireworks_ai): add Decisions support for accounts/fireworks/routers/rune on /v1/systemone and /v1/decisions (#46057)

devin-ai-integration[bot]088184c24b7b
diff --git a/litellm/__init__.py b/litellm/__init__.py
index a33a78fb325..7046500c208 100644
--- a/litellm/__init__.py
+++ b/litellm/__init__.py
@@ -1689,6 +1689,9 @@ if TYPE_CHECKING:
from .llms.openrouter.decisions.transformation import (
OpenRouterDecisionsConfig as OpenRouterDecisionsConfig,
)
+ from .llms.fireworks_ai.decisions.transformation import (
+ FireworksAIDecisionsConfig as FireworksAIDecisionsConfig,
+ )
from .llms.cloudflare.decisions.transformation import (
CloudflareDecisionsConfig as CloudflareDecisionsConfig,
)
diff --git a/litellm/_lazy_imports_registry.py b/litellm/_lazy_imports_registry.py
index ce69de3b240..d683abda4cc 100644
--- a/litellm/_lazy_imports_registry.py
+++ b/litellm/_lazy_imports_registry.py
@@ -160,6 +160,7 @@ LLM_CONFIG_NAMES: Final = (
"PerplexityDecisionsConfig",
"TypeSafeDecisionsConfig",
"OpenRouterDecisionsConfig",
+ "FireworksAIDecisionsConfig",
"CloudflareDecisionsConfig",
"StrandsDeciderDecisionsConfig",
"DatabricksDecisionsConfig",
@@ -722,6 +723,7 @@ _LLM_CONFIGS_IMPORT_MAP: Final = {
"PerplexityDecisionsConfig": (".llms.perplexity.decisions.transformation", "PerplexityDecisionsConfig"),
"TypeSafeDecisionsConfig": (".llms.typesafe.decisions.transformation", "TypeSafeDecisionsConfig"),
"OpenRouterDecisionsConfig": (".llms.openrouter.decisions.transformation", "OpenRouterDecisionsConfig"),
+ "FireworksAIDecisionsConfig": (".llms.fireworks_ai.decisions.transformation", "FireworksAIDecisionsConfig"),
"CloudflareDecisionsConfig": (".llms.cloudflare.decisions.transformation", "CloudflareDecisionsConfig"),
"StrandsDeciderDecisionsConfig": (
".llms.strands_decider.decisions.transformation",
diff --git a/litellm/llms/fireworks_ai/decisions/transformation.py b/litellm/llms/fireworks_ai/decisions/transformation.py
new file mode 100644
index 00000000000..87d402902be
--- /dev/null
+++ b/litellm/llms/fireworks_ai/decisions/transformation.py
@@ -0,0 +1,20 @@
+from dataclasses import replace
+from typing import Final
+
+from litellm.llms.base_llm.decisions.transformation import BaseDecisionsConfig, parse_systemone_response
+from litellm.types.decisions import DecisionsIRRequest, DecisionsIRResponse
+
+
+class FireworksAIDecisionsConfig(BaseDecisionsConfig):
+ api_key_env = ("FIREWORKS_API_KEY", "FIREWORKS_AI_API_KEY")
+ api_base_env = ("FIREWORKS_API_BASE",)
+
+ def get_default_api_base(self) -> str | None:
+ return "https://api.fireworks.ai/inference/v1"
+
+ def parse_response(self, payload: object, request: DecisionsIRRequest) -> DecisionsIRResponse:
+ response: Final = parse_systemone_response(self.unwrap_response(payload), request)
+ cached: Final = response.usage.extra.get("cached_input_tokens")
+ if isinstance(cached, bool) or not isinstance(cached, int):
+ return response
+ return replace(response, usage=replace(response.usage, cached_tokens=cached))
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 777b68ac335..fb604f8be9e 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -69135,6 +69135,15 @@
"supports_response_schema": true,
"supports_tool_choice": true
},
+ "fireworks_ai/accounts/fireworks/routers/rune": {
+ "cache_read_input_token_cost": 8.4e-09,
+ "input_cost_per_token": 4.2e-08,
+ "litellm_provider": "fireworks_ai",
+ "max_input_tokens": 262144,
+ "mode": "evaluation",
+ "output_cost_per_token": 0.0,
+ "source": "https://docs.fireworks.ai"
+ },
"fireworks_ai/accounts/fireworks/models/ember-1": {
"cache_read_input_token_cost": 3e-07,
"cache_read_input_token_cost_priority": 3.75e-07,
diff --git a/litellm/utils.py b/litellm/utils.py
index 44dc75f45d7..0cecfa1cfc1 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -9018,6 +9018,8 @@ class ProviderConfigManager:
return litellm.TypeSafeDecisionsConfig()
if provider == LlmProviders.OPENROUTER:
return litellm.OpenRouterDecisionsConfig()
+ if provider == LlmProviders.FIREWORKS_AI:
+ return litellm.FireworksAIDecisionsConfig()
if provider == LlmProviders.CLOUDFLARE:
return litellm.CloudflareDecisionsConfig()
if provider == LlmProviders.STRANDS_DECIDER:
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index 777b68ac335..fb604f8be9e 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -69135,6 +69135,15 @@
"supports_response_schema": true,
"supports_tool_choice": true
},
+ "fireworks_ai/accounts/fireworks/routers/rune": {
+ "cache_read_input_token_cost": 8.4e-09,
+ "input_cost_per_token": 4.2e-08,
+ "litellm_provider": "fireworks_ai",
+ "max_input_tokens": 262144,
+ "mode": "evaluation",
+ "output_cost_per_token": 0.0,
+ "source": "https://docs.fireworks.ai"
+ },
"fireworks_ai/accounts/fireworks/models/ember-1": {
"cache_read_input_token_cost": 3e-07,
"cache_read_input_token_cost_priority": 3.75e-07,
diff --git a/provider_endpoints_support.json b/provider_endpoints_support.json
index ea617cf8462..5b179b2e8d8 100644
--- a/provider_endpoints_support.json
+++ b/provider_endpoints_support.json
@@ -1078,7 +1078,8 @@
"batches": false,
"rerank": true,
"a2a": true,
- "interactions": true
+ "interactions": true,
+ "systemone": true
}
},
"firecrawl": {
diff --git a/tests/integration/cost_calculation/cases/decisions.py b/tests/integration/cost_calculation/cases/decisions.py
index ea885e7ffcf..6216d2aa3c6 100644
--- a/tests/integration/cost_calculation/cases/decisions.py
+++ b/tests/integration/cost_calculation/cases/decisions.py
@@ -443,6 +443,72 @@ OPENROUTER_TYPESAFE_JEV_1_13_SYSTEMONE: Final = CostTrackingTestCase(
),
)
+# fireworks_ai/accounts/fireworks/routers/rune
+FIREWORKS_AI_RUNE_DECISIONS: Final = CostTrackingTestCase(
+ name="fireworks_ai/accounts/fireworks/routers/rune-decisions",
+ covers="quota_management.spend_tracking.decisions.logs_cost",
+ model="fireworks_ai/accounts/fireworks/routers/rune",
+ endpoint="/v1/decisions",
+ request={
+ "model": "$MODEL",
+ "input": "My order arrived broken and I want a refund today.",
+ "questions": [
+ {"type": "predicate", "name": "is_refund", "instructions": "Is the customer asking for a refund?"}
+ ],
+ },
+ upstream_body={
+ "model": "accounts/fireworks/routers/rune",
+ "state": "My order arrived broken and I want a refund today.",
+ "questions": {"is_refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"}},
+ },
+ response=JsonResponse(
+ content_type="application/json",
+ body={
+ "model": "accounts/fireworks/routers/rune",
+ "answers": {"is_refund": {"type": "noul", "noul": 0.99}},
+ "usage": {"input_tokens": 300, "cached_input_tokens": 200, "output_tokens": 0},
+ },
+ ),
+ expected=ExactExpected(
+ spend=5.88e-06,
+ input_cost=5.88e-06,
+ output_cost=0.0,
+ prompt_tokens=300,
+ completion_tokens=0,
+ ),
+)
+FIREWORKS_AI_RUNE_SYSTEMONE: Final = CostTrackingTestCase(
+ name="fireworks_ai/accounts/fireworks/routers/rune-systemone",
+ covers="quota_management.spend_tracking.systemone.logs_cost",
+ model="fireworks_ai/accounts/fireworks/routers/rune",
+ endpoint="/v1/systemone",
+ request={
+ "model": "$MODEL",
+ "state": "My order arrived broken and I want a refund today.",
+ "questions": {"is_refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"}},
+ },
+ upstream_body={
+ "model": "accounts/fireworks/routers/rune",
+ "state": "My order arrived broken and I want a refund today.",
+ "questions": {"is_refund": {"type": "noul", "instructions": "Is the customer asking for a refund?"}},
+ },
+ response=JsonResponse(
+ content_type="application/json",
+ body={
+ "model": "accounts/fireworks/routers/rune",
+ "answers": {"is_refund": {"type": "noul", "noul": 0.99}},
+ "usage": {"input_tokens": 300, "cached_input_tokens": 200, "output_tokens": 0},
+ },
+ ),
+ expected=ExactExpected(
+ spend=5.88e-06,
+ input_cost=5.88e-06,
+ output_cost=0.0,
+ prompt_tokens=300,
+ completion_tokens=0,
+ ),
+)
+
CASES: Final[tuple[CostTrackingTestCase, ...]] = (
OPENAI_GPT_6_LUNA_DECISIONS,
OPENAI_GPT_6_LUNA_SYSTEMONE,
@@ -456,6 +522,8 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
DATABRICKS_OPENJEV_QWEN35_4B_SYSTEMONE,
OPENROUTER_TYPESAFE_JEV_1_13_DECISIONS,
OPENROUTER_TYPESAFE_JEV_1_13_SYSTEMONE,
+ FIREWORKS_AI_RUNE_DECISIONS,
+ FIREWORKS_AI_RUNE_SYSTEMONE,
)
PARITY: Final[tuple[StreamParityTestCase, ...]] = ()
diff --git a/tests/integration/cost_calculation/cost_map.py b/tests/integration/cost_calculation/cost_map.py
index 6c10df5f423..532c9ebe49c 100644
--- a/tests/integration/cost_calculation/cost_map.py
+++ b/tests/integration/cost_calculation/cost_map.py
@@ -56,6 +56,13 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"input_cost_per_token": 4.2e-08,
"output_cost_per_token": 0.0,
},
+ "fireworks_ai/accounts/fireworks/routers/rune": {
+ "litellm_provider": "fireworks_ai",
+ "mode": "evaluation",
+ "input_cost_per_token": 4.2e-08,
+ "cache_read_input_token_cost": 8.4e-09,
+ "output_cost_per_token": 0.0,
+ },
"cloudflare/@cf/cloudflare/clef-flash": {
"litellm_provider": "cloudflare",
"mode": "evaluation",
diff --git a/tests/integration/providers/test_decisions_wire.py b/tests/integration/providers/test_decisions_wire.py
index 2862632d132..6d4e9ac8a30 100644
--- a/tests/integration/providers/test_decisions_wire.py
+++ b/tests/integration/providers/test_decisions_wire.py
@@ -99,6 +99,15 @@ _PROVIDERS: Final = (
_Provider(
"hosted_vllm", "hosted_vllm/Qwen/Qwen3-0.6B", "/v1/systemone", "Qwen/Qwen3-0.6B", None, False, None
),
+ _Provider(
+ "fireworks_ai",
+ "fireworks_ai/accounts/fireworks/routers/rune",
+ "/v1/systemone",
+ "accounts/fireworks/routers/rune",
+ _API_KEY,
+ False,
+ "fireworks_ai/accounts/fireworks/routers/rune",
+ ),
_Provider(
"cloudflare",
"cloudflare/clef",
diff --git a/tests/integration/proxy_config.yaml b/tests/integration/proxy_config.yaml
index a4928a31943..3136ecb5a09 100644
--- a/tests/integration/proxy_config.yaml
+++ b/tests/integration/proxy_config.yaml
@@ -349,6 +349,11 @@ model_list:
model: openrouter/typesafe/jev-1.13
api_base: http://127.0.0.1:8191
api_key: synthetic-openrouter-key
+ - model_name: fireworks_ai/accounts/fireworks/routers/rune
+ litellm_params:
+ model: fireworks_ai/accounts/fireworks/routers/rune
+ api_base: http://127.0.0.1:8191
+ api_key: synthetic-fireworks-key
- model_name: openrouter/anthropic/claude-sonnet-4
litellm_params:
model: openrouter/anthropic/claude-sonnet-4
diff --git a/tests/integration/translation/decisions/bases/fireworks_ai.py b/tests/integration/translation/decisions/bases/fireworks_ai.py
new file mode 100644
index 00000000000..672dc53d186
--- /dev/null
+++ b/tests/integration/translation/decisions/bases/fireworks_ai.py
@@ -0,0 +1,174 @@
+from typing import Final
+
+from integration.translation.case import TranslationTestCase
+
+"""Provider request and reply shape from Fireworks System One (POST /v1/systemone, private preview). Mock reply captured live on 2026-10-12.
+"""
+RUNE_TEST_CASE: Final = TranslationTestCase(
+ scenario="basic",
+ litellm_endpoint="/v1/decisions",
+ litellm_request={
+ "model": "fireworks_ai/accounts/fireworks/routers/rune",
+ "input": "Ticket (billing): The export job hangs at 99% and never finishes",
+ "questions": [
+ {"type": "predicate", "name": "defect", "instructions": "Is this a defect?"},
+ {
+ "type": "choice",
+ "name": "severity",
+ "instructions": "How severe is it?",
+ "choices": [
+ {"value": "low", "description": "cosmetic"},
+ {"value": "high", "description": "blocks users"},
+ ],
+ },
+ {
+ "type": "score",
+ "name": "confidence",
+ "instructions": "How sure are you?",
+ "levels": [{"label": "unsure"}, {"label": "sure"}],
+ },
+ ],
+ "cache": {"no-cache": True},
+ },
+ expected_provider_endpoint="/v1/systemone",
+ expected_provider_headers={"authorization": "Bearer synthetic-fireworks-key", "content-type": "application/json"},
+ expected_provider_request={
+ "model": "accounts/fireworks/routers/rune",
+ "state": "Ticket (billing): The export job hangs at 99% and never finishes",
+ "questions": {
+ "defect": {"type": "noul", "instructions": "Is this a defect?"},
+ "severity": {
+ "type": "choice",
+ "instructions": "How severe is it?",
+ "criteria": {"low": "cosmetic", "high": "blocks users"},
+ },
+ "confidence": {"type": "score", "instructions": "How sure are you?", "criteria": ["unsure", "sure"]},
+ },
+ },
+ mock_provider_response={
+ "model": "accounts/fireworks/routers/rune",
+ "answers": {
+ "defect": {"type": "noul", "noul": 0.9902915235185259},
+ "severity": {
+ "type": "choice",
+ "choice": "high",
+ "confidence": 0.6709670742068738,
+ "probabilities": {"high": 0.8354835371034369, "low": 0.1645164628965632},
+ },
+ "confidence": {
+ "type": "score",
+ "score": 0.7549149868676283,
+ "confidence": 0.5098299737352565,
+ "legend": {"0": "unsure", "1": "sure"},
+ "probabilities": {"0": 0.24508501313237172, "1": 0.7549149868676283},
+ },
+ },
+ "usage": {"input_tokens": 384, "cached_input_tokens": 0, "output_tokens": 0},
+ },
+ expected_litellm_response={
+ "model": "accounts/fireworks/routers/rune",
+ "answers": [
+ {"type": "predicate", "name": "defect", "probability": 0.9902915235185259},
+ {
+ "type": "choice",
+ "name": "severity",
+ "choice": "high",
+ "probabilities": [
+ {"value": "low", "probability": 0.1645164628965632},
+ {"value": "high", "probability": 0.8354835371034369},
+ ],
+ "confidence": 0.6709670742068738,
+ },
+ {
+ "type": "score",
+ "name": "confidence",
+ "score": 0.7549149868676283,
+ "probabilities": [
+ {"value": 0, "label": "unsure", "probability": 0.24508501313237172},
+ {"value": 1, "label": "sure", "probability": 0.7549149868676283},
+ ],
+ "confidence": 0.5098299737352565,
+ },
+ ],
+ "usage": {
+ "input_tokens": 384,
+ "input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
+ "output_tokens": 0,
+ "output_tokens_details": {"reasoning_tokens": 0},
+ "total_tokens": 384,
+ },
+ },
+)
+RUNE_SYSTEMONE_TEST_CASE: Final = TranslationTestCase(
+ scenario="systemone",
+ litellm_endpoint="/v1/systemone",
+ litellm_request={
+ "model": "fireworks_ai/accounts/fireworks/routers/rune",
+ "state": "Ticket (billing): The export job hangs at 99% and never finishes",
+ "questions": {
+ "defect": {"type": "noul", "instructions": "Is this a defect?"},
+ "severity": {
+ "type": "choice",
+ "instructions": "How severe is it?",
+ "criteria": {"low": "cosmetic", "high": "blocks users"},
+ },
+ "confidence": {"type": "score", "instructions": "How sure are you?", "criteria": ["unsure", "sure"]},
+ },
+ "cache": {"no-cache": True},
+ },
+ expected_provider_endpoint="/v1/systemone",
+ expected_provider_headers={"authorization": "Bearer synthetic-fireworks-key", "content-type": "application/json"},
+ expected_provider_request={
+ "model": "accounts/fireworks/routers/rune",
+ "state": "Ticket (billing): The export job hangs at 99% and never finishes",
+ "questions": {
+ "defect": {"type": "noul", "instructions": "Is this a defect?"},
+ "severity": {
+ "type": "choice",
+ "instructions": "How severe is it?",
+ "criteria": {"low": "cosmetic", "high": "blocks users"},
+ },
+ "confidence": {"type": "score", "instructions": "How sure are you?", "criteria": ["unsure", "sure"]},
+ },
+ },
+ mock_provider_response={
+ "model": "accounts/fireworks/routers/rune",
+ "answers": {
+ "defect": {"type": "noul", "noul": 0.9902915235185259},
+ "severity": {
+ "type": "choice",
+ "choice": "high",
+ "confidence": 0.6709670742068738,
+ "probabilities": {"high": 0.8354835371034369, "low": 0.1645164628965632},
+ },
+ "confidence": {
+ "type": "score",
+ "score": 0.7549149868676283,
+ "confidence": 0.5098299737352565,
+ "legend": {"0": "unsure", "1": "sure"},
+ "probabilities": {"0": 0.24508501313237172, "1": 0.7549149868676283},
+ },
+ },
+ "usage": {"input_tokens": 384, "cached_input_tokens": 0, "output_tokens": 0},
+ },
+ expected_litellm_response={
+ "model": "accounts/fireworks/routers/rune",
+ "answers": {
+ "defect": {"type": "noul", "noul": 0.9902915235185259},
+ "severity": {
+ "type": "choice",
+ "choice": "high",
+ "confidence": 0.6709670742068738,
+ "probabilities": {"high": 0.8354835371034369, "low": 0.1645164628965632},
+ },
+ "confidence": {
+ "type": "score",
+ "score": 0.7549149868676283,
+ "confidence": 0.5098299737352565,
+ "legend": {"0": "unsure", "1": "sure"},
+ "probabilities": {"0": 0.24508501313237172, "1": 0.7549149868676283},
+ },
+ },
+ "usage": {"input_tokens": 384, "cached_input_tokens": 0, "output_tokens": 0},
+ },
+)
diff --git a/tests/integration/translation/decisions/basic/test_decisions_basic_fireworks_ai.py b/tests/integration/translation/decisions/basic/test_decisions_basic_fireworks_ai.py
new file mode 100644
index 00000000000..ae767820d2c
--- /dev/null
+++ b/tests/integration/translation/decisions/basic/test_decisions_basic_fireworks_ai.py
@@ -0,0 +1,11 @@
+import pytest
+from integration._support.client import Gateway
+from integration._support.provider import SharedProvider
+from integration.translation.case import TranslationTestCase
+from integration.translation.decisions.bases.fireworks_ai import RUNE_SYSTEMONE_TEST_CASE, RUNE_TEST_CASE
+from integration.translation.runner import assert_translation
+
+
[email protected]("case", [RUNE_TEST_CASE, RUNE_SYSTEMONE_TEST_CASE], ids=lambda case: case.id)
+def test_decisions_basic_fireworks_ai(case: TranslationTestCase, gateway: Gateway, provider: SharedProvider) -> None:
+ assert_translation(case, gateway, provider)
diff --git a/tests/unit/decisions/test_main.py b/tests/unit/decisions/test_main.py
index e1b2028fa30..55cd93719dc 100644
--- a/tests/unit/decisions/test_main.py
+++ b/tests/unit/decisions/test_main.py
@@ -1730,3 +1730,67 @@ async def test_azure_ai_decision_requires_api_base_before_http(
)
assert len(respx_mock.calls) == 0
+
+
+_FIREWORKS_URL: Final = "https://api.fireworks.ai/inference/v1/systemone"
+_FIREWORKS_MODEL: Final = "fireworks_ai/accounts/fireworks/routers/rune"
+_FIREWORKS_RESPONSE: Final[Mapping[str, object]] = {
+ "model": "accounts/fireworks/routers/rune",
+ "answers": {"is_defect": {"type": "noul", "noul": 0.9902915235185259}},
+ "usage": {"input_tokens": 300, "cached_input_tokens": 200, "output_tokens": 0},
+}
+
+
+async def test_fireworks_ai_posts_the_jev_body_to_systemone_with_the_account_model_name(
+ monkeypatch: pytest.MonkeyPatch,
+ respx_mock: respx.MockRouter,
+) -> None:
+ monkeypatch.delenv("FIREWORKS_API_BASE", raising=False)
+ monkeypatch.delenv("FIREWORKS_API_KEY", raising=False)
+ monkeypatch.setenv("FIREWORKS_AI_API_KEY", "fireworks-key")
+ route: Final = respx_mock.post(_FIREWORKS_URL).respond(json=_FIREWORKS_RESPONSE)
+
+ response: Final = await litellm.asystemone(
+ model=_FIREWORKS_MODEL,
+ state="The package arrived broken.",
+ questions={"is_defect": {"type": "noul", "instructions": "Is this a defect?"}},
+ )
+
+ assert route.called
+ assert respx_mock.calls[0].request.headers["authorization"] == "Bearer fireworks-key"
+ assert json.loads(respx_mock.calls[0].request.content) == {
+ "model": "accounts/fireworks/routers/rune",
+ "state": "The package arrived broken.",
+ "questions": {"is_defect": {"type": "noul", "instructions": "Is this a defect?"}},
+ }
+ assert response.model == _FIREWORKS_RESPONSE["model"]
+ assert response.answers["is_defect"] == NoulAnswer(type="noul", noul=0.9902915235185259)
+
+
+async def test_fireworks_ai_bills_cached_input_tokens_at_the_cache_read_rate(
+ monkeypatch: pytest.MonkeyPatch,
+ respx_mock: respx.MockRouter,
+) -> None:
+ monkeypatch.delenv("FIREWORKS_API_BASE", raising=False)
+ respx_mock.post(_FIREWORKS_URL).respond(json=_FIREWORKS_RESPONSE)
+ prices: Final = litellm.model_cost[_FIREWORKS_MODEL]
+ uncached: Final = 100 * float(prices["input_cost_per_token"])
+ cached: Final = 200 * float(prices["cache_read_input_token_cost"])
+ recording_logger: Final = _RecordingLogger()
+ monkeypatch.setattr(litellm, "callbacks", [recording_logger])
+
+ response: Final = await litellm.adecisions(
+ model=_FIREWORKS_MODEL,
+ input="The package arrived broken.",
+ questions=[{"type": "predicate", "name": "is_defect", "instructions": "Is this a defect?"}],
+ api_key="caller-key",
+ )
+ await _drain_logging_worker()
+
+ assert cached > 0
+ assert response.usage.input_tokens_details.cached_tokens == 200
+ assert recording_logger.standard_logging_object is not None
+ assert recording_logger.standard_logging_object["response_cost"] == pytest.approx(uncached + cached)
+ assert recording_logger.standard_logging_object["response_cost"] < 300 * float(prices["input_cost_per_token"])