Move all three skills into skills/; add root README; fix paths
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
312742cfef
commit
d95e5d452d
84 files changed
+97
-31
No files matched your search
@@ -0,0 +1,61 @@
|
||||
# EXAMPLE ONLY: an extract from the Superbill Review prototype, kept as reference for porting. ECW/eClinicalWorks, Tebra, 'Example Client', SPB_* tables and patient/ticket wording are that project's examples. Don't copy them into a new project.
|
||||
INCLUDE_THINKING_IN_COST = True # thinking tokens bill at output rate
|
||||
|
||||
# ═════════════════════════════════════════════════════════════════════════════
|
||||
# GEMINI PRICING TABLE
|
||||
# ═════════════════════════════════════════════════════════════════════════════
|
||||
PRICING_SOURCE = "https://ai.google.dev/gemini-api/docs/pricing"
|
||||
PRICING_AS_OF = "2026-08-11"
|
||||
|
||||
GEMINI_PRICING = {
|
||||
# ---- Gemini 3.x family --------------------------------------------------
|
||||
"gemini-3.6-flash": {"input": 1.50, "output": 7.50, "free_tier": True},
|
||||
"gemini-3.5-flash": {"input": 1.50, "output": 9.00, "free_tier": True},
|
||||
"gemini-3.5-flash-lite": {"input": 0.30, "output": 2.50, "free_tier": True},
|
||||
"gemini-3-flash-preview": {"input": 0.50, "output": 3.00, "free_tier": True},
|
||||
"gemini-3.1-flash-lite": {"input": 0.25, "output": 1.50, "free_tier": True},
|
||||
"gemini-3.1-pro-preview": {
|
||||
"input": 2.00, "output": 12.00, "free_tier": False,
|
||||
"long_threshold": 200_000, "input_long": 4.00, "output_long": 18.00,
|
||||
},
|
||||
# ---- Gemini 2.5 family --------------------------------------------------
|
||||
"gemini-2.5-pro": {
|
||||
"input": 1.25, "output": 10.00, "free_tier": True,
|
||||
"long_threshold": 200_000, "input_long": 2.50, "output_long": 15.00,
|
||||
},
|
||||
"gemini-2.5-flash": {"input": 0.30, "output": 2.50, "free_tier": True},
|
||||
"gemini-2.5-flash-lite": {"input": 0.10, "output": 0.40, "free_tier": True},
|
||||
"gemini-2.5-flash-lite-preview-09-2025": {"input": 0.10, "output": 0.40, "free_tier": True},
|
||||
# ---- Gemini 2.0 family (DEPRECATED — shut down 2026-06-01) --------------
|
||||
"gemini-2.0-flash": {"input": 0.10, "output": 0.40, "free_tier": True, "deprecated": True},
|
||||
"gemini-2.0-flash-lite": {"input": 0.075, "output": 0.30, "free_tier": True, "deprecated": True},
|
||||
}
|
||||
|
||||
|
||||
def resolve_pricing(model: str, input_tokens: int):
|
||||
if model not in GEMINI_PRICING:
|
||||
raise KeyError(
|
||||
f"No pricing entry for model '{model}'. Add it to GEMINI_PRICING "
|
||||
f"from {PRICING_SOURCE}. Known models: {', '.join(GEMINI_PRICING)}"
|
||||
)
|
||||
p = GEMINI_PRICING[model]
|
||||
note = ""
|
||||
in_rate, out_rate = p["input"], p["output"]
|
||||
threshold = p.get("long_threshold")
|
||||
if threshold and input_tokens > threshold:
|
||||
in_rate = p.get("input_long", in_rate)
|
||||
out_rate = p.get("output_long", out_rate)
|
||||
note = f"long-context rate (>{threshold:,} input tokens)"
|
||||
return in_rate, out_rate, note
|
||||
|
||||
|
||||
def cost_for_call(model: str, usage: dict):
|
||||
in_rate, out_rate, note = resolve_pricing(model, usage["input"])
|
||||
billable_output = usage["output"]
|
||||
if INCLUDE_THINKING_IN_COST:
|
||||
billable_output += usage.get("thinking", 0)
|
||||
input_cost = usage["input"] / 1_000_000 * in_rate
|
||||
output_cost = billable_output / 1_000_000 * out_rate
|
||||
return input_cost + output_cost, input_cost, output_cost, note
|
||||
|
||||
|
||||
Reference in new issue
Block a user