Repository navigation
Conversation
…provider Registers kyma (https://kymaapi.com) the same way as the recent darkbloom, libertai and scx-ai providers: a providers.json entry, an LlmProviders enum value, and the two openai_compatible_* lists in constants.py. No Python handler code -- Kyma is a plain OpenAI-compatible /v1/chat/completions endpoint, so the JSON-configured-provider path covers it. Adds all 70 kyma/* entries to model_prices_and_context_window.json (root and the litellm/ backup copy), splicing them in rather than reserializing the file -- the prior submission (BerriAI#25543, closed) rewrote the entire 1.6MB file (+38274/-38128), which is a guaranteed merge conflict on a fast-moving file. This diff is addition-only. Two fixes applied against the source catalog while assembling this: - 27 of the 70 entries carried floating-point noise on their price fields (e.g. 4.9799999999999996e-08) from upstream markup math; rounded to 6 significant figures. - Models with supports_prompt_caching=true had no cache_read_input_token_cost, so LiteLLM's own cost calculator would have priced cache reads at $0. Kyma's documented policy is a 90% discount (10% of input price); added that rate to all such entries. Adds a provider_endpoints_support.json entry (root + backup) advertising chat_completions only -- the JSON-configured-provider path wires chat routing alone (see the libertai/scx-ai precedent), so Kyma's own /v1/messages, /v1/embeddings and /v1/rerank surfaces are not claimed here even though they exist on kymaapi.com itself. Test: tests/test_litellm/llms/openai_like/test_kyma_provider.py, 15 cases, mocked only. Routing/cost assertions use litellm's built-in mock_response completion path rather than patching internals -- the previous submission patched litellm.main.completion, which is never invoked because litellm.completion is bound at import time via `from .main import *`, so the mock silently never fired and the "mocked" test made a real network call. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Rok2mujdEZ2yGw8wVfbr9
Merging this PR will not alter performance
Comparing |
Greptile SummaryAdds Kyma as a declarative OpenAI-compatible chat provider, including routing identity, credentials, endpoint metadata, model pricing, capability data, and mocked provider tests
Confidence Score: 4/5The provider integration is mostly aligned, but the leaking test fixture and explicit source-comment rule violation should be fixed before merging The module-scoped fixture leaves environment, model-cost, and cached model information altered for later tests, creating order-dependent suite behavior; the catalog also contains one unreachable pricing tier Files Needing Attention: tests/test_litellm/llms/openai_like/test_kyma_provider.py, model_prices_and_context_window.json, litellm/model_prices_and_context_window_backup.json
|
| Filename | Overview |
|---|---|
| litellm/constants.py | Registers Kyma's API base and provider slug in the OpenAI-compatible routing lists |
| litellm/llms/openai_like/providers.json | Adds the declarative Kyma base URL and API-key environment variable |
| litellm/types/utils.py | Adds Kyma to the provider enum used by provider resolution and configuration |
| model_prices_and_context_window.json | Adds 70 Kyma pricing and capability entries, including an unreachable 256k tier for qwen-3.6-plus |
| litellm/model_prices_and_context_window_backup.json | Mirrors the Kyma catalog and the qwen-3.6-plus tier inconsistency in the bundled backup |
| provider_endpoints_support.json | Advertises Kyma as chat-completions-only |
| litellm/provider_endpoints_support_backup.json | Mirrors Kyma's chat-only endpoint support in the bundled backup |
| tests/test_litellm/llms/openai_like/test_kyma_provider.py | Adds provider, metadata, endpoint, and cost tests but leaks process-global model-cost state and contains prohibited commentary |
Reviews (1): Last reviewed commit: "feat(providers): add Kyma API as a JSON-..." | Re-trigger Greptile
| os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True" # test-quality-ok: kyma not on remote map yet | ||
| litellm.model_cost = litellm.get_model_cost_map(url="") # test-quality-ok: reload after env set |
| """ | ||
| Tests for Kyma API provider configuration and integration. | ||
|
|
||
| Kyma API (https://kymaapi.com) is an OpenAI-compatible LLM gateway. Registered | ||
| here as a JSON-configured provider (litellm/llms/openai_like/providers.json). | ||
|
|
||
| No real network calls: config/registration assertions use JSONProviderRegistry | ||
| directly, and the routing/cost assertions use litellm's own `mock_response` | ||
| completion path (see litellm/main.py) rather than patching internals -- the | ||
| previous submission (PR #25543) patched `litellm.main.completion`, which is | ||
| never called because `litellm.completion` is bound at import time via | ||
| `from .main import *`, so the mock silently never fired. | ||
| """ |
There was a problem hiding this comment.
Prohibited explanatory comments
These docstrings narrate provider history and test mechanics, violating the repository directive to reserve comments for necessary complex logic or tool instructions. This requirement must be satisfied before merging
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| "input_cost_per_token_above_256k_tokens": 1.755e-06, | ||
| "output_cost_per_token_above_256k_tokens": 5.265e-06, |
There was a problem hiding this comment.
This model caps input at 131,072 tokens but defines pricing above 256k, so the tier can never apply and leaves misleading catalog data
Knowledge Base Used: Provider adapters and capabilities
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
test_kyma_provider.py: the module-scoped autouse fixture set LITELLM_LOCAL_MODEL_COST_MAP and litellm.model_cost without restoring either, and never cleared the lru_cache behind get_model_info, so later tests in the same process could see kyma leaked into their view of the map. Replaced with a function-scoped fixture using monkeypatch (auto- reverts both), requested only by the two tests that need it, plus an explicit cache_clear before and after. Dropped narrative comments and docstrings not covered by this repo's CLAUDE.md comment policy. model_prices_and_context_window.json (+ backup): kyma/qwen-3.6-plus caps max_input_tokens at 131072 but carried input/output_cost_per_token_above_256k_tokens tiers that could never be reached. Removed both; entry count is still 70. model_prices_and_context_window.schema.json: regenerated. The only diff is input/output_cost_per_token_above_32k_tokens, from kyma/qwen3.7-flash's own (reachable) 32k tier, which no prior entry in the file used.
|
Addressed the review and the schema check in be76d05:
Local gates rerun green: 15/15 provider tests, ruff check and format, the quality, type-check and type-discipline gates, import-safety and circular-import checks. |
…ty tests model_prices_and_context_window.json (+ backup): every kyma/claude-* entry was missing capability flags that the repo's cross-provider tests require to match the canonical anthropic entry for the same model. Copied from the canonical root entry (litellm_provider, prices and context fields excluded, since kyma legitimately has its own): - claude-fable-5, claude-fable-5.1: supports_adaptive_thinking, thinking_always_on, supports_sampling_params=false - claude-opus-4-7: supports_adaptive_thinking, supports_sampling_params=false, prompt_cache_min_tokens=2048 - claude-opus-5, claude-opus-5-fast: supports_adaptive_thinking, supports_sampling_params=false, prompt_cache_min_tokens=512 - claude-sonnet-4-6: supports_adaptive_thinking, prompt_cache_min_tokens=1024 - claude-sonnet-5: supports_adaptive_thinking, supports_sampling_params=false, prompt_cache_min_tokens=1024 - claude-haiku-4-5: prompt_cache_min_tokens=4096 claude-fable-5/5.1 keep supports_prompt_caching=false as already set, so no prompt_cache_min_tokens was added there. Entry count is still 70. ci_cd/generate_model_prices_schema.py --check stays green with no regeneration needed: every added key already existed elsewhere in the file. tests/test_litellm/test_utils.py: INTENDED_SCHEMA in test_aaamodel_prices_and_context_window_json_is_valid did not allow input/output_cost_per_token_above_32k_tokens. That threshold is real (kyma/qwen3.7-flash's own 32k tier, the only model in the file that uses it) and the runtime cost calculator already handles arbitrary thresholds generically, so the fix is widening this hand-maintained allowlist to match the data, the same way 128k/200k/256k/272k/512k must each have been added when a model first needed them.
|
a57c09c makes the |
- kyma/qwen-3.6-plus: max_input_tokens 131072 -> 1000000, max_tokens and max_output_tokens 32768 -> 65536. Restores the input_cost_per_token_above_256k_tokens / output_cost_per_token_above_256k_tokens tier removed earlier in review for being unreachable on the old 131k window; it is reachable on the corrected 1M window, so the tier fields come back with the same field names already used by kyma/qwen-3.7-plus. - kyma/gpt-oss-120b: supports_reasoning false -> true - kyma/llama-3.3-70b: supports_reasoning true -> false - kyma/deepseek-v3: unchanged, source registry confirms supports_reasoning stays true Source: upstream registry audit merged 2026-09-04. Schema regenerated via ci_cd/generate_model_prices_schema.py --check (no new keys, above_256k tier fields already present from qwen-3.7-plus); root and backup price files re-verified identical.
|
Pushed f31ee53 to sync three
Live checks against the corrected values, run just now:
Local suite green: 15/15 |
Adds Kyma API (kyma/<model>) as a JSON-configured OpenAI-compatible provider. Spend reads the usage.cost Kyma reports, with 83 catalog rows as the fallback price, and image and audio routes refuse before calling Kyma. Carries over #39799 with its author's commits kept
What
Adds Kyma API (https://kymaapi.com) as a JSON-configured OpenAI-compatible provider, following
the darkbloom/libertai/scx-ai pattern: a
providers.jsonentry, anLlmProvidersenum value,the two
openai_compatible_*lists inconstants.py, and 70kyma/*price entries inmodel_prices_and_context_window.json(root + thelitellm/backup copy). No provider-specificPython — Kyma is a plain OpenAI-compatible
/v1/chat/completionsendpoint.Why
Kyma publishes measured per-model uptime (kymaapi.com/status) and public usage rankings
(kymaapi.com/rankings); its price catalog is machine-generated from the same source that serves
/v1/models, and we keep it current the same way. Six frameworks that read LiteLLM's owncost/capability map for their own model resolution — CrewAI, LlamaIndex, the OpenAI Agents SDK's
Python bindings, DSPy, smolagents, Google ADK — pick this provider up for free once merged.
Notes for reviewers
shared price file, unlike a previous attempt at this PR.
floating-point noise on 27 of the 70 entries' price fields, and added
cache_read_input_token_cost(10% of input price, our documented cache-read discount) toevery entry with
supports_prompt_caching: true— it was missing, which would have pricedcache reads at $0 under this repo's own cost calculator.
provider_endpoints_support.jsononly claimschat_completions: true. Kyma's own API alsoserves
/v1/messages,/v1/embeddingsand/v1/rerank, but the JSON-configured-providerpath only wires chat routing, so those are left
falserather than overclaimed (matches thelibertai/scx-ai precedent).
Test
tests/test_litellm/llms/openai_like/test_kyma_provider.py, 15 cases, mocked only. UsesLiteLLM's own
mock_responsecompletion path for the routing/cost assertions — notunittest.mock.patchon an internal — so there's no risk of a silently-skipped mock: a previoussubmission patched
litellm.main.completion, which is never invoked becauselitellm.completionis bound at import time via
from .main import *.Verified locally against
origin/litellm_internal_staging:pytest tests/test_litellm/llms/openai_like/test_kyma_provider.py(15 passed),ruff check+ruff format --check,scripts/test_quality_gate.py,scripts/type_check_gate.py,scripts/type_discipline_gate.py,check-import-safety,check-circular-imports— all green.Maintenance
We keep this entry current when Kyma's catalog changes. Contact hello@kymaapi.com.
Happy to adjust naming, ordering or fields to match your conventions.