Skip to content

Commit 038d5e3

Browse files
Propagate pricing fields to litellm params
1 parent 7f586ef commit 038d5e3

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Backend sync worker service."""
22

3-
__version__ = "0.5.6"
3+
__version__ = "0.5.7"

backend/litellm_client.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ async def push_model_to_litellm(
200200
model=model,
201201
)
202202

203+
# Copy pricing fields into litellm_params so LiteLLM can bill requests
204+
_merge_pricing_fields(litellm_params, model_info)
205+
203206
# Set litellm_provider
204207
ollama_mode = model.ollama_mode or provider.default_ollama_mode or "ollama"
205208

@@ -332,10 +335,11 @@ async def _needs_update(provider, model, litellm_model, config=None, session=Non
332335
model=model,
333336
)
334337
ll_info = litellm_model.get('model_info', {})
338+
ll_params = litellm_model.get('litellm_params', {})
335339
for key, value in effective_info.items():
336340
if "cost" not in key:
337341
continue
338-
if ll_info.get(key) != value:
342+
if ll_info.get(key) != value or ll_params.get(key) != value:
339343
logger.debug("Pricing changed for %s: %s != %s", key, ll_info.get(key), value)
340344
return True
341345

@@ -415,3 +419,12 @@ async def _build_litellm_params(provider, model, session=None) -> dict:
415419
litellm_params["model"] = model_id
416420

417421
return litellm_params
422+
423+
424+
def _merge_pricing_fields(target: dict, source: dict) -> None:
425+
"""Copy pricing-related fields from source into target."""
426+
for key, value in source.items():
427+
if value is None:
428+
continue
429+
if "cost" in key or key == "tiered_pricing":
430+
target[key] = value

frontend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Frontend API and UI service."""
22

3-
__version__ = "0.5.6"
3+
__version__ = "0.5.7"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "litellm-updater"
3-
version = "0.5.6"
3+
version = "0.5.7"
44
description = "Synchronize models from Ollama or OpenAI-compatible endpoints into LiteLLM"
55
authors = [
66
{name = "LiteLLM Updater Authors", email = "dev@example.com"}

shared/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Shared code between backend and frontend services."""
22

3-
__version__ = "0.5.6"
3+
__version__ = "0.5.7"

0 commit comments

Comments
 (0)