mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
chore: move published JSON data under litellm
This commit is contained in:
parent
d6f67f9307
commit
d1c2fda842
118 changed files with 157 additions and 143 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/model_prices_and_context_window.json @mateo-berri @ryan-crabbe-berri @kerry-berri @joshua-berri
|
||||
/litellm/data/model_prices_and_context_window.json @mateo-berri @ryan-crabbe-berri @kerry-berri @joshua-berri
|
||||
/litellm/model_prices_and_context_window_backup.json @mateo-berri @ryan-crabbe-berri @kerry-berri @joshua-berri
|
||||
/litellm/scripts/ci_cd/cost_map_pins.json @mateo-berri @ryan-crabbe-berri @kerry-berri @joshua-berri
|
||||
/litellm/deploy/helm/ @yassin-berriai
|
||||
|
|
|
|||
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
|
@ -276,7 +276,7 @@ When the provider reports its own usage or spend numbers, compare the proxy's nu
|
|||
|
||||
Provider work (a new provider, a new parameter, a new usage or cost field) is the most common kind of contribution, and it is where PRs get reworked most often. Follow these rules
|
||||
|
||||
**Preserve zero prices.** In [`model_prices_and_context_window.json`](../model_prices_and_context_window.json), an explicit `0.0` means that the priced operation is free. A missing field or `null` means no rate is specified, so the relevant calculator may use a fallback. For example, when no batch input rate is configured, batch cache writes use `cache_creation_input_token_cost` if set, otherwise the regular input rate, then apply the batch discount. A zero ordinary input rate does not make separately priced cache reads or writes free. Test `rate is None` before substituting a fallback, since `row.get("cache_creation_input_token_cost") or fallback` would discard a valid zero. Speech keeps character pricing ahead of token pricing even when the character rate is zero. If neither rate is configured, speech cost calculation raises an error. Its model lookup preserves unset rates instead of treating compatibility defaults as explicit zero prices. Perplexity keeps a configured legacy search rate ahead of the current search rate, including zero. When registering custom prices, `None` leaves an existing rate unchanged and `0.0` overrides it
|
||||
**Preserve zero prices.** In [`litellm/data/model_prices_and_context_window.json`](../litellm/data/model_prices_and_context_window.json), an explicit `0.0` means that the priced operation is free. A missing field or `null` means no rate is specified, so the relevant calculator may use a fallback. For example, when no batch input rate is configured, batch cache writes use `cache_creation_input_token_cost` if set, otherwise the regular input rate, then apply the batch discount. A zero ordinary input rate does not make separately priced cache reads or writes free. Test `rate is None` before substituting a fallback, since `row.get("cache_creation_input_token_cost") or fallback` would discard a valid zero. Speech keeps character pricing ahead of token pricing even when the character rate is zero. If neither rate is configured, speech cost calculation raises an error. Its model lookup preserves unset rates instead of treating compatibility defaults as explicit zero prices. Perplexity keeps a configured legacy search rate ahead of the current search rate, including zero. When registering custom prices, `None` leaves an existing rate unchanged and `0.0` overrides it
|
||||
|
||||
**Find the existing machinery before you add plumbing.** LiteLLM already has generic paths that move data between the endpoints, the provider transformations, and cost tracking. A second, hand-rolled path for the same data is a common reason a provider PR gets rewritten before merge. If you cannot find a mechanism for what you need, say so in the PR or ask in [#pr-review on Slack](https://join.slack.com/t/litellmossslack/shared_invite/zt-3o7nkuyfr-p_kbNJj8taRfXGgQI1~YyA) before you build one
|
||||
|
||||
|
|
|
|||
2
.github/prompts/duplicate-issue-check.md
vendored
2
.github/prompts/duplicate-issue-check.md
vendored
|
|
@ -27,7 +27,7 @@ Call it a duplicate only when one fix closes both: the same root cause in the sa
|
|||
|
||||
These are NOT duplicates:
|
||||
|
||||
- two requests to add different models to `model_prices_and_context_window.json` (the same model under two names IS a duplicate)
|
||||
- two requests to add different models to `litellm/data/model_prices_and_context_window.json` (the same model under two names IS a duplicate)
|
||||
- two bugs in the same file or the same request path with different root causes, such as "this request should not be routed here at all" versus "the translation this route performs drops a field"
|
||||
- the same symptom on a different provider, endpoint, or model, unless the broken code is plainly shared
|
||||
- the same general area ("spend tracking is wrong", "streaming is broken") with different root causes
|
||||
|
|
|
|||
2
.github/prompts/issue-classifier.md
vendored
2
.github/prompts/issue-classifier.md
vendored
|
|
@ -8,7 +8,7 @@ Answer with one JSON object matching the schema you were given. Every field is r
|
|||
|
||||
Pick the domain whose code would change to fix the issue. The symptom decides, not the file the reporter guesses at. A path belongs to exactly one domain.
|
||||
|
||||
- `cost-map`: a model is missing, priced wrong, or has a stale capability flag or context limit. No code change, only `model_prices_and_context_window.json`.
|
||||
- `cost-map`: a model is missing, priced wrong, or has a stale capability flag or context limit. No code change, only `litellm/data/model_prices_and_context_window.json`.
|
||||
- `llm-translation`: a specific provider returns the wrong shape, drops a param, breaks on streaming, tools, images or reasoning, or maps an error badly. Also every bridge between API shapes: Responses to Chat, Messages to Chat, batches, files, images, audio, realtime. Prompt caching lives here, not in caching: it is a per-provider header translation.
|
||||
- `routing`: the wrong deployment was picked, a fallback did not fire or fired wrongly, retries or cooldowns misbehave, a model group alias resolves wrong, the auto router chose badly. Router-level tpm/rpm used to pick a deployment is routing.
|
||||
- `caching`: a response was served from cache when it should not have been, or not cached when it should; Redis or semantic cache misconfigured; cache keys collide across keys or users. Response cache only: `cache_hit` in the logs means this, a provider's prompt cache is llm-translation.
|
||||
|
|
|
|||
3
.github/root-entries-allowlist.json
vendored
3
.github/root-entries-allowlist.json
vendored
|
|
@ -6,9 +6,6 @@
|
|||
"Makefile": "Root entry points for workspace development and testing.",
|
||||
"README.md": "Repository overview consumed by hosting and package builds.",
|
||||
"litellm": "Python SDK and consolidated project sources.",
|
||||
"model_prices_and_context_window.json": "Published model metadata consumed by the SDK and external readers.",
|
||||
"policy_templates.json": "Published policy templates retained at their existing root URL.",
|
||||
"provider_endpoints_support.json": "Published provider endpoint metadata retained at its existing root URL.",
|
||||
"pyproject.toml": "Root Python package manifest and workspace configuration.",
|
||||
"tests": "Repository-wide test suites and test infrastructure.",
|
||||
"uv.lock": "Locked dependency graph for the root Python workspace."
|
||||
|
|
|
|||
2
.github/scripts/ci/classify_changes.sh
vendored
2
.github/scripts/ci/classify_changes.sh
vendored
|
|
@ -33,7 +33,7 @@ while IFS= read -r file || [ -n "$file" ]; do
|
|||
*) has_backend=true ;;
|
||||
esac
|
||||
case "$file" in
|
||||
model_prices_and_context_window.json | litellm/model_prices_and_context_window_backup.json)
|
||||
litellm/data/model_prices_and_context_window.json | litellm/model_prices_and_context_window_backup.json)
|
||||
has_cost_map=true ;;
|
||||
tests/unit/proxy/*) : ;;
|
||||
*) outside_cost_map_set=true ;;
|
||||
|
|
|
|||
2
.github/scripts/smoke_test_native_wheel.py
vendored
2
.github/scripts/smoke_test_native_wheel.py
vendored
|
|
@ -7,7 +7,7 @@ import zipfile
|
|||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
COST_MAP: Final = Path(__file__).resolve().parents[2] / "model_prices_and_context_window.json"
|
||||
COST_MAP: Final = Path(__file__).resolve().parents[2] / "litellm/data/model_prices_and_context_window.json"
|
||||
|
||||
CHILD_SCRIPT: Final = """
|
||||
from importlib.util import module_from_spec, spec_from_file_location
|
||||
|
|
|
|||
3
.github/scripts/verify_linux_native_wheel.py
vendored
3
.github/scripts/verify_linux_native_wheel.py
vendored
|
|
@ -140,6 +140,9 @@ def main(
|
|||
"litellm/scripts/",
|
||||
"litellm/runtime/",
|
||||
"litellm/schema.prisma",
|
||||
"litellm/data/model_prices_and_context_window.json",
|
||||
"litellm/data/policy_templates.json",
|
||||
"litellm/data/provider_endpoints_support.json",
|
||||
)
|
||||
)
|
||||
or any(part.endswith(".dSYM") for part in PurePosixPath(member.filename).parts)
|
||||
|
|
|
|||
4
.github/workflows/cost-map-guard.yml
vendored
4
.github/workflows/cost-map-guard.yml
vendored
|
|
@ -64,7 +64,7 @@ jobs:
|
|||
MERGE_BASE: ${{ steps.revisions.outputs.merge_base }}
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
if git diff --quiet "$MERGE_BASE" "$HEAD_SHA" -- model_prices_and_context_window.json; then
|
||||
if git diff --quiet "$MERGE_BASE" "$HEAD_SHA" -- litellm/data/model_prices_and_context_window.json; then
|
||||
echo "cost_map=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "cost_map=true" >> "$GITHUB_OUTPUT"
|
||||
|
|
@ -76,6 +76,6 @@ jobs:
|
|||
env:
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
git show "${HEAD_SHA}:model_prices_and_context_window.json" > "$RUNNER_TEMP/model_prices_and_context_window.json"
|
||||
git show "${HEAD_SHA}:litellm/data/model_prices_and_context_window.json" > "$RUNNER_TEMP/model_prices_and_context_window.json"
|
||||
cargo run --locked --quiet --manifest-path litellm/rust/Cargo.toml -p litellm-model-catalog --bin check-registry \
|
||||
-- "$RUNNER_TEMP/model_prices_and_context_window.json"
|
||||
|
|
|
|||
4
.github/workflows/cost-map-pins-recheck.yml
vendored
4
.github/workflows/cost-map-pins-recheck.yml
vendored
|
|
@ -6,7 +6,7 @@ on:
|
|||
- main
|
||||
- "litellm_**"
|
||||
paths:
|
||||
- model_prices_and_context_window.json
|
||||
- litellm/data/model_prices_and_context_window.json
|
||||
- litellm/model_prices_and_context_window_backup.json
|
||||
- litellm/scripts/ci_cd/cost_map_pins.json
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
BEFORE_SHA: ${{ github.event.before }}
|
||||
AFTER_SHA: ${{ github.event.after }}
|
||||
FORCED: ${{ github.event.forced }}
|
||||
COST_MAP_PATHS: '["model_prices_and_context_window.json", "litellm/model_prices_and_context_window_backup.json", "litellm/scripts/ci_cd/cost_map_pins.json"]'
|
||||
COST_MAP_PATHS: '["litellm/data/model_prices_and_context_window.json", "litellm/model_prices_and_context_window_backup.json", "litellm/scripts/ci_cd/cost_map_pins.json"]'
|
||||
PINS_PATHS: '["litellm/scripts/ci_cd/cost_map_pins.json"]'
|
||||
run: |
|
||||
if [[ "$BEFORE_SHA" =~ ^0+$ || "$FORCED" == true ]] \
|
||||
|
|
|
|||
4
.github/workflows/test-rust.yml
vendored
4
.github/workflows/test-rust.yml
vendored
|
|
@ -4,7 +4,7 @@ on:
|
|||
push:
|
||||
paths:
|
||||
- "litellm/rust/**"
|
||||
- "model_prices_and_context_window.json"
|
||||
- "litellm/data/model_prices_and_context_window.json"
|
||||
- "litellm/rust_bridge/**"
|
||||
- "litellm/scripts/generate_trace_types.py"
|
||||
- "litellm/scripts/trace_codegen/**"
|
||||
|
|
@ -39,7 +39,7 @@ on:
|
|||
- "litellm_**"
|
||||
paths:
|
||||
- "litellm/rust/**"
|
||||
- "model_prices_and_context_window.json"
|
||||
- "litellm/data/model_prices_and_context_window.json"
|
||||
- "litellm/rust_bridge/**"
|
||||
- "litellm/scripts/generate_trace_types.py"
|
||||
- "litellm/scripts/trace_codegen/**"
|
||||
|
|
|
|||
4
.github/workflows/test-unit.yml
vendored
4
.github/workflows/test-unit.yml
vendored
|
|
@ -45,7 +45,7 @@ jobs:
|
|||
id: rust-bridge-key
|
||||
if: steps.changes.outputs.decision != 'skip'
|
||||
env:
|
||||
RUST_BRIDGE_CACHE_KEY: ${{ runner.os }}-rust-bridge-editable-${{ hashFiles('litellm/rust/Cargo.lock', 'litellm/rust/Cargo.toml', 'litellm/rust/crates/**', 'model_prices_and_context_window.json', 'pyproject.toml', 'litellm/packaging/litellm-proxy/pyproject.toml') }}
|
||||
RUST_BRIDGE_CACHE_KEY: ${{ runner.os }}-rust-bridge-editable-${{ hashFiles('litellm/rust/Cargo.lock', 'litellm/rust/Cargo.toml', 'litellm/rust/crates/**', 'litellm/data/model_prices_and_context_window.json', 'pyproject.toml', 'litellm/packaging/litellm-proxy/pyproject.toml') }}
|
||||
run: echo "key=$RUST_BRIDGE_CACHE_KEY" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Python
|
||||
|
|
@ -1032,7 +1032,7 @@ jobs:
|
|||
env:
|
||||
RUST_BRIDGE_ARTIFACT: ${{ needs.rust-bridge.outputs.artifact }}
|
||||
run: |
|
||||
diff -u model_prices_and_context_window.json litellm/model_prices_and_context_window_backup.json
|
||||
diff -u litellm/data/model_prices_and_context_window.json litellm/model_prices_and_context_window_backup.json
|
||||
if [ -z "$RUST_BRIDGE_ARTIFACT" ]; then
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra switchyard --extra saml --extra extra_proxy --extra proxy-runtime --extra utils
|
||||
else
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ aclient_session: Optional[Union[httpx.AsyncClient, DefaultAsyncHttpxClient]] = N
|
|||
model_fallbacks: Optional[List] = None # Deprecated for 'litellm.fallbacks'
|
||||
model_cost_map_url: str = os.getenv(
|
||||
"LITELLM_MODEL_COST_MAP_URL",
|
||||
"https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",
|
||||
"https://raw.githubusercontent.com/BerriAI/litellm/main/litellm/data/model_prices_and_context_window.json",
|
||||
)
|
||||
blog_posts_url: str = os.getenv(
|
||||
"LITELLM_BLOG_POSTS_URL",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Pulls the cost + context window + provider route for known models from https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json
|
||||
Pulls the cost + context window + provider route for known models from https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json
|
||||
|
||||
This can be disabled by setting the LITELLM_LOCAL_MODEL_COST_MAP environment variable to True.
|
||||
The ``lite`` and ``litellm-proxy`` CLI entry points also use the bundled map without fetching.
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ def get_supports_system_message(
|
|||
supports_system_message = True
|
||||
except Exception as e:
|
||||
verbose_logger.warning(
|
||||
"Unable to identify if system message supported. Defaulting to 'False'. Received error message - %s\nAdd it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",
|
||||
"Unable to identify if system message supported. Defaulting to 'False'. Received error message - %s\nAdd it here - https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json",
|
||||
e,
|
||||
)
|
||||
supports_system_message = False
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ editable-profile = "dev"
|
|||
include = [
|
||||
{ path = "litellm/rust/rust-toolchain.toml", format = "sdist" },
|
||||
{ path = "litellm/rust/.cargo/config.toml", format = "sdist" },
|
||||
{ path = "model_prices_and_context_window.json", format = "sdist" },
|
||||
{ path = "litellm/data/model_prices_and_context_window.json", format = "sdist" },
|
||||
"litellm/router_strategy/complexity_router/artifacts/*.json",
|
||||
"litellm/router_strategy/complexity_router/fuse_presets.json",
|
||||
"litellm/proxy/model_insights_tasks.json",
|
||||
|
|
@ -66,6 +66,9 @@ include = [
|
|||
"litellm/proxy/common_utils/codex_bedrock_runtime_models_0.166.0.json",
|
||||
]
|
||||
exclude = [
|
||||
{ path = "litellm/data/model_prices_and_context_window.json", format = "wheel" },
|
||||
"litellm/data/policy_templates.json",
|
||||
"litellm/data/provider_endpoints_support.json",
|
||||
"litellm/scripts",
|
||||
"litellm/scripts/**",
|
||||
"litellm/runtime",
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ editable-profile = "dev"
|
|||
include = [
|
||||
{ path = "litellm/rust/rust-toolchain.toml", format = "sdist" },
|
||||
{ path = "litellm/rust/.cargo/config.toml", format = "sdist" },
|
||||
{ path = "model_prices_and_context_window.json", format = "sdist" },
|
||||
{ path = "litellm/data/model_prices_and_context_window.json", format = "sdist" },
|
||||
]
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -623,7 +623,9 @@ async def test_policy_matching(
|
|||
)
|
||||
|
||||
|
||||
POLICY_TEMPLATES_GITHUB_URL: Final = "https://raw.githubusercontent.com/BerriAI/litellm/main/policy_templates.json"
|
||||
POLICY_TEMPLATES_GITHUB_URL: Final = (
|
||||
"https://raw.githubusercontent.com/BerriAI/litellm/main/litellm/data/policy_templates.json"
|
||||
)
|
||||
|
||||
|
||||
def _load_policy_templates_from_local_backup() -> list:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub const RETRYABLE_STATUSES: [u16; 5] = [429, 500, 502, 503, 504];
|
|||
|
||||
/// Main's default `LITELLM_MODEL_COST_MAP_URL`
|
||||
pub const DEFAULT_REGISTRY_URL: &str =
|
||||
"https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
|
||||
"https://raw.githubusercontent.com/BerriAI/litellm/main/litellm/data/model_prices_and_context_window.json";
|
||||
|
||||
impl RetryPolicy {
|
||||
pub(crate) fn backoff(&self) -> ExponentialBackoff {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,6 @@ A new `N`, image size or resolution in an existing key shape parses with no Rust
|
|||
|
||||
## Tests
|
||||
|
||||
`BUNDLED_REGISTRY` embeds the root `model_prices_and_context_window.json`, so the tests over it fail a JSON change with a bad value or a key no type reads
|
||||
`BUNDLED_REGISTRY` embeds `litellm/data/model_prices_and_context_window.json`, so the tests over it fail a JSON change with a bad value or a key no type reads
|
||||
|
||||
`Catalog::problems` is the one definition of a mergeable cost map. The bundled test asserts it is empty, and the cost map guard workflow runs it on a pull request's JSON through `cargo run --bin check-registry <path>`
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
/// The registry document this build serves when no other one is loaded.
|
||||
pub const BUNDLED_REGISTRY: &[u8] =
|
||||
include_bytes!("../../../../../model_prices_and_context_window.json");
|
||||
include_bytes!("../../../../data/model_prices_and_context_window.json");
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ def checks(info: dict[str, object], inclusive: bool) -> list[list[object]]:
|
|||
|
||||
|
||||
def main() -> None:
|
||||
registry: Final = json.loads((REPO_ROOT / "model_prices_and_context_window.json").read_text())
|
||||
registry: Final = json.loads((REPO_ROOT / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
entries: Final = tuple(
|
||||
(token_rates(entry), entry.get("litellm_provider") in INCLUSIVE_PROVIDERS)
|
||||
for name, entry in registry.items()
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ ROOT: Final = Path(__file__).resolve().parents[2]
|
|||
SOURCES: Final = (
|
||||
"litellm",
|
||||
"litellm/rust",
|
||||
"model_prices_and_context_window.json",
|
||||
"litellm/data/model_prices_and_context_window.json",
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
)
|
||||
|
|
@ -57,7 +57,7 @@ def stage_core_distribution(source: Path, destination: Path, *, package: str = "
|
|||
workspace_sources: Final = (
|
||||
{
|
||||
"enterprise", "proxy-extras", "packaging", "rust", "cli", "scripts", "runtime",
|
||||
"schema.prisma", "ui", "vscode-extension", "deploy",
|
||||
"schema.prisma", "ui", "vscode-extension", "deploy", "data",
|
||||
}
|
||||
if Path(directory) == source / "litellm"
|
||||
else set()
|
||||
|
|
@ -75,6 +75,7 @@ def stage_core_distribution(source: Path, destination: Path, *, package: str = "
|
|||
ignore=ignored_sources,
|
||||
)
|
||||
else:
|
||||
(destination / name).parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(path, destination / name)
|
||||
template: Final = (source / "litellm" / "packaging" / package / "pyproject.toml").read_text()
|
||||
if package == "litellm-proxy" and IN_TREE_RUST_PATH not in template:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ def main(argv=None):
|
|||
"Comparing model_prices_and_context_window and litellm/model_prices_and_context_window_backup.json files... checking if they match."
|
||||
)
|
||||
|
||||
file1 = "model_prices_and_context_window.json"
|
||||
file1 = "litellm/data/model_prices_and_context_window.json"
|
||||
file2 = "litellm/model_prices_and_context_window_backup.json"
|
||||
|
||||
cmp_result = filecmp.cmp(file1, file2, shallow=False)
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ from dataclasses import dataclass
|
|||
from types import MappingProxyType
|
||||
from typing import Final
|
||||
|
||||
COST_MAP_PATH: Final = "model_prices_and_context_window.json"
|
||||
COST_MAP_PATHS: Final = ("litellm/data/model_prices_and_context_window.json", COST_MAP_PATH)
|
||||
COST_MAP_PATH: Final = "litellm/data/model_prices_and_context_window.json"
|
||||
COST_MAP_PATHS: Final = (COST_MAP_PATH, "model_prices_and_context_window.json")
|
||||
BACKUP_PATH: Final = "litellm/model_prices_and_context_window_backup.json"
|
||||
PINS_PATH: Final = "litellm/scripts/ci_cd/cost_map_pins.json"
|
||||
PINS_PATHS: Final = (
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ from typing import Final
|
|||
from pydantic import JsonValue, TypeAdapter
|
||||
|
||||
ROOT: Final = Path(__file__).resolve().parents[2]
|
||||
COST_MAP_PATH: Final = ROOT / "model_prices_and_context_window.json"
|
||||
SOURCE_PATH: Final = ROOT / "provider_endpoints_support.json"
|
||||
COST_MAP_PATH: Final = ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
SOURCE_PATH: Final = ROOT / "litellm/data/provider_endpoints_support.json"
|
||||
OUTPUT_PATHS: Final = (
|
||||
SOURCE_PATH,
|
||||
ROOT / "litellm/provider_endpoints_support_backup.json",
|
||||
|
|
@ -231,13 +231,13 @@ def main(argv: Sequence[str] | None = None, *, repo_root: Path = ROOT) -> int:
|
|||
parser: Final = argparse.ArgumentParser(description="Generate provider endpoint support from the model cost map")
|
||||
parser.add_argument("--check", action="store_true", help="fail if either generated file is stale")
|
||||
args: Final = parser.parse_args(argv)
|
||||
cost_map: Final = JSON_OBJECT.validate_json((repo_root / COST_MAP_PATH.name).read_bytes())
|
||||
current_json: Final = JSON_OBJECT.validate_json((repo_root / SOURCE_PATH.name).read_bytes())
|
||||
cost_map: Final = JSON_OBJECT.validate_json((repo_root / COST_MAP_PATH.relative_to(ROOT)).read_bytes())
|
||||
current_json: Final = JSON_OBJECT.validate_json((repo_root / SOURCE_PATH.relative_to(ROOT)).read_bytes())
|
||||
return generate_files(
|
||||
cost_map,
|
||||
current_json,
|
||||
(
|
||||
repo_root / SOURCE_PATH.name,
|
||||
repo_root / SOURCE_PATH.relative_to(ROOT),
|
||||
repo_root / OUTPUT_PATHS[1].relative_to(ROOT),
|
||||
),
|
||||
args.check,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ describe("recommended replacement", () => {
|
|||
expect(screen.getByText("new-model")).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: "LiteLLM model cost map" })).toHaveAttribute(
|
||||
"href",
|
||||
"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",
|
||||
"https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json",
|
||||
);
|
||||
expect(screen.getByRole("link", { name: /Provider deprecation notice/ })).toHaveAttribute(
|
||||
"href",
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default function RecommendedReplacement({ recommendation }: { recommendat
|
|||
{t("alerts.recommendation.source")}{" "}
|
||||
{source === "model_cost_map" ? (
|
||||
<a
|
||||
href="https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json"
|
||||
href="https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline underline-offset-2"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const ladder = () =>
|
|||
);
|
||||
|
||||
const catalog: Record<string, { mode?: string; litellm_provider?: string }> = JSON.parse(
|
||||
readFileSync(new URL("../../../../../../model_prices_and_context_window.json", import.meta.url), "utf8"),
|
||||
readFileSync(new URL("../../../../../data/model_prices_and_context_window.json", import.meta.url), "utf8"),
|
||||
);
|
||||
const catalogOpusModels = Object.entries(catalog).filter(
|
||||
([id, metadata]) => metadata.mode === "chat" && /claude-opus-\d/.test(id) && !/-(?:fast|think)$/.test(id),
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ const ProviderSpecificFieldsContent: React.FC<ProviderSpecificFieldsProps> = ({
|
|||
components={{
|
||||
docs: (
|
||||
<a
|
||||
href="https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json"
|
||||
href="https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-primary underline-offset-4 hover:underline"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const PROVIDER_CREATE_FIELDS: { provider: string; provider_display_name: string;
|
|||
);
|
||||
|
||||
const BUNDLED_MODEL_MAP: Record<string, { litellm_provider?: string }> = JSON.parse(
|
||||
readFileSync(resolve(__dirname, "../../../../../model_prices_and_context_window.json"), "utf8"),
|
||||
readFileSync(resolve(__dirname, "../../../../data/model_prices_and_context_window.json"), "utf8"),
|
||||
);
|
||||
|
||||
describe("provider_info_helpers", () => {
|
||||
|
|
|
|||
|
|
@ -6659,7 +6659,7 @@ def get_max_tokens(model: str) -> int | None:
|
|||
return None
|
||||
except Exception:
|
||||
raise Exception(
|
||||
f"Model {model} isn't mapped yet. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json"
|
||||
f"Model {model} isn't mapped yet. Add it here - https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json"
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -7070,7 +7070,7 @@ _ABOVE_THRESHOLD_COST_KEY: Final = ABOVE_THRESHOLD_COST_KEY_PATTERN
|
|||
def _model_not_mapped_message(model: str, custom_llm_provider: str | None) -> str:
|
||||
return (
|
||||
f"This model isn't mapped yet. model={model}, custom_llm_provider={custom_llm_provider}. "
|
||||
"Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json."
|
||||
"Add it here - https://github.com/BerriAI/litellm/blob/main/litellm/data/model_prices_and_context_window.json."
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -351,9 +351,12 @@ include = [
|
|||
"litellm/proxy/common_utils/codex_bundled_models_0.166.0.json",
|
||||
"litellm/proxy/common_utils/codex_bedrock_mantle_models_0.166.0.json",
|
||||
"litellm/proxy/common_utils/codex_bedrock_runtime_models_0.166.0.json",
|
||||
{ path = "model_prices_and_context_window.json", format = "sdist" },
|
||||
{ path = "litellm/data/model_prices_and_context_window.json", format = "sdist" },
|
||||
]
|
||||
exclude = [
|
||||
{ path = "litellm/data/model_prices_and_context_window.json", format = "wheel" },
|
||||
"litellm/data/policy_templates.json",
|
||||
"litellm/data/provider_endpoints_support.json",
|
||||
"litellm/scripts",
|
||||
"litellm/scripts/**",
|
||||
"litellm/runtime",
|
||||
|
|
@ -397,7 +400,7 @@ cache-keys = [
|
|||
{ file = "litellm/rust/Cargo.lock" },
|
||||
{ file = "litellm/rust/Cargo.toml" },
|
||||
{ file = "litellm/rust/crates/**/*" },
|
||||
{ file = "model_prices_and_context_window.json" },
|
||||
{ file = "litellm/data/model_prices_and_context_window.json" },
|
||||
]
|
||||
constraint-dependencies = [
|
||||
"tornado>=6.5.8",
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ def test_staging_stamps_release_version_without_modifying_sources(
|
|||
(stage / name).exists()
|
||||
for name in (
|
||||
"litellm/rust", "litellm/rust/.cargo/config.toml", "litellm/rust/rust-toolchain.toml",
|
||||
"model_prices_and_context_window.json",
|
||||
"litellm/data/model_prices_and_context_window.json",
|
||||
)
|
||||
)
|
||||
assert manifest.read_bytes() == original
|
||||
|
|
@ -206,7 +206,7 @@ def test_core_artifacts_exclude_local_configuration(distributions: tuple[Path, P
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"relative_path",
|
||||
["litellm/rust/rust-toolchain.toml", "litellm/rust/.cargo/config.toml", "model_prices_and_context_window.json"],
|
||||
["litellm/rust/rust-toolchain.toml", "litellm/rust/.cargo/config.toml", "litellm/data/model_prices_and_context_window.json"],
|
||||
)
|
||||
def test_core_sdist_preserves_native_build_configuration(distribution_directory: Path, relative_path: str) -> None:
|
||||
sdists: Final = tuple(distribution_directory.glob("litellm_core-*.tar.gz"))
|
||||
|
|
@ -245,7 +245,7 @@ def test_staging_copies_sources_without_build_artifacts(tmp_path: Path, source_r
|
|||
|
||||
source: Final = source_repository
|
||||
for name in SOURCES:
|
||||
(source / name).mkdir()
|
||||
(source / name).mkdir(parents=True, exist_ok=True)
|
||||
(source / name / "shared.txt").write_text("source payload")
|
||||
(source / name / "stale.so").write_text("old native extension")
|
||||
(source / name / "__pycache__").mkdir()
|
||||
|
|
@ -267,7 +267,7 @@ def test_staging_preserves_gitignore_rules(tmp_path: Path, source_repository: Pa
|
|||
|
||||
source: Final = source_repository
|
||||
for name in SOURCES:
|
||||
(source / name).mkdir()
|
||||
(source / name).mkdir(parents=True, exist_ok=True)
|
||||
(source / name / "shared.txt").write_text("shared payload")
|
||||
(source / "pyproject.toml").write_text('[project]\nname = "litellm"\nversion = "1.2.3"\n')
|
||||
manifest: Final = source / "litellm/packaging/litellm-core/pyproject.toml"
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ def extract_endpoints_from_sidebars() -> Dict[str, str]:
|
|||
def load_provider_endpoints_file() -> Dict:
|
||||
"""Load the provider_endpoints_support.json file."""
|
||||
repo_root = get_repo_root()
|
||||
file_path = repo_root / "provider_endpoints_support.json"
|
||||
file_path = repo_root / "litellm/data/provider_endpoints_support.json"
|
||||
|
||||
if not file_path.exists():
|
||||
print(
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def get_llm_provider_folders() -> Set[str]:
|
|||
def load_provider_endpoints_file() -> Dict:
|
||||
"""Load the provider_endpoints_support.json file."""
|
||||
repo_root = get_repo_root()
|
||||
file_path = repo_root / "provider_endpoints_support.json"
|
||||
file_path = repo_root / "litellm/data/provider_endpoints_support.json"
|
||||
|
||||
if not file_path.exists():
|
||||
print(
|
||||
|
|
|
|||
|
|
@ -141,10 +141,11 @@ def test_cost_map_provider_without_file_entry_is_an_error() -> None:
|
|||
|
||||
|
||||
def test_check_reports_stale_output_without_writing(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
(tmp_path / "litellm/data").mkdir(parents=True)
|
||||
cost_map: Final = {"example/model": {"litellm_provider": "example", "mode": "chat"}}
|
||||
current_json: Final = _current_json({"example": _provider()})
|
||||
(tmp_path / "model_prices_and_context_window.json").write_text(json.dumps(cost_map), encoding="utf-8")
|
||||
source_path: Final = tmp_path / "provider_endpoints_support.json"
|
||||
(tmp_path / "litellm/data/model_prices_and_context_window.json").write_text(json.dumps(cost_map), encoding="utf-8")
|
||||
source_path: Final = tmp_path / "litellm/data/provider_endpoints_support.json"
|
||||
source_content: Final = json.dumps(current_json)
|
||||
source_path.write_text(source_content, encoding="utf-8")
|
||||
|
||||
|
|
@ -159,16 +160,17 @@ def test_check_reports_stale_output_without_writing(tmp_path: Path, capsys: pyte
|
|||
|
||||
|
||||
def test_check_reports_stale_backup_without_writing(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
(tmp_path / "litellm/data").mkdir(parents=True)
|
||||
cost_map: Final = {"example/model": {"litellm_provider": "example", "mode": "chat"}}
|
||||
current_json: Final = _current_json({"example": _provider()})
|
||||
generated: Final = generate_provider_endpoints_support(cost_map, current_json)
|
||||
generated_content: Final = json.dumps(generated, indent=2, ensure_ascii=False) + "\n"
|
||||
source_path: Final = tmp_path / "provider_endpoints_support.json"
|
||||
source_path: Final = tmp_path / "litellm/data/provider_endpoints_support.json"
|
||||
backup_path: Final = tmp_path / "litellm/provider_endpoints_support_backup.json"
|
||||
backup_content: Final = "stale\n"
|
||||
(tmp_path / "model_prices_and_context_window.json").write_text(json.dumps(cost_map), encoding="utf-8")
|
||||
(tmp_path / "litellm/data/model_prices_and_context_window.json").write_text(json.dumps(cost_map), encoding="utf-8")
|
||||
source_path.write_text(generated_content, encoding="utf-8")
|
||||
backup_path.parent.mkdir()
|
||||
backup_path.parent.mkdir(exist_ok=True)
|
||||
backup_path.write_text(backup_content, encoding="utf-8")
|
||||
|
||||
result: Final = main(["--check"], repo_root=tmp_path)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def _number(value: JsonValue) -> float:
|
|||
|
||||
def _endpoint_cost() -> float:
|
||||
prices: Final = object_value(
|
||||
json.loads(Path("model_prices_and_context_window.json").read_text())[f"databricks/{_ENDPOINT}"]
|
||||
json.loads(Path("litellm/data/model_prices_and_context_window.json").read_text())[f"databricks/{_ENDPOINT}"]
|
||||
)
|
||||
usage: Final = object_value(_ENDPOINT_ANSWER["usage"])
|
||||
return _number(usage["input_tokens"]) * _number(prices["input_cost_per_token"]) + _number(
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ CACHED_TOKENS: Final = 4352
|
|||
CACHE_WRITE_TOKENS: Final = 5
|
||||
COMPLETION_TOKENS: Final = 20
|
||||
REASONING_TOKENS: Final = 12
|
||||
COST_MAP: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
COST_MAP: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
LEAK_FIELDS: Final = frozenset(
|
||||
{"litellm_params", "litellm_logging_obj", "litellm_call_id", "litellm_metadata", "proxy_server_request"}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ CHAT_USAGE: Final[dict[str, JsonValue]] = {
|
|||
}
|
||||
|
||||
|
||||
COST_MAP: Final = JSON.validate_json(Path("model_prices_and_context_window.json").read_bytes())
|
||||
COST_MAP: Final = JSON.validate_json(Path("litellm/data/model_prices_and_context_window.json").read_bytes())
|
||||
|
||||
|
||||
RESPONSES_PATH: Final = "/openai/v1/responses"
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ _SCRIPTED_STATUS: Final = re.compile(r"status=(\d{3})")
|
|||
_STARTED_WORKER: Final = re.compile(r"Started server process \[(\d+)\]")
|
||||
_JSON_OBJECT: Final = TypeAdapter(dict[str, JsonValue])
|
||||
_JSON_LIST: Final = TypeAdapter(list[JsonValue])
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_COST_MAP: Final = TypeAdapter(dict[str, dict[str, JsonValue]])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ def _number(value: JsonValue) -> float:
|
|||
|
||||
|
||||
def _expected_spend() -> float:
|
||||
cost_map: Final = JSON_OBJECT.validate_json(Path("model_prices_and_context_window.json").read_bytes())
|
||||
cost_map: Final = JSON_OBJECT.validate_json(Path("litellm/data/model_prices_and_context_window.json").read_bytes())
|
||||
priced: Final = cost_map.get(_CLAIRIC)
|
||||
assert priced is not None, f"{_CLAIRIC} has no cost map entry"
|
||||
return _INPUT_TOKENS * _number(object_value(priced)["input_cost_per_token"])
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ def _number(value: JsonValue) -> float:
|
|||
|
||||
|
||||
def _expected_spend(cost_map_key: str) -> float:
|
||||
cost_map: Final = _JSON_OBJECT.validate_json(Path("model_prices_and_context_window.json").read_bytes())
|
||||
cost_map: Final = _JSON_OBJECT.validate_json(Path("litellm/data/model_prices_and_context_window.json").read_bytes())
|
||||
priced: Final = cost_map.get(cost_map_key)
|
||||
assert priced is not None, f"{cost_map_key} has no cost map entry"
|
||||
return _INPUT_TOKENS * _number(object_value(priced)["input_cost_per_token"])
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ def _answered_probability(route: Route, text: str) -> JsonValue:
|
|||
|
||||
|
||||
def _price() -> dict[str, JsonValue]:
|
||||
cost_map: Final = _JSON_OBJECT.validate_json(Path("model_prices_and_context_window.json").read_bytes())
|
||||
cost_map: Final = _JSON_OBJECT.validate_json(Path("litellm/data/model_prices_and_context_window.json").read_bytes())
|
||||
priced: Final = cost_map.get(_COST_MAP_KEY)
|
||||
assert priced is not None, f"{_COST_MAP_KEY} has no cost map entry"
|
||||
return object_value(priced)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ _KIMI: Final = "us.moonshotai.kimi-k3"
|
|||
_KIMI_BASE: Final = "moonshotai.kimi-k3"
|
||||
_PROFILE_ID: Final = "lit9563count"
|
||||
_PROFILE_ARN: Final = f"arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/{_PROFILE_ID}"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_REGION: Final = "us-west-2"
|
||||
_ACCESS_KEY: Final = "AKIAINTEGRATIONCOUNT"
|
||||
_SECRET_KEY: Final = "integration-count-secret"
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ def _number(value: JsonValue) -> float:
|
|||
|
||||
def _endpoint_spend() -> float:
|
||||
prices: Final = object_value(
|
||||
json.loads(Path("model_prices_and_context_window.json").read_text())[f"databricks/{_ENDPOINT}"]
|
||||
json.loads(Path("litellm/data/model_prices_and_context_window.json").read_text())[f"databricks/{_ENDPOINT}"]
|
||||
)
|
||||
return _number(_USAGE["input_tokens"]) * _number(prices["input_cost_per_token"]) + _number(
|
||||
_USAGE["output_tokens"]
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ def _expected_spend(provider: _Provider) -> float:
|
|||
return provider.provider_reported_cost
|
||||
if provider.cost_map_key is None:
|
||||
return 0.0
|
||||
cost_map: Final = _JSON_OBJECT.validate_json(Path("model_prices_and_context_window.json").read_bytes())
|
||||
cost_map: Final = _JSON_OBJECT.validate_json(Path("litellm/data/model_prices_and_context_window.json").read_bytes())
|
||||
prices: Final = object_value(cost_map[provider.cost_map_key])
|
||||
input_key: Final = (
|
||||
"input_cost_per_token_decisions" if "input_cost_per_token_decisions" in prices else "input_cost_per_token"
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ def _expected_spend(provider: _Provider) -> float:
|
|||
if provider.cost_map_key is None:
|
||||
return 0.0
|
||||
prices: Final = object_value(
|
||||
json.loads(Path("model_prices_and_context_window.json").read_text())[provider.cost_map_key]
|
||||
json.loads(Path("litellm/data/model_prices_and_context_window.json").read_text())[provider.cost_map_key]
|
||||
)
|
||||
return _number(_USAGE["input_tokens"]) * _number(prices["input_cost_per_token"]) + _number(
|
||||
_USAGE["output_tokens"]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from pydantic import JsonValue, TypeAdapter
|
|||
|
||||
_MODEL: Final = "fal-ai/moondream3-preview/query"
|
||||
_PROMPT: Final = "what is in this image?"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_JSON_OBJECT: Final = TypeAdapter(dict[str, JsonValue])
|
||||
_COST_MAP: Final = TypeAdapter(dict[str, dict[str, object]])
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ _PNG_BYTES: Final = (
|
|||
b"\x89\x99=\x1d\x00\x00\x00\x00IEND\xaeB`\x82"
|
||||
)
|
||||
_PROMPT: Final = "a red circle on a blue background"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_JSON_OBJECT: Final = TypeAdapter(dict[str, JsonValue])
|
||||
_COST_MAP: Final = TypeAdapter(dict[str, dict[str, object]])
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ _ROUTER_RESOURCE: Final = "accounts/fireworks/routers/glm-latest"
|
|||
_FIREROUTER_SLUGS: Final = ("firerouter", "firerouter/kimi-k3/deepseek-v4")
|
||||
_API_KEY: Final = "synthetic-fireworks-key"
|
||||
_PROMPT: Final = "route me through the router"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_JSON_OBJECT: Final = TypeAdapter(dict[str, JsonValue])
|
||||
_COST_MAP: Final = TypeAdapter(dict[str, dict[str, object]])
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ _WEATHER_TOOL: Final[JsonValue] = {
|
|||
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
|
||||
},
|
||||
}
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_ENDPOINT_SUPPORT_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/provider_endpoints_support_backup.json"
|
||||
_COST_MAP: Final = TypeAdapter(dict[str, dict[str, JsonValue]])
|
||||
_JSON_OBJECT: Final = TypeAdapter(dict[str, JsonValue])
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ _WEATHER_TOOL: Final[JsonValue] = {
|
|||
},
|
||||
},
|
||||
}
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "model_prices_and_context_window.json"
|
||||
_COST_MAP_PATH: Final = Path(__file__).resolve().parents[3] / "litellm/data/model_prices_and_context_window.json"
|
||||
_JSON_OBJECT: Final = TypeAdapter(dict[str, JsonValue])
|
||||
_COST_MAP: Final = TypeAdapter(dict[str, dict[str, object]])
|
||||
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ def test_a_five_kilobyte_prompt_with_a_system_message_reaches_the_classifier_who
|
|||
|
||||
def _typesafe_cost() -> float:
|
||||
prices: Final = object_value(
|
||||
json.loads(Path("model_prices_and_context_window.json").read_text())[f"typesafe/{_TYPESAFE_MODEL}"]
|
||||
json.loads(Path("litellm/data/model_prices_and_context_window.json").read_text())[f"typesafe/{_TYPESAFE_MODEL}"]
|
||||
)
|
||||
return _number(_USAGE["input_tokens"]) * _number(prices["input_cost_per_token"]) + _number(
|
||||
_USAGE["output_tokens"]
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ def test_exact_entries_fill_only_missing_fields(restore_generalizations, monkeyp
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"cost_map_path",
|
||||
["model_prices_and_context_window.json", "litellm/model_prices_and_context_window_backup.json"],
|
||||
["litellm/data/model_prices_and_context_window.json", "litellm/model_prices_and_context_window_backup.json"],
|
||||
)
|
||||
def test_every_shipped_rule_installs_without_a_skip_warning(
|
||||
restore_generalizations: Callable[[list | None], None], warning_messages: list[str], cost_map_path: str
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ def _load_model_registry() -> Dict[str, Any]:
|
|||
"""Load the root model_prices_and_context_window.json."""
|
||||
json_path = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"../../../../../model_prices_and_context_window.json",
|
||||
"../../../../../litellm/data/model_prices_and_context_window.json",
|
||||
)
|
||||
with open(json_path) as f:
|
||||
return json.load(f)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
|||
from litellm.types.utils import TranscriptionResponse
|
||||
|
||||
REPO_ROOT: Final = Path(__file__).parents[4]
|
||||
MAIN_COST_MAP: Final = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_COST_MAP: Final = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_COST_MAP: Final = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
COST_MAP_ADAPTER: Final = TypeAdapter(dict[str, dict[str, object]])
|
||||
A_MILLION: Final = 1_000_000
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ def test_reasoning_effort_is_advertised_only_for_reasoning_models(local_model_co
|
|||
|
||||
|
||||
def test_cost_map_rows_match_the_backup_and_resolve_their_effort_levels() -> None:
|
||||
rows: Final = _clf_rows(REPO_ROOT / "model_prices_and_context_window.json")
|
||||
rows: Final = _clf_rows(REPO_ROOT / "litellm/data/model_prices_and_context_window.json")
|
||||
assert rows
|
||||
assert rows == _clf_rows(REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json")
|
||||
for key, row in rows.items():
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ class TestQwenBrandUserFacingNames:
|
|||
"matrix_path",
|
||||
[
|
||||
Path(litellm.__file__).parent / "provider_endpoints_support_backup.json",
|
||||
Path(litellm.__file__).parent.parent / "provider_endpoints_support.json",
|
||||
Path(litellm.__file__).parent.parent / "litellm/data/provider_endpoints_support.json",
|
||||
],
|
||||
ids=["backup", "root"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from litellm.llms.databricks.cost_calculator import cost_per_token
|
|||
from litellm.types.utils import ModelInfo, Usage
|
||||
|
||||
REPO_ROOT: Final = Path(__file__).parents[4]
|
||||
MAIN_PRICES: Final = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_PRICES: Final = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PRICES: Final = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
NEW_MODELS: Final = (
|
||||
"databricks/databricks-claude-opus-4-7",
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ class TestDashboardRegistration:
|
|||
@pytest.mark.parametrize(
|
||||
"matrix_path",
|
||||
[
|
||||
REPO_ROOT / "provider_endpoints_support.json",
|
||||
REPO_ROOT / "litellm/data/provider_endpoints_support.json",
|
||||
REPO_ROOT / "litellm" / "provider_endpoints_support_backup.json",
|
||||
],
|
||||
ids=["root", "backup"],
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ def test_minimax_flash_cost_map_entry_is_a_priced_reasoning_model(local_model_co
|
|||
entries: Final = tuple(
|
||||
json.loads(path.read_text())["minimax/MiniMax-M3.1-Flash"]
|
||||
for path in (
|
||||
repo_root / "model_prices_and_context_window.json",
|
||||
repo_root / "litellm/data/model_prices_and_context_window.json",
|
||||
repo_root / "litellm/model_prices_and_context_window_backup.json",
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ def test_coralbricks_rows_are_listed_for_wildcard_expansion():
|
|||
|
||||
def test_coralbricks_cost_map_backup_mirrors_main():
|
||||
main_map: Final = json.loads(
|
||||
(Path(litellm.__file__).parent.parent / "model_prices_and_context_window.json").read_text()
|
||||
(Path(litellm.__file__).parent.parent / "litellm/data/model_prices_and_context_window.json").read_text()
|
||||
)
|
||||
backup_map: Final = json.loads(
|
||||
(Path(litellm.__file__).parent / "model_prices_and_context_window_backup.json").read_text()
|
||||
|
|
@ -398,7 +398,7 @@ def test_coralbricks_cost_map_rows_declare_same_endpoints_as_providers_json():
|
|||
)
|
||||
declared: Final = providers_json["coralbricks"]["supported_endpoints"]
|
||||
cost_map_paths: Final = (
|
||||
Path(litellm.__file__).parent.parent / "model_prices_and_context_window.json",
|
||||
Path(litellm.__file__).parent.parent / "litellm/data/model_prices_and_context_window.json",
|
||||
Path(litellm.__file__).parent / "model_prices_and_context_window_backup.json",
|
||||
)
|
||||
for cost_map_path in cost_map_paths:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ from litellm.proxy.common_request_processing import cost_headers
|
|||
from litellm.types.utils import Delta, ModelResponseStream, StreamingChoices, Usage
|
||||
|
||||
_REPO_ROOT: Final = Path(__file__).resolve().parents[4]
|
||||
_PRIMARY_PRICES: Final = json.loads((_REPO_ROOT / "model_prices_and_context_window.json").read_text())
|
||||
_PRIMARY_PRICES: Final = json.loads((_REPO_ROOT / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
_BACKUP_PRICES: Final = json.loads((_REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json").read_text())
|
||||
_CATALOG_MODELS: Final = tuple(
|
||||
key for key, row in _PRIMARY_PRICES.items() if isinstance(row, dict) and row.get("litellm_provider") == "kyma"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from litellm.caching.llm_caching_handler import LLMClientCache
|
|||
from litellm.proxy.auth.model_checks import get_provider_models
|
||||
|
||||
_REPO_ROOT: Final = Path(__file__).resolve().parents[4]
|
||||
_PRIMARY_PRICES: Final = json.loads((_REPO_ROOT / "model_prices_and_context_window.json").read_text())
|
||||
_PRIMARY_PRICES: Final = json.loads((_REPO_ROOT / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
_BACKUP_PRICES: Final = json.loads((_REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json").read_text())
|
||||
_CATALOG_MODELS: Final = tuple(
|
||||
key for key, row in _PRIMARY_PRICES.items() if isinstance(row, dict) and row.get("litellm_provider") == "openinfer"
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ def test_prism_model_cost_and_capabilities(model: str):
|
|||
|
||||
def test_prism_backup_registry_mirrors_cost_map():
|
||||
package_root = Path(litellm.__file__).parent
|
||||
cost_map = json.loads((package_root.parent / "model_prices_and_context_window.json").read_text())
|
||||
cost_map = json.loads((package_root.parent / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
backup = json.loads((package_root / "model_prices_and_context_window_backup.json").read_text())
|
||||
prism_entries = {name: entry for name, entry in cost_map.items() if name.startswith("prism/")}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ class TestSCXAIModelMetadata:
|
|||
|
||||
|
||||
def test_scx_ai_models_synced_to_backup(self):
|
||||
model_cost = self._load(("model_prices_and_context_window.json",))
|
||||
model_cost = self._load(("litellm/data/model_prices_and_context_window.json",))
|
||||
backup = self._load(("litellm", "model_prices_and_context_window_backup.json"))
|
||||
for model in self.SCX_MODELS:
|
||||
assert model in backup, f"{model} missing from backup json"
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ def _streamlake_keys(cost_map: dict[str, object]) -> tuple[str, ...]:
|
|||
|
||||
|
||||
def test_root_and_backup_cost_maps_carry_the_same_streamlake_rows() -> None:
|
||||
root: Final = json.loads((REPO_ROOT / "model_prices_and_context_window.json").read_text())
|
||||
root: Final = json.loads((REPO_ROOT / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
backup: Final = json.loads((REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json").read_text())
|
||||
|
||||
assert _streamlake_keys(root)
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ def test_wally_model_missing_from_cost_map_uses_provider_defaults():
|
|||
|
||||
def test_wally_backup_registry_mirrors_cost_map():
|
||||
package_root: Final = Path(litellm.__file__).parent
|
||||
cost_map: Final = json.loads((package_root.parent / "model_prices_and_context_window.json").read_text())
|
||||
cost_map: Final = json.loads((package_root.parent / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
backup: Final = json.loads((package_root / "model_prices_and_context_window_backup.json").read_text())
|
||||
wally_entries: Final = {name: entry for name, entry in cost_map.items() if name.startswith("wally/")}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ def test_wally_is_available_in_add_model_form():
|
|||
|
||||
def test_wally_supported_endpoints():
|
||||
backup_path: Final = Path(litellm.__file__).parent / "provider_endpoints_support_backup.json"
|
||||
root_path: Final = Path(litellm.__file__).parent.parent / "provider_endpoints_support.json"
|
||||
root_path: Final = Path(litellm.__file__).parent.parent / "litellm/data/provider_endpoints_support.json"
|
||||
|
||||
backup: Final = json.loads(backup_path.read_text())["providers"]["wally"]["endpoints"]
|
||||
root: Final = json.loads(root_path.read_text())["providers"]["wally"]["endpoints"]
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class TestPerplexityCostCalculator:
|
|||
|
||||
# Load the model cost map
|
||||
try:
|
||||
with open("model_prices_and_context_window.json", "r") as f:
|
||||
with open("litellm/data/model_prices_and_context_window.json", "r") as f:
|
||||
model_cost_map = json.load(f)
|
||||
litellm.model_cost = model_cost_map
|
||||
except FileNotFoundError:
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class TestPerplexityIntegration:
|
|||
|
||||
# Load the model cost map
|
||||
try:
|
||||
with open("model_prices_and_context_window.json", "r") as f:
|
||||
with open("litellm/data/model_prices_and_context_window.json", "r") as f:
|
||||
model_cost_map = json.load(f)
|
||||
litellm.model_cost = model_cost_map
|
||||
except FileNotFoundError:
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ def test_vercel_ai_gateway_models_endpoint_failure():
|
|||
def test_vercel_ai_gateway_glm46_cost_math():
|
||||
"""Test the cost math for glm-4.6"""
|
||||
|
||||
with open("model_prices_and_context_window.json", "r") as f:
|
||||
with open("litellm/data/model_prices_and_context_window.json", "r") as f:
|
||||
litellm.model_cost = json.load(f)
|
||||
|
||||
key = "vercel_ai_gateway/zai/glm-4.6"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from litellm.types.videos.main import VideoObject
|
|||
|
||||
VEO_31_LITE_VERTEX_MODEL = "vertex_ai/veo-3.1-lite-generate-001"
|
||||
ROOT_MODEL_COST_PATH = (
|
||||
Path(__file__).parents[5] / "model_prices_and_context_window.json"
|
||||
Path(__file__).parents[5] / "litellm/data/model_prices_and_context_window.json"
|
||||
)
|
||||
BACKUP_MODEL_COST_PATH = (
|
||||
Path(__file__).parents[5]
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class TestXAICostCalculator:
|
|||
import json
|
||||
|
||||
try:
|
||||
with open("model_prices_and_context_window.json", "r") as f:
|
||||
with open("litellm/data/model_prices_and_context_window.json", "r") as f:
|
||||
model_cost_map = json.load(f)
|
||||
litellm.model_cost = model_cost_map
|
||||
except FileNotFoundError:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||
import pytest
|
||||
|
||||
REPO_ROOT = Path(__file__).parents[4]
|
||||
PRICES_PATH = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
PRICES_PATH = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PRICES_PATH = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
# https://docs.x.ai/developers/model-capabilities/text/multi-agent
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ _DEFAULT: Final = {
|
|||
"token_count_framing": 97,
|
||||
"token_count_model": {"model": "anthropic.claude-opus-5-5", "region": "us-east-1"},
|
||||
}
|
||||
_COST_MAP: Final = Path(__file__).parents[4] / "model_prices_and_context_window.json"
|
||||
_COST_MAP: Final = Path(__file__).parents[4] / "litellm/data/model_prices_and_context_window.json"
|
||||
|
||||
|
||||
def _in_us_west_2() -> str:
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class TestContentFilterPathTraversal:
|
|||
def test_every_category_file_published_in_policy_templates_resolves(self, monkeypatch, tmp_path):
|
||||
"""The proxy fetches policy_templates.json from main, so every path in it must exist in the package."""
|
||||
monkeypatch.chdir(tmp_path)
|
||||
published = os.path.join(os.path.dirname(os.path.dirname(litellm.__file__)), "policy_templates.json")
|
||||
published = os.path.join(os.path.dirname(os.path.dirname(litellm.__file__)), "litellm/data/policy_templates.json")
|
||||
category_files = re.findall(r'"category_file":\s*"([^"]+)"', open(published).read())
|
||||
assert category_files
|
||||
guardrail = self._get_guardrail()
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from .conftest import VOLATILE_KEYS, normalize
|
|||
_VOLATILE = VOLATILE_KEYS | frozenset({"timestamp"})
|
||||
|
||||
_SERVED_ETAG = 'W/"cost-map-etag"'
|
||||
_ROOT_COST_MAP = Path(__file__).resolve().parents[4] / "model_prices_and_context_window.json"
|
||||
_ROOT_COST_MAP = Path(__file__).resolve().parents[4] / "litellm/data/model_prices_and_context_window.json"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ def test_accepts_expected_release_wheel_tags(tmp_path: Path) -> None:
|
|||
"litellm/runtime/backend/main.py",
|
||||
"litellm/runtime/gateway/launch.py",
|
||||
"litellm/schema.prisma",
|
||||
"litellm/data/model_prices_and_context_window.json",
|
||||
"litellm/data/policy_templates.json",
|
||||
"litellm/data/provider_endpoints_support.json",
|
||||
),
|
||||
)
|
||||
def test_rejects_repository_sources_in_the_wheel(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ def _load_model_cost(path: Path) -> dict:
|
|||
@pytest.fixture(autouse=True)
|
||||
def reload_model_costs():
|
||||
original_model_cost = litellm.model_cost
|
||||
json_path = Path(__file__).parents[2] / "model_prices_and_context_window.json"
|
||||
json_path = Path(__file__).parents[2] / "litellm/data/model_prices_and_context_window.json"
|
||||
litellm.model_cost = _load_model_cost(json_path)
|
||||
get_model_info.cache_clear()
|
||||
yield
|
||||
|
|
@ -28,7 +28,7 @@ def reload_model_costs():
|
|||
|
||||
def test_azure_ai_grok_4_3_backup_matches_main():
|
||||
repo_root = Path(__file__).parents[2]
|
||||
main_path = repo_root / "model_prices_and_context_window.json"
|
||||
main_path = repo_root / "litellm/data/model_prices_and_context_window.json"
|
||||
backup_path = repo_root / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
main_cost = _load_model_cost(main_path)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ def test_azure_ai_grok_4_6_is_priced_and_routed() -> None:
|
|||
|
||||
|
||||
def test_azure_ai_grok_4_6_entry_source_and_backup_match() -> None:
|
||||
main_entry = _cost_map_entry(REPO_ROOT / "model_prices_and_context_window.json")
|
||||
main_entry = _cost_map_entry(REPO_ROOT / "litellm/data/model_prices_and_context_window.json")
|
||||
backup_entry = _cost_map_entry(REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json")
|
||||
|
||||
assert backup_entry == main_entry
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import pytest
|
|||
import litellm
|
||||
|
||||
REPO_ROOT = Path(__file__).parents[2]
|
||||
MAIN_PATH = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_PATH = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PATH = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
MODEL = "baseten/zai-org/GLM-5.3"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import pytest
|
|||
from litellm.constants import bedrock_embedding_models
|
||||
|
||||
REPO_ROOT = Path(__file__).parents[2]
|
||||
MAIN_PATH = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_PATH = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PATH = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
BASE_MODEL = "twelvelabs.marengo-embed-3-0-v1:0"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import litellm
|
|||
@pytest.fixture(scope="module")
|
||||
def model_cost_maps():
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
main_path = root / "model_prices_and_context_window.json"
|
||||
main_path = root / "litellm/data/model_prices_and_context_window.json"
|
||||
backup_path = root / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
with open(main_path, "r", encoding="utf-8") as f:
|
||||
|
|
|
|||
|
|
@ -94,21 +94,21 @@ CI = [".github/workflows/test-unit.yml"]
|
|||
("backend", BACKEND + CLIENT, "run"),
|
||||
("client", BACKEND + CLIENT, "run"),
|
||||
("ui", BACKEND + CLIENT, "run"),
|
||||
("cost-map-only", ["model_prices_and_context_window.json"], "run"),
|
||||
("cost-map-only", ["litellm/data/model_prices_and_context_window.json"], "run"),
|
||||
("cost-map-only", ["litellm/model_prices_and_context_window_backup.json"], "run"),
|
||||
(
|
||||
"cost-map-only",
|
||||
["model_prices_and_context_window.json", "tests/unit/proxy/test_y.py"],
|
||||
["litellm/data/model_prices_and_context_window.json", "tests/unit/proxy/test_y.py"],
|
||||
"run",
|
||||
),
|
||||
(
|
||||
"cost-map-only",
|
||||
["model_prices_and_context_window.json", "litellm/utils.py"],
|
||||
["litellm/data/model_prices_and_context_window.json", "litellm/utils.py"],
|
||||
"skip",
|
||||
),
|
||||
("cost-map-only", ["tests/unit/proxy/test_y.py"], "skip"),
|
||||
("cost-map-only", ["model_prices_and_context_window.json", "docs/pricing.md"], "skip"),
|
||||
("cost-map-only", ["model_prices_and_context_window.json", "docs/foo.mdx"], "skip"),
|
||||
("cost-map-only", ["litellm/data/model_prices_and_context_window.json", "docs/pricing.md"], "skip"),
|
||||
("cost-map-only", ["litellm/data/model_prices_and_context_window.json", "docs/foo.mdx"], "skip"),
|
||||
("cost-map-only", [], "skip"),
|
||||
("cost-map-only", DOCS, "skip"),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ REPO_ROOT = os.path.join(os.path.dirname(__file__), "../..")
|
|||
|
||||
|
||||
def _load_root_cost_map() -> dict:
|
||||
json_path = os.path.join(REPO_ROOT, "model_prices_and_context_window.json")
|
||||
json_path = os.path.join(REPO_ROOT, "litellm/data/model_prices_and_context_window.json")
|
||||
with open(json_path) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ def local_model_cost_map(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
|
|||
|
||||
|
||||
def _load_root_cost_map() -> dict[str, dict[str, object]]:
|
||||
json_path: Final = os.path.join(REPO_ROOT, "model_prices_and_context_window.json")
|
||||
json_path: Final = os.path.join(REPO_ROOT, "litellm/data/model_prices_and_context_window.json")
|
||||
with open(json_path) as f:
|
||||
return cast(dict[str, dict[str, object]], json.load(f))
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ REPO_ROOT = os.path.join(os.path.dirname(__file__), "../..")
|
|||
|
||||
|
||||
def _load_root_cost_map() -> dict:
|
||||
json_path = os.path.join(REPO_ROOT, "model_prices_and_context_window.json")
|
||||
json_path = os.path.join(REPO_ROOT, "litellm/data/model_prices_and_context_window.json")
|
||||
with open(json_path) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ REPO_ROOT = os.path.join(os.path.dirname(__file__), "../..")
|
|||
|
||||
|
||||
def _load_root_cost_map() -> dict:
|
||||
json_path = os.path.join(REPO_ROOT, "model_prices_and_context_window.json")
|
||||
json_path = os.path.join(REPO_ROOT, "litellm/data/model_prices_and_context_window.json")
|
||||
with open(json_path) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import litellm
|
|||
|
||||
ROOT_MAP = os.path.join(
|
||||
os.path.dirname(os.path.dirname(litellm.__file__)),
|
||||
"model_prices_and_context_window.json",
|
||||
"litellm/data/model_prices_and_context_window.json",
|
||||
)
|
||||
BACKUP_MAP = os.path.join(
|
||||
os.path.dirname(litellm.__file__),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from pathlib import Path
|
|||
import pytest
|
||||
|
||||
REPO_ROOT = Path(__file__).parents[2]
|
||||
MAIN_PATH = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_PATH = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PATH = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
DAYBREAK_MODELS = (
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def local_model_cost_map(monkeypatch):
|
|||
|
||||
@pytest.mark.parametrize("model, per_character", PRICES.items())
|
||||
def test_metadata_and_backup(model, per_character):
|
||||
main = json.loads((REPO_ROOT / "model_prices_and_context_window.json").read_text())
|
||||
main = json.loads((REPO_ROOT / "litellm/data/model_prices_and_context_window.json").read_text())
|
||||
backup = json.loads((REPO_ROOT / "litellm/model_prices_and_context_window_backup.json").read_text())
|
||||
assert main[model] == backup[model]
|
||||
info = litellm.get_model_info(model)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from litellm.utils import get_model_info
|
|||
|
||||
@pytest.fixture(scope="module")
|
||||
def model_data():
|
||||
json_path = os.path.join(os.path.dirname(__file__), "../../model_prices_and_context_window.json")
|
||||
json_path = os.path.join(os.path.dirname(__file__), "../../litellm/data/model_prices_and_context_window.json")
|
||||
with open(json_path) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import pytest
|
|||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
REPO_ROOT = Path(__file__).parents[2]
|
||||
MAIN_PATH = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_PATH = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PATH = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
UNPREFIXED = "gemini-3.1-flash-lite-image"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ def test_gemini_4_argon_routes_to_its_provider_on_the_thinking_level_path(
|
|||
|
||||
@pytest.mark.parametrize("model", [row[0] for row in MODELS])
|
||||
def test_gemini_4_argon_entry_source_and_backup_match(model: str) -> None:
|
||||
main_entry = _cost_map_entry(REPO_ROOT / "model_prices_and_context_window.json", model)
|
||||
main_entry = _cost_map_entry(REPO_ROOT / "litellm/data/model_prices_and_context_window.json", model)
|
||||
backup_entry = _cost_map_entry(REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json", model)
|
||||
|
||||
assert backup_entry == main_entry
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import pytest
|
|||
import litellm
|
||||
|
||||
REPO_ROOT: Final = Path(__file__).parents[2]
|
||||
MAIN_PATH: Final = REPO_ROOT / "model_prices_and_context_window.json"
|
||||
MAIN_PATH: Final = REPO_ROOT / "litellm/data/model_prices_and_context_window.json"
|
||||
BACKUP_PATH: Final = REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
FLASH_TTS_KEYS: Final = ("gemini-2.5-flash-preview-tts", "gemini/gemini-2.5-flash-preview-tts")
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue