Files
litellm/docs/my-website/docs/proxy/sync_models_github.md
T
Teddy AmkieandGitHub 7a176804f3 Add sync models GitHub documentation with Loom video and cross-references (#15191)
- Add comprehensive sync_models_github.md with API endpoints and examples
- Include Loom video tutorial for Admin UI sync process
- Add cross-references from model_management.md, cost_tracking.md, and ui.md
- Provide both manual and automated sync options
- Include Python SDK usage examples
2025-10-04 12:32:01 -07:00

1.8 KiB

Syncing Models to GitHub model_context_window

Sync model pricing data from GitHub's model_prices_and_context_window.json file outside of the LiteLLM UI.

📹 Video Tutorial: Watch how to sync models via the Admin UI

Quick Start

Manual sync:

curl -X POST "https://your-proxy-url/reload/model_cost_map" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json"

Automatic sync every 6 hours:

curl -X POST "https://your-proxy-url/schedule/model_cost_map_reload?hours=6" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json"

API Endpoints

Endpoint Method Description
/reload/model_cost_map POST Manual sync
/schedule/model_cost_map_reload?hours={hours} POST Schedule periodic sync
/schedule/model_cost_map_reload DELETE Cancel scheduled sync
/schedule/model_cost_map_reload/status GET Check sync status

Authentication: Requires admin role or master key

Python Example

import requests

def sync_models(proxy_url, admin_token):
    response = requests.post(
        f"{proxy_url}/reload/model_cost_map",
        headers={"Authorization": f"Bearer {admin_token}"}
    )
    return response.json()

# Usage
result = sync_models("https://your-proxy-url", "your-admin-token")
print(result['message'])

Configuration

Custom model cost map URL:

export LITELLM_MODEL_COST_MAP_URL="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"

Use local model cost map:

export LITELLM_LOCAL_MODEL_COST_MAP=True