cacherift 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cacherift/__init__.py +5 -0
- cacherift/capabilities/__init__.py +1 -0
- cacherift/capabilities/registry.py +176 -0
- cacherift/capabilities/tables/default_capabilities.toml +156 -0
- cacherift/capabilities/tables/default_pricing.toml +232 -0
- cacherift/check/__init__.py +1 -0
- cacherift/check/cli.py +126 -0
- cacherift/check/evaluator.py +158 -0
- cacherift/check/policy.py +204 -0
- cacherift/check/pytest_plugin.py +103 -0
- cacherift/cli.py +383 -0
- cacherift/core/__init__.py +1 -0
- cacherift/core/diagnoser.py +441 -0
- cacherift/core/diff.py +455 -0
- cacherift/core/freeze.py +86 -0
- cacherift/core/lineage.py +267 -0
- cacherift/core/models.py +248 -0
- cacherift/core/pricing.py +112 -0
- cacherift/core/span.py +149 -0
- cacherift/dialects/__init__.py +1 -0
- cacherift/dialects/anthropic_messages.py +283 -0
- cacherift/dialects/base.py +304 -0
- cacherift/dialects/deepseek_chat.py +49 -0
- cacherift/dialects/gemini_generate.py +144 -0
- cacherift/dialects/openai_chat.py +139 -0
- cacherift/dialects/openai_responses.py +265 -0
- cacherift/io/__init__.py +1 -0
- cacherift/io/capture.py +132 -0
- cacherift/io/redact.py +94 -0
- cacherift/probe/__init__.py +1 -0
- cacherift/probe/budget.py +151 -0
- cacherift/probe/cli.py +399 -0
- cacherift/probe/runner.py +383 -0
- cacherift/probe/scenarios.py +369 -0
- cacherift/proxy/__init__.py +1 -0
- cacherift/proxy/app.py +436 -0
- cacherift/proxy/cli.py +130 -0
- cacherift/proxy/recorder.py +95 -0
- cacherift/proxy/sse.py +122 -0
- cacherift/repair/__init__.py +1 -0
- cacherift/repair/cli.py +177 -0
- cacherift/repair/engine.py +174 -0
- cacherift/repair/models.py +90 -0
- cacherift/repair/rules.py +226 -0
- cacherift-0.2.0.dist-info/METADATA +177 -0
- cacherift-0.2.0.dist-info/RECORD +50 -0
- cacherift-0.2.0.dist-info/WHEEL +5 -0
- cacherift-0.2.0.dist-info/entry_points.txt +5 -0
- cacherift-0.2.0.dist-info/licenses/LICENSE +193 -0
- cacherift-0.2.0.dist-info/top_level.txt +1 -0
cacherift/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Capability and pricing registries backed by versioned static TOML tables."""
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""Lookup registry for provider/model prompt-caching capabilities."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import tomllib
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from importlib import resources
|
|
8
|
+
from typing import Any, Literal, cast
|
|
9
|
+
|
|
10
|
+
from cacherift.core.freeze import freeze_json
|
|
11
|
+
from cacherift.core.models import CapabilityInfo
|
|
12
|
+
from cacherift.core.pricing import PricingRule, PricingTable
|
|
13
|
+
|
|
14
|
+
_UNKNOWN_CAPABILITY = CapabilityInfo(
|
|
15
|
+
min_cache_tokens=None,
|
|
16
|
+
ttl_semantics=None,
|
|
17
|
+
ttl_seconds_hint=None,
|
|
18
|
+
prefix_order_note=None,
|
|
19
|
+
support_level="unknown",
|
|
20
|
+
source_version=None,
|
|
21
|
+
unit_order=(),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True, slots=True)
|
|
26
|
+
class _CapabilityRule:
|
|
27
|
+
dialect: str
|
|
28
|
+
provider: str
|
|
29
|
+
model_pattern: str
|
|
30
|
+
gateway_profile: str
|
|
31
|
+
info: CapabilityInfo
|
|
32
|
+
|
|
33
|
+
def match_score(
|
|
34
|
+
self,
|
|
35
|
+
dialect: str,
|
|
36
|
+
provider: str,
|
|
37
|
+
model: str,
|
|
38
|
+
gateway_profile: str | None,
|
|
39
|
+
) -> tuple[int, int, int] | None:
|
|
40
|
+
if self.dialect != dialect or self.provider != provider:
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
if self.gateway_profile != "*":
|
|
44
|
+
if gateway_profile != self.gateway_profile:
|
|
45
|
+
return None
|
|
46
|
+
gw_score = 1
|
|
47
|
+
else:
|
|
48
|
+
gw_score = 0
|
|
49
|
+
|
|
50
|
+
if self.model_pattern.endswith("*"):
|
|
51
|
+
prefix = self.model_pattern[:-1]
|
|
52
|
+
if not model.startswith(prefix):
|
|
53
|
+
return None
|
|
54
|
+
return (0, len(prefix), gw_score)
|
|
55
|
+
|
|
56
|
+
if model != self.model_pattern:
|
|
57
|
+
return None
|
|
58
|
+
return (1, len(self.model_pattern), gw_score)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class CapabilityRegistry:
|
|
62
|
+
"""Versioned static registry mapping (dialect, provider, model, gateway_profile) to info."""
|
|
63
|
+
|
|
64
|
+
def __init__(self, rules: tuple[_CapabilityRule, ...]) -> None:
|
|
65
|
+
self._rules = rules
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def load_default(cls) -> CapabilityRegistry:
|
|
69
|
+
raw_bytes = (
|
|
70
|
+
resources.files("cacherift.capabilities.tables")
|
|
71
|
+
.joinpath("default_capabilities.toml")
|
|
72
|
+
.read_bytes()
|
|
73
|
+
)
|
|
74
|
+
return cls.from_toml_bytes(raw_bytes)
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_toml_bytes(cls, data: bytes) -> CapabilityRegistry:
|
|
78
|
+
parsed: dict[str, Any] = tomllib.loads(data.decode("utf-8"))
|
|
79
|
+
rules: list[_CapabilityRule] = []
|
|
80
|
+
for entry in parsed.get("capabilities", []):
|
|
81
|
+
support_raw = str(entry.get("support_level", "unknown"))
|
|
82
|
+
support_level: Literal["full", "usage_only", "unknown"] = cast(
|
|
83
|
+
Literal["full", "usage_only", "unknown"],
|
|
84
|
+
support_raw if support_raw in ("full", "usage_only", "unknown") else "unknown",
|
|
85
|
+
)
|
|
86
|
+
min_tokens = entry.get("min_cache_tokens")
|
|
87
|
+
ttl_hint = entry.get("ttl_seconds_hint")
|
|
88
|
+
info = CapabilityInfo(
|
|
89
|
+
min_cache_tokens=int(min_tokens) if min_tokens is not None else None,
|
|
90
|
+
ttl_semantics=entry.get("ttl_semantics"),
|
|
91
|
+
ttl_seconds_hint=int(ttl_hint) if ttl_hint is not None else None,
|
|
92
|
+
prefix_order_note=entry.get("prefix_order_note"),
|
|
93
|
+
support_level=support_level,
|
|
94
|
+
source_version=entry.get("source_version"),
|
|
95
|
+
unit_order=tuple(str(u) for u in entry.get("unit_order", ())),
|
|
96
|
+
)
|
|
97
|
+
rules.append(
|
|
98
|
+
_CapabilityRule(
|
|
99
|
+
dialect=str(entry["dialect"]),
|
|
100
|
+
provider=str(entry["provider"]),
|
|
101
|
+
model_pattern=str(entry["model_pattern"]),
|
|
102
|
+
gateway_profile=str(entry.get("gateway_profile", "*")),
|
|
103
|
+
info=info,
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
return cls(tuple(rules))
|
|
107
|
+
|
|
108
|
+
def lookup(
|
|
109
|
+
self,
|
|
110
|
+
dialect: str,
|
|
111
|
+
provider: str,
|
|
112
|
+
model: str,
|
|
113
|
+
gateway_profile: str | None = None,
|
|
114
|
+
) -> CapabilityInfo:
|
|
115
|
+
"""Return matching capability declaration or explicit unknown/None metadata."""
|
|
116
|
+
best_score: tuple[int, int, int] | None = None
|
|
117
|
+
best_info: CapabilityInfo = _UNKNOWN_CAPABILITY
|
|
118
|
+
for rule in self._rules:
|
|
119
|
+
score = rule.match_score(dialect, provider, model, gateway_profile)
|
|
120
|
+
if score is not None and (best_score is None or score > best_score):
|
|
121
|
+
best_score = score
|
|
122
|
+
best_info = rule.info
|
|
123
|
+
return best_info
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class PricingRegistry:
|
|
127
|
+
"""Versioned static registry loading PricingTable entries from TOML."""
|
|
128
|
+
|
|
129
|
+
def __init__(self, tables: dict[str, PricingTable]) -> None:
|
|
130
|
+
self._tables = tables
|
|
131
|
+
|
|
132
|
+
@classmethod
|
|
133
|
+
def load_default(cls) -> PricingRegistry:
|
|
134
|
+
raw_bytes = (
|
|
135
|
+
resources.files("cacherift.capabilities.tables")
|
|
136
|
+
.joinpath("default_pricing.toml")
|
|
137
|
+
.read_bytes()
|
|
138
|
+
)
|
|
139
|
+
return cls.from_toml_bytes(raw_bytes)
|
|
140
|
+
|
|
141
|
+
@classmethod
|
|
142
|
+
def from_toml_bytes(cls, data: bytes) -> PricingRegistry:
|
|
143
|
+
parsed: dict[str, Any] = tomllib.loads(data.decode("utf-8"))
|
|
144
|
+
tables: dict[str, PricingTable] = {}
|
|
145
|
+
for t_entry in parsed.get("tables", []):
|
|
146
|
+
table_id = str(t_entry["pricing_table_id"])
|
|
147
|
+
source_version = t_entry.get("source_version")
|
|
148
|
+
rules: list[PricingRule] = []
|
|
149
|
+
for r_entry in t_entry.get("rules", []):
|
|
150
|
+
write_raw = {
|
|
151
|
+
str(k): float(v) for k, v in dict(r_entry.get("write_per_1m") or {}).items()
|
|
152
|
+
}
|
|
153
|
+
rules.append(
|
|
154
|
+
PricingRule(
|
|
155
|
+
provider=str(r_entry["provider"]),
|
|
156
|
+
model_pattern=str(r_entry["model_pattern"]),
|
|
157
|
+
uncached_input_per_1m=float(r_entry["uncached_input_per_1m"]),
|
|
158
|
+
cache_read_per_1m=float(r_entry["cache_read_per_1m"]),
|
|
159
|
+
output_per_1m=float(r_entry["output_per_1m"]),
|
|
160
|
+
write_per_1m=freeze_json(write_raw),
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
tables[table_id] = PricingTable(
|
|
164
|
+
pricing_table_id=table_id,
|
|
165
|
+
rules=tuple(rules),
|
|
166
|
+
source_version=str(source_version) if source_version is not None else None,
|
|
167
|
+
)
|
|
168
|
+
return cls(tables)
|
|
169
|
+
|
|
170
|
+
def get_table(self, pricing_table_id: str) -> PricingTable | None:
|
|
171
|
+
return self._tables.get(pricing_table_id)
|
|
172
|
+
|
|
173
|
+
def default_table_id(self) -> str | None:
|
|
174
|
+
"""ID of the newest registered ``default-*`` table, or None when there is none."""
|
|
175
|
+
defaults = sorted(table_id for table_id in self._tables if table_id.startswith("default-"))
|
|
176
|
+
return defaults[-1] if defaults else None
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Versioned capability metadata (not a fallback heuristic).
|
|
2
|
+
# Unregistered (dialect, provider, model, gateway_profile) combinations return unknown/None.
|
|
3
|
+
|
|
4
|
+
[[capabilities]]
|
|
5
|
+
dialect = "openai_responses"
|
|
6
|
+
provider = "openai"
|
|
7
|
+
model_pattern = "gpt-6.2*"
|
|
8
|
+
gateway_profile = "*"
|
|
9
|
+
min_cache_tokens = 1024
|
|
10
|
+
ttl_semantics = "best_effort_5_10m_or_24h_retention"
|
|
11
|
+
ttl_seconds_hint = 300
|
|
12
|
+
prefix_order_note = "GPT-6.2 Responses: tools -> input -> instructions (top-level instructions are not cached across turns)"
|
|
13
|
+
support_level = "full"
|
|
14
|
+
source_version = "openai-docs-2026-11"
|
|
15
|
+
unit_order = ["tools", "input", "instructions"]
|
|
16
|
+
|
|
17
|
+
[[capabilities]]
|
|
18
|
+
dialect = "openai_responses"
|
|
19
|
+
provider = "openai"
|
|
20
|
+
model_pattern = "gpt-6.1*"
|
|
21
|
+
gateway_profile = "*"
|
|
22
|
+
min_cache_tokens = 1024
|
|
23
|
+
ttl_semantics = "best_effort_5_10m_or_24h_retention"
|
|
24
|
+
ttl_seconds_hint = 300
|
|
25
|
+
prefix_order_note = "tools -> instructions -> input"
|
|
26
|
+
support_level = "full"
|
|
27
|
+
source_version = "openai-docs-2026-11"
|
|
28
|
+
unit_order = ["tools", "instructions", "input"]
|
|
29
|
+
|
|
30
|
+
[[capabilities]]
|
|
31
|
+
dialect = "openai_responses"
|
|
32
|
+
provider = "openai"
|
|
33
|
+
model_pattern = "gpt-5*"
|
|
34
|
+
gateway_profile = "*"
|
|
35
|
+
min_cache_tokens = 1024
|
|
36
|
+
ttl_semantics = "best_effort_5_10m_or_24h_retention"
|
|
37
|
+
ttl_seconds_hint = 300
|
|
38
|
+
prefix_order_note = "tools -> instructions -> input"
|
|
39
|
+
support_level = "full"
|
|
40
|
+
source_version = "openai-docs-2026-11"
|
|
41
|
+
unit_order = ["tools", "instructions", "input"]
|
|
42
|
+
|
|
43
|
+
[[capabilities]]
|
|
44
|
+
dialect = "anthropic_messages"
|
|
45
|
+
provider = "anthropic"
|
|
46
|
+
model_pattern = "claude-sonnet-4*"
|
|
47
|
+
gateway_profile = "*"
|
|
48
|
+
min_cache_tokens = 1024
|
|
49
|
+
ttl_semantics = "ephemeral_5m_or_1h"
|
|
50
|
+
ttl_seconds_hint = 300
|
|
51
|
+
prefix_order_note = "tools -> system -> messages"
|
|
52
|
+
support_level = "full"
|
|
53
|
+
source_version = "anthropic-docs-2026-11"
|
|
54
|
+
unit_order = ["tools", "system", "messages"]
|
|
55
|
+
|
|
56
|
+
[[capabilities]]
|
|
57
|
+
dialect = "anthropic_messages"
|
|
58
|
+
provider = "anthropic"
|
|
59
|
+
model_pattern = "claude-opus-4*"
|
|
60
|
+
gateway_profile = "*"
|
|
61
|
+
min_cache_tokens = 1024
|
|
62
|
+
ttl_semantics = "ephemeral_5m_or_1h"
|
|
63
|
+
ttl_seconds_hint = 300
|
|
64
|
+
prefix_order_note = "tools -> system -> messages"
|
|
65
|
+
support_level = "full"
|
|
66
|
+
source_version = "anthropic-docs-2026-11"
|
|
67
|
+
unit_order = ["tools", "system", "messages"]
|
|
68
|
+
|
|
69
|
+
# https://platform.claude.com/docs/en/build-with-claude/prompt-caching, checked 2026-11-27:
|
|
70
|
+
# Opus 4.6/4.5 and Haiku 4.5 require a 4096-token minimum cacheable prefix.
|
|
71
|
+
[[capabilities]]
|
|
72
|
+
dialect = "anthropic_messages"
|
|
73
|
+
provider = "anthropic"
|
|
74
|
+
model_pattern = "claude-opus-4-6*"
|
|
75
|
+
gateway_profile = "*"
|
|
76
|
+
min_cache_tokens = 4096
|
|
77
|
+
ttl_semantics = "ephemeral_5m_or_1h"
|
|
78
|
+
ttl_seconds_hint = 300
|
|
79
|
+
prefix_order_note = "tools -> system -> messages"
|
|
80
|
+
support_level = "full"
|
|
81
|
+
source_version = "anthropic-docs-2026-11"
|
|
82
|
+
unit_order = ["tools", "system", "messages"]
|
|
83
|
+
|
|
84
|
+
[[capabilities]]
|
|
85
|
+
dialect = "anthropic_messages"
|
|
86
|
+
provider = "anthropic"
|
|
87
|
+
model_pattern = "claude-opus-4-5*"
|
|
88
|
+
gateway_profile = "*"
|
|
89
|
+
min_cache_tokens = 4096
|
|
90
|
+
ttl_semantics = "ephemeral_5m_or_1h"
|
|
91
|
+
ttl_seconds_hint = 300
|
|
92
|
+
prefix_order_note = "tools -> system -> messages"
|
|
93
|
+
support_level = "full"
|
|
94
|
+
source_version = "anthropic-docs-2026-11"
|
|
95
|
+
unit_order = ["tools", "system", "messages"]
|
|
96
|
+
|
|
97
|
+
[[capabilities]]
|
|
98
|
+
dialect = "anthropic_messages"
|
|
99
|
+
provider = "anthropic"
|
|
100
|
+
model_pattern = "claude-haiku-4*"
|
|
101
|
+
gateway_profile = "*"
|
|
102
|
+
min_cache_tokens = 2048
|
|
103
|
+
ttl_semantics = "ephemeral_5m_or_1h"
|
|
104
|
+
ttl_seconds_hint = 300
|
|
105
|
+
prefix_order_note = "tools -> system -> messages"
|
|
106
|
+
support_level = "full"
|
|
107
|
+
source_version = "anthropic-docs-2026-11"
|
|
108
|
+
unit_order = ["tools", "system", "messages"]
|
|
109
|
+
|
|
110
|
+
[[capabilities]]
|
|
111
|
+
dialect = "anthropic_messages"
|
|
112
|
+
provider = "anthropic"
|
|
113
|
+
model_pattern = "claude-haiku-4-5*"
|
|
114
|
+
gateway_profile = "*"
|
|
115
|
+
min_cache_tokens = 4096
|
|
116
|
+
ttl_semantics = "ephemeral_5m_or_1h"
|
|
117
|
+
ttl_seconds_hint = 300
|
|
118
|
+
prefix_order_note = "tools -> system -> messages"
|
|
119
|
+
support_level = "full"
|
|
120
|
+
source_version = "anthropic-docs-2026-11"
|
|
121
|
+
unit_order = ["tools", "system", "messages"]
|
|
122
|
+
|
|
123
|
+
[[capabilities]]
|
|
124
|
+
dialect = "openai_chat"
|
|
125
|
+
provider = "openai"
|
|
126
|
+
model_pattern = "gpt-4*"
|
|
127
|
+
gateway_profile = "*"
|
|
128
|
+
min_cache_tokens = 1024
|
|
129
|
+
ttl_semantics = "best_effort_5_10m"
|
|
130
|
+
ttl_seconds_hint = 300
|
|
131
|
+
prefix_order_note = "usage_only: tools -> messages"
|
|
132
|
+
support_level = "usage_only"
|
|
133
|
+
source_version = "openai-docs-2026-11"
|
|
134
|
+
unit_order = ["tools", "messages"]
|
|
135
|
+
|
|
136
|
+
[[capabilities]]
|
|
137
|
+
dialect = "deepseek_chat"
|
|
138
|
+
provider = "deepseek"
|
|
139
|
+
model_pattern = "deepseek-*"
|
|
140
|
+
gateway_profile = "*"
|
|
141
|
+
ttl_semantics = "automatic_disk_kv_cache"
|
|
142
|
+
prefix_order_note = "usage_only: deepseek prompt_cache_hit/miss_tokens"
|
|
143
|
+
support_level = "usage_only"
|
|
144
|
+
source_version = "deepseek-docs-2026-11"
|
|
145
|
+
unit_order = ["tools", "messages"]
|
|
146
|
+
|
|
147
|
+
[[capabilities]]
|
|
148
|
+
dialect = "gemini_generate_content"
|
|
149
|
+
provider = "gemini"
|
|
150
|
+
model_pattern = "gemini-2.5*"
|
|
151
|
+
gateway_profile = "*"
|
|
152
|
+
ttl_semantics = "implicit_or_cached_content"
|
|
153
|
+
prefix_order_note = "usage_only: gemini usageMetadata"
|
|
154
|
+
support_level = "usage_only"
|
|
155
|
+
source_version = "gemini-docs-2026-11"
|
|
156
|
+
unit_order = ["tools", "system_instruction", "contents"]
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Versioned static pricing tables (USD per 1M tokens).
|
|
2
|
+
# Explicitly versioned; never treat as billing invoices.
|
|
3
|
+
|
|
4
|
+
[[tables]]
|
|
5
|
+
pricing_table_id = "default-2026-11"
|
|
6
|
+
source_version = "public-list-prices-2026-11"
|
|
7
|
+
|
|
8
|
+
# OpenAI GPT-6 series, https://developers.openai.com/api/docs/pricing, checked 2026-11-26.
|
|
9
|
+
# Standard tier, <= 272K context (requests > 272K bill at 2x input/cached and 1.5x output).
|
|
10
|
+
# Optional cache write tiers (30m: 2.50 / 10.00; 12h: 5.00 / 20.00) are not emitted by
|
|
11
|
+
# OpenAI Responses usage today and are omitted until confirmed in live captures.
|
|
12
|
+
[[tables.rules]]
|
|
13
|
+
provider = "openai"
|
|
14
|
+
model_pattern = "gpt-6.1-sol"
|
|
15
|
+
uncached_input_per_1m = 2.00
|
|
16
|
+
cache_read_per_1m = 0.10
|
|
17
|
+
output_per_1m = 10.00
|
|
18
|
+
|
|
19
|
+
[[tables.rules]]
|
|
20
|
+
provider = "openai"
|
|
21
|
+
model_pattern = "gpt-6.2-sol"
|
|
22
|
+
uncached_input_per_1m = 2.00
|
|
23
|
+
cache_read_per_1m = 0.10
|
|
24
|
+
output_per_1m = 10.00
|
|
25
|
+
|
|
26
|
+
[[tables.rules]]
|
|
27
|
+
provider = "openai"
|
|
28
|
+
model_pattern = "gpt-6.2-astra"
|
|
29
|
+
uncached_input_per_1m = 8.00
|
|
30
|
+
cache_read_per_1m = 0.40
|
|
31
|
+
output_per_1m = 40.00
|
|
32
|
+
|
|
33
|
+
# Anthropic Claude 4.x, https://platform.claude.com/docs/en/about-claude/pricing, checked 2026-11-26.
|
|
34
|
+
# Standard tier (US-only inference applies a 1.1x multiplier; Batch API is 50%).
|
|
35
|
+
[[tables.rules]]
|
|
36
|
+
provider = "anthropic"
|
|
37
|
+
model_pattern = "claude-sonnet-4-6"
|
|
38
|
+
uncached_input_per_1m = 3.00
|
|
39
|
+
cache_read_per_1m = 0.30
|
|
40
|
+
output_per_1m = 15.00
|
|
41
|
+
[tables.rules.write_per_1m]
|
|
42
|
+
default = 3.75
|
|
43
|
+
"5m" = 3.75
|
|
44
|
+
"1h" = 6.00
|
|
45
|
+
|
|
46
|
+
[[tables.rules]]
|
|
47
|
+
provider = "anthropic"
|
|
48
|
+
model_pattern = "claude-sonnet-4-5"
|
|
49
|
+
uncached_input_per_1m = 3.00
|
|
50
|
+
cache_read_per_1m = 0.30
|
|
51
|
+
output_per_1m = 15.00
|
|
52
|
+
[tables.rules.write_per_1m]
|
|
53
|
+
default = 3.75
|
|
54
|
+
"5m" = 3.75
|
|
55
|
+
"1h" = 6.00
|
|
56
|
+
|
|
57
|
+
[[tables.rules]]
|
|
58
|
+
provider = "anthropic"
|
|
59
|
+
model_pattern = "claude-sonnet-4-20250514"
|
|
60
|
+
uncached_input_per_1m = 3.00
|
|
61
|
+
cache_read_per_1m = 0.30
|
|
62
|
+
output_per_1m = 15.00
|
|
63
|
+
[tables.rules.write_per_1m]
|
|
64
|
+
default = 3.75
|
|
65
|
+
"5m" = 3.75
|
|
66
|
+
"1h" = 6.00
|
|
67
|
+
|
|
68
|
+
[[tables.rules]]
|
|
69
|
+
provider = "anthropic"
|
|
70
|
+
model_pattern = "claude-opus-4-6"
|
|
71
|
+
uncached_input_per_1m = 5.00
|
|
72
|
+
cache_read_per_1m = 0.50
|
|
73
|
+
output_per_1m = 25.00
|
|
74
|
+
[tables.rules.write_per_1m]
|
|
75
|
+
default = 6.25
|
|
76
|
+
"5m" = 6.25
|
|
77
|
+
"1h" = 10.00
|
|
78
|
+
|
|
79
|
+
[[tables.rules]]
|
|
80
|
+
provider = "anthropic"
|
|
81
|
+
model_pattern = "claude-opus-4-5"
|
|
82
|
+
uncached_input_per_1m = 5.00
|
|
83
|
+
cache_read_per_1m = 0.50
|
|
84
|
+
output_per_1m = 25.00
|
|
85
|
+
[tables.rules.write_per_1m]
|
|
86
|
+
default = 6.25
|
|
87
|
+
"5m" = 6.25
|
|
88
|
+
"1h" = 10.00
|
|
89
|
+
|
|
90
|
+
[[tables.rules]]
|
|
91
|
+
provider = "anthropic"
|
|
92
|
+
model_pattern = "claude-opus-4-1"
|
|
93
|
+
uncached_input_per_1m = 15.00
|
|
94
|
+
cache_read_per_1m = 1.50
|
|
95
|
+
output_per_1m = 75.00
|
|
96
|
+
[tables.rules.write_per_1m]
|
|
97
|
+
default = 18.75
|
|
98
|
+
"5m" = 18.75
|
|
99
|
+
"1h" = 30.00
|
|
100
|
+
|
|
101
|
+
[[tables.rules]]
|
|
102
|
+
provider = "anthropic"
|
|
103
|
+
model_pattern = "claude-opus-4-20250514"
|
|
104
|
+
uncached_input_per_1m = 15.00
|
|
105
|
+
cache_read_per_1m = 1.50
|
|
106
|
+
output_per_1m = 75.00
|
|
107
|
+
[tables.rules.write_per_1m]
|
|
108
|
+
default = 18.75
|
|
109
|
+
"5m" = 18.75
|
|
110
|
+
"1h" = 30.00
|
|
111
|
+
|
|
112
|
+
[[tables.rules]]
|
|
113
|
+
provider = "anthropic"
|
|
114
|
+
model_pattern = "claude-haiku-4-5"
|
|
115
|
+
uncached_input_per_1m = 1.00
|
|
116
|
+
cache_read_per_1m = 0.10
|
|
117
|
+
output_per_1m = 5.00
|
|
118
|
+
[tables.rules.write_per_1m]
|
|
119
|
+
default = 1.25
|
|
120
|
+
"5m" = 1.25
|
|
121
|
+
"1h" = 2.00
|
|
122
|
+
|
|
123
|
+
# ----------------------------------------------------------------------------------------
|
|
124
|
+
# The rules below were transcribed from the vendors' public pricing pages; each one names
|
|
125
|
+
# its source and check date. They use exact model names on purpose. Each page also lists
|
|
126
|
+
# differently priced products that share a prefix (gpt-4o-mini-transcribe,
|
|
127
|
+
# gemini-2.5-flash-image, ...), and a prefix pattern would lend those a neighbour's rate: a
|
|
128
|
+
# name that is not listed stays unpriced instead. Every rule is the standard service tier
|
|
129
|
+
# with text input; a tier one rate cannot express is spelled out above the rule.
|
|
130
|
+
# ----------------------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
# DeepSeek, https://api-docs.deepseek.com/quick_start/pricing, checked 2026-11-26. PEAK rates; off-peak rates are half of these. Peak hours
|
|
133
|
+
# are 01:00-04:00 and 06:00-10:00 UTC, Monday through Friday, excluding Chinese public
|
|
134
|
+
# holidays.
|
|
135
|
+
[[tables.rules]]
|
|
136
|
+
provider = "deepseek"
|
|
137
|
+
model_pattern = "deepseek-flash"
|
|
138
|
+
uncached_input_per_1m = 0.3
|
|
139
|
+
cache_read_per_1m = 0.006
|
|
140
|
+
output_per_1m = 1.2
|
|
141
|
+
|
|
142
|
+
# DeepSeek, https://api-docs.deepseek.com/quick_start/pricing, checked 2026-11-26. PEAK rates. A retired name that is still
|
|
143
|
+
# accepted, served by the Flash model and billed at the Flash price.
|
|
144
|
+
[[tables.rules]]
|
|
145
|
+
provider = "deepseek"
|
|
146
|
+
model_pattern = "deepseek-v4-flash"
|
|
147
|
+
uncached_input_per_1m = 0.3
|
|
148
|
+
cache_read_per_1m = 0.006
|
|
149
|
+
output_per_1m = 1.2
|
|
150
|
+
|
|
151
|
+
# DeepSeek, https://api-docs.deepseek.com/quick_start/pricing, checked 2026-11-26. PEAK rates. A retired name that is still
|
|
152
|
+
# accepted, served by the Flash model and billed at the Flash price.
|
|
153
|
+
[[tables.rules]]
|
|
154
|
+
provider = "deepseek"
|
|
155
|
+
model_pattern = "deepseek-v4-flash-vision-exp"
|
|
156
|
+
uncached_input_per_1m = 0.3
|
|
157
|
+
cache_read_per_1m = 0.006
|
|
158
|
+
output_per_1m = 1.2
|
|
159
|
+
|
|
160
|
+
# DeepSeek, https://api-docs.deepseek.com/quick_start/pricing, checked 2026-11-26. PEAK rates. The page lists no deepseek-chat or
|
|
161
|
+
# deepseek-reasoner, so those two names stay unpriced.
|
|
162
|
+
[[tables.rules]]
|
|
163
|
+
provider = "deepseek"
|
|
164
|
+
model_pattern = "deepseek-v4-pro"
|
|
165
|
+
uncached_input_per_1m = 1.32
|
|
166
|
+
cache_read_per_1m = 0.044
|
|
167
|
+
output_per_1m = 3.96
|
|
168
|
+
|
|
169
|
+
# Gemini, https://aistudio.google.com/docs/pricing, checked 2026-11-26. Standard tier, text / image / video input. Prompts
|
|
170
|
+
# > 200k tokens: input 2.50, context caching 0.25, output 15.00. Storage of an
|
|
171
|
+
# explicit context cache is billed per token per hour and is not represented.
|
|
172
|
+
# Deprecated by the vendor: from 2026-12-01 requests route to gemini-3.8-flash and
|
|
173
|
+
# are billed at that model's rates, which are not transcribed here.
|
|
174
|
+
[[tables.rules]]
|
|
175
|
+
provider = "gemini"
|
|
176
|
+
model_pattern = "gemini-2.5-pro"
|
|
177
|
+
uncached_input_per_1m = 1.25
|
|
178
|
+
cache_read_per_1m = 0.125
|
|
179
|
+
output_per_1m = 10.00
|
|
180
|
+
|
|
181
|
+
# Gemini, https://aistudio.google.com/docs/pricing, checked 2026-11-26. Standard tier, text / image / video input; audio
|
|
182
|
+
# input is 1.00, audio context caching 0.10. Deprecated by the vendor: from
|
|
183
|
+
# 2026-12-01 requests route to gemini-3.5-flash-lite and are billed at that model's
|
|
184
|
+
# rates, which are not transcribed here.
|
|
185
|
+
[[tables.rules]]
|
|
186
|
+
provider = "gemini"
|
|
187
|
+
model_pattern = "gemini-2.5-flash"
|
|
188
|
+
uncached_input_per_1m = 0.30
|
|
189
|
+
cache_read_per_1m = 0.03
|
|
190
|
+
output_per_1m = 2.50
|
|
191
|
+
|
|
192
|
+
# Gemini, https://aistudio.google.com/docs/pricing, checked 2026-11-26. Standard tier, text / image / video input; audio
|
|
193
|
+
# input is 0.30, audio context caching 0.03.
|
|
194
|
+
[[tables.rules]]
|
|
195
|
+
provider = "gemini"
|
|
196
|
+
model_pattern = "gemini-2.5-flash-lite"
|
|
197
|
+
uncached_input_per_1m = 0.10
|
|
198
|
+
cache_read_per_1m = 0.01
|
|
199
|
+
output_per_1m = 0.40
|
|
200
|
+
|
|
201
|
+
# OpenAI, https://developers.openai.com/api/docs/pricing, checked 2026-11-26. Standard tier. Dated snapshots such as
|
|
202
|
+
# gpt-4o-2024-08-06 are not listed individually and stay unpriced.
|
|
203
|
+
[[tables.rules]]
|
|
204
|
+
provider = "openai"
|
|
205
|
+
model_pattern = "gpt-4o"
|
|
206
|
+
uncached_input_per_1m = 2.50
|
|
207
|
+
cache_read_per_1m = 1.25
|
|
208
|
+
output_per_1m = 10.00
|
|
209
|
+
|
|
210
|
+
# OpenAI, https://developers.openai.com/api/docs/pricing, checked 2026-11-26. Standard tier.
|
|
211
|
+
[[tables.rules]]
|
|
212
|
+
provider = "openai"
|
|
213
|
+
model_pattern = "gpt-4o-mini"
|
|
214
|
+
uncached_input_per_1m = 0.15
|
|
215
|
+
cache_read_per_1m = 0.075
|
|
216
|
+
output_per_1m = 0.60
|
|
217
|
+
|
|
218
|
+
# OpenAI, https://developers.openai.com/api/docs/pricing, checked 2026-11-26. Standard tier.
|
|
219
|
+
[[tables.rules]]
|
|
220
|
+
provider = "openai"
|
|
221
|
+
model_pattern = "gpt-4.1"
|
|
222
|
+
uncached_input_per_1m = 2.00
|
|
223
|
+
cache_read_per_1m = 0.50
|
|
224
|
+
output_per_1m = 8.00
|
|
225
|
+
|
|
226
|
+
# OpenAI, https://developers.openai.com/api/docs/pricing, checked 2026-11-26. Standard tier.
|
|
227
|
+
[[tables.rules]]
|
|
228
|
+
provider = "openai"
|
|
229
|
+
model_pattern = "gpt-4.1-mini"
|
|
230
|
+
uncached_input_per_1m = 0.40
|
|
231
|
+
cache_read_per_1m = 0.10
|
|
232
|
+
output_per_1m = 1.60
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Regression gate for prompt cache prefix stability (`cacherift check`)."""
|