litellm - 💡(How to fix) Fix [Bug]: Manually added field in `Model Info` is not persisted [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23345Fetched 2026-04-08 00:37:19
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Fix Action

Fix / Workaround

INFO:     172.20.0.3:49356 - "PATCH /model/2da0f0bf-7a18-4b32-b0ea-da0fbb1bb53e/update HTTP/1.1" 200 OK

Code Example

{
  "model_name": "[CONTRACTED] Nebius: Kimi-K2.5",
  "litellm_params": {
    "input_cost_per_token": "5e-07",
    "output_cost_per_token": "2.5e-06",
    "custom_llm_provider": "nebius",
    "litellm_credential_name": "Nebius",
    "use_in_pass_through": false,
    "use_litellm_proxy": false,
    "merge_reasoning_content_in_choices": false,
    "model": "moonshotai/Kimi-K2.5",
    "tags": [],
    "guardrails": []
  },
  "model_info": {
    "id": "2da0f0bf-7a18-4b32-b0ea-da0fbb1bb53e",
    "db_model": true,
    "mode": "chat",
    "access_groups": [],
    "direct_access": true,
    "access_via_team_ids": [
      "ai-self-service"
    ],
    "input_cost_per_token": 5e-7,
    "output_cost_per_token": 0.0000025
  },
  "provider": "nebius",
  "input_cost": "0.50",
  "output_cost": "2.50",
  "litellm_model_name": "moonshotai/Kimi-K2.5",
  "cleanedLitellmParams": {
    "input_cost_per_token": "5e-07",
    "output_cost_per_token": "2.5e-06",
    "custom_llm_provider": "nebius",
    "litellm_credential_name": "Nebius",
    "use_in_pass_through": false,
    "use_litellm_proxy": false,
    "merge_reasoning_content_in_choices": false,
    "tags": [],
    "guardrails": []
  }
}

---

INFO:     172.20.0.3:49356 - "PATCH /model/2da0f0bf-7a18-4b32-b0ea-da0fbb1bb53e/update HTTP/1.1" 200 OK
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When i want to add fields to the Model Info json of a model they are discarded.

E.g. i want to add a "max_input_tokens" to an existing model:

<img width="796" height="275" alt="Image" src="https://github.com/user-attachments/assets/ae25d5ca-4484-4578-96f1-7850fadcecab" />

But even after saving the setting successfully the model reports this raw json:

{
  "model_name": "[CONTRACTED] Nebius: Kimi-K2.5",
  "litellm_params": {
    "input_cost_per_token": "5e-07",
    "output_cost_per_token": "2.5e-06",
    "custom_llm_provider": "nebius",
    "litellm_credential_name": "Nebius",
    "use_in_pass_through": false,
    "use_litellm_proxy": false,
    "merge_reasoning_content_in_choices": false,
    "model": "moonshotai/Kimi-K2.5",
    "tags": [],
    "guardrails": []
  },
  "model_info": {
    "id": "2da0f0bf-7a18-4b32-b0ea-da0fbb1bb53e",
    "db_model": true,
    "mode": "chat",
    "access_groups": [],
    "direct_access": true,
    "access_via_team_ids": [
      "ai-self-service"
    ],
    "input_cost_per_token": 5e-7,
    "output_cost_per_token": 0.0000025
  },
  "provider": "nebius",
  "input_cost": "0.50",
  "output_cost": "2.50",
  "litellm_model_name": "moonshotai/Kimi-K2.5",
  "cleanedLitellmParams": {
    "input_cost_per_token": "5e-07",
    "output_cost_per_token": "2.5e-06",
    "custom_llm_provider": "nebius",
    "litellm_credential_name": "Nebius",
    "use_in_pass_through": false,
    "use_litellm_proxy": false,
    "merge_reasoning_content_in_choices": false,
    "tags": [],
    "guardrails": []
  }
}

Sometimes the settings also contain the manually added field for a few seconds and then it vanished. Is there some sort of caching/race conditions that could cause this?

Steps to Reproduce

  1. Add a non existing field to the model info fields
  2. Wait a bit
  3. Recheck raw model json

Relevant log output

INFO:     172.20.0.3:49356 - "PATCH /model/2da0f0bf-7a18-4b32-b0ea-da0fbb1bb53e/update HTTP/1.1" 200 OK

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.81.12

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To resolve the issue of added fields being discarded from the Model Info JSON, we need to ensure that the fields are properly persisted and not overwritten by cached or default values.

Here are the steps to fix the issue:

  • Update the Model Info update endpoint to accept and persist custom fields.
  • Implement caching invalidation to prevent race conditions.

Example Code

# Update the Model Info update endpoint to accept custom fields
from flask import request, jsonify
from yourapp import db

@app.route('/model/<model_id>/update', methods=['PATCH'])
def update_model_info(model_id):
    model = Model.query.get(model_id)
    data = request.get_json()
    # Update model info with custom fields
    model.model_info.update(data)
    db.session.commit()
    return jsonify({'message': 'Model info updated successfully'}), 200

Verification

To verify that the fix worked, follow these steps:

  • Add a custom field to the Model Info JSON.
  • Wait for a few seconds to ensure any caching is updated.
  • Recheck the raw model JSON to ensure the custom field is still present.

Extra Tips

  • Ensure that the database schema is updated to accommodate custom fields.
  • Implement logging to track any issues with caching or persistence.
  • Consider adding validation to ensure that only allowed custom fields are accepted.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING