Merge branch 'main' into codex/handle-task-cancellation-on-shutdown

This commit is contained in:
shroominic
2025-06-08 00:01:45 +02:00
committed by GitHub
4 changed files with 95 additions and 11839 deletions
+1 -1
View File
@@ -7,6 +7,6 @@ wallet.sqlite3
.notes
.*keys.db
.*wallet.sqlite3
.*models.json
*models.json
compose.override.yml
+56
View File
@@ -0,0 +1,56 @@
{
"models": [
{
"id": "google/gemini-2.5-pro-preview",
"hugging_face_id": "",
"name": "Google: Gemini 2.5 Pro Preview 06-05",
"created": 1749137257,
"description": "Gemini 2.5 Pro is Google\u2019s state-of-the-art AI model designed for advanced reasoning, coding, mathematics, and scientific tasks. It employs \u201cthinking\u201d capabilities, enabling it to reason through responses with enhanced accuracy and nuanced context handling. Gemini 2.5 Pro achieves top-tier performance on multiple benchmarks, including first-place positioning on the LMArena leaderboard, reflecting superior human-preference alignment and complex problem-solving abilities.\n",
"context_length": 1048576,
"architecture": {
"modality": "text+image->text",
"input_modalities": [
"file",
"image",
"text"
],
"output_modalities": [
"text"
],
"tokenizer": "Gemini",
"instruct_type": null
},
"pricing": {
"prompt": "0.00000125",
"completion": "0.00001",
"request": "0",
"image": "0.00516",
"web_search": "0",
"internal_reasoning": "0",
"input_cache_read": "0.00000031",
"input_cache_write": "0.000001625"
},
"top_provider": {
"context_length": 1048576,
"max_completion_tokens": 65536,
"is_moderated": false
},
"per_request_limits": null,
"supported_parameters": [
"tools",
"tool_choice",
"max_tokens",
"temperature",
"top_p",
"reasoning",
"include_reasoning",
"structured_outputs",
"response_format",
"stop",
"frequency_penalty",
"presence_penalty",
"seed"
]
}
]
}
-11834
View File
File diff suppressed because it is too large Load Diff
+38 -4
View File
@@ -22,11 +22,13 @@ class Pricing(BaseModel):
internal_reasoning: float
max_cost: float = 0.0 # in sats not msats
class TopProvider(BaseModel):
context_length: int | None = None
max_completion_tokens: int | None = None
is_moderated: bool | None = None
class Model(BaseModel):
id: str
name: str
@@ -55,10 +57,42 @@ async def update_sats_pricing() -> None:
**{k: v / sats_to_usd for k, v in model.pricing.dict().items()}
)
if model.top_provider:
if model.top_provider.context_length and model.top_provider.max_completion_tokens:
max_context_cost = model.top_provider.context_length * model.sats_pricing.prompt
max_completion_cost = model.top_provider.max_completion_tokens * model.sats_pricing.completion
model.sats_pricing.max_cost = max_context_cost + max_completion_cost
if (
model.top_provider.context_length
and model.top_provider.max_completion_tokens
):
max_context_cost = (
model.top_provider.context_length
* model.sats_pricing.prompt
)
max_completion_cost = (
model.top_provider.max_completion_tokens
* model.sats_pricing.completion
)
model.sats_pricing.max_cost = (
max_context_cost + max_completion_cost
)
elif model.top_provider.context_length:
max_context_cost = (
model.top_provider.context_length
* model.sats_pricing.prompt
)
max_completion_cost = 32_000 * model.sats_pricing.completion
model.sats_pricing.max_cost = (
max_context_cost + max_completion_cost
)
elif model.top_provider.max_completion_tokens:
max_completion_cost = (
model.top_provider.max_completion_tokens
* model.sats_pricing.completion
)
max_context_cost = 1_048_576 * model.sats_pricing.prompt
model.sats_pricing.max_cost = max_completion_cost
else:
model.sats_pricing.max_cost = (
1_048_576 * model.sats_pricing.prompt
+ 32_000 * model.sats_pricing.completion
)
else:
p = model.sats_pricing.prompt * 1_000_000
c = model.sats_pricing.completion * 32_000