feat(providers): add Bitdeer AI as a JSON-configured provider - #36734
feat(providers): add Bitdeer AI as a JSON-configured provider#36734ruijietey wants to merge 2 commits into
Conversation
Registers Bitdeer's OpenAI-compatible inference API (api-inference.bitdeer.ai) following the existing JSON-configured provider pattern: providers.json entry, LlmProviders enum member, openai_compatible_providers list entry, and the api_base auto-detection branch in get_llm_provider_logic.py. Adds pricing for 6 models to model_prices_and_context_window.json (Kimi-K3, Kimi-K2.6, GLM-5.2, Qwen3.5-397B-A17B, DeepSeek-V4-Pro, DeepSeek-V4-Flash), sourced from bitdeer.ai's published pricing page.
Keeps moonshotai/Kimi-K3, zai-org/GLM-5.2, and deepseek-ai/DeepSeek-V4-Flash; drops Kimi-K2.6, Qwen3.5-397B-A17B, and DeepSeek-V4-Pro. Renames the provider slug from bitdeer to bitdeer-ai to match Bitdeer's preferred identifier.
|
|
Greptile SummaryThis PR registers Bitdeer AI as a JSON-configured OpenAI-compatible provider and adds pricing and capability metadata for three models.
Confidence Score: 4/5The provider wiring is mostly complete, but the explicit credential precedence defect should be fixed before merging. Bitdeer requests using api_base autodetection can authenticate with BITDEER_API_KEY instead of the caller’s explicit key when both are present; the pricing registry also contains a non-blocking duplicate key. Files Needing Attention: litellm/litellm_core_utils/get_llm_provider_logic.py; model_prices_and_context_window.json
|
| Filename | Overview |
|---|---|
| litellm/litellm_core_utils/get_llm_provider_logic.py | Adds Bitdeer endpoint autodetection, but the branch can replace an explicit API key with BITDEER_API_KEY. |
| litellm/llms/openai_like/providers.json | Correctly registers Bitdeer's base URL, credential environment variable, and token-parameter mapping. |
| model_prices_and_context_window.json | Adds three Bitdeer pricing records, but DeepSeek-V4-Flash is declared twice under the same key. |
| litellm/types/utils.py | Consistently adds bitdeer-ai to the provider enum. |
| litellm/constants.py | Consistently adds Bitdeer to endpoint and OpenAI-compatible provider registries. |
| tests/test_litellm/llms/openai_like/test_bitdeer_provider.py | Covers registration, routing, URL detection, and pricing, but does not exercise URL autodetection with competing explicit and environment keys. |
Reviews (1): Last reviewed commit: "Trim Bitdeer models to 3 and rename slug..." | Re-trigger Greptile
| elif endpoint == "https://api-inference.bitdeer.ai/v1": | ||
| custom_llm_provider = "bitdeer-ai" | ||
| dynamic_api_key = get_secret_str("BITDEER_API_KEY") |
There was a problem hiding this comment.
Explicit API key gets overwritten
If BITDEER_API_KEY is set, URL autodetection replaces the caller's explicit api_key with that environment value, causing authentication to use the wrong Bitdeer account or fail despite a valid explicit credential.
| elif endpoint == "https://api-inference.bitdeer.ai/v1": | |
| custom_llm_provider = "bitdeer-ai" | |
| dynamic_api_key = get_secret_str("BITDEER_API_KEY") | |
| elif endpoint == "https://api-inference.bitdeer.ai/v1": | |
| custom_llm_provider = "bitdeer-ai" | |
| dynamic_api_key = api_key or get_secret_str("BITDEER_API_KEY") |
Knowledge Base Used: LLM Provider Adapters
| "bitdeer-ai/deepseek-ai/DeepSeek-V4-Flash": { | ||
| "supports_prompt_caching": true, | ||
| "source": "https://www.bitdeer.ai/en/pricing/ai-models" | ||
| }, |
There was a problem hiding this comment.
bitdeer-ai/deepseek-ai/DeepSeek-V4-Flash is declared twice, so standard JSON loading silently discards the first capability record and existing schema and pricing tests cannot detect edits made to it.
| "bitdeer-ai/deepseek-ai/DeepSeek-V4-Flash": { | |
| "supports_prompt_caching": true, | |
| "source": "https://www.bitdeer.ai/en/pricing/ai-models" | |
| }, |
Knowledge Base Used: Cost Tracking and Budget Enforcement
| }, | ||
| "bitdeer-ai": { | ||
| "base_url": "https://api-inference.bitdeer.ai/v1", | ||
| "api_key_env": "BITDEER_API_KEY", |
There was a problem hiding this comment.
Medium: API key exfiltration through an overridden base URL
A caller can submit model: "bitdeer-ai/..." with api_base pointing to a server they control and omit api_key. The JSON-provider resolver preserves that api_base but falls back to BITDEER_API_KEY, so the outbound request exposes the server's credential in its Authorization header. Reject untrusted base-URL overrides for this provider, or require an explicit request API key whenever the selected base URL differs from the configured Bitdeer URL.
PR overviewThis pull request adds Bitdeer AI as an OpenAI-compatible provider configured through the JSON provider registry. One security issue remains open: callers can override the Bitdeer API base URL while the provider still falls back to the server’s configured Bitdeer API key. This can expose that credential to an attacker-controlled endpoint, so the provider should restrict base-URL overrides or require an explicit key for nonstandard URLs. Open issues (1)
Fixed/addressed: 0 · PR risk: 6/10 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a developer wants to call a Bitdeer-hosted model through LiteLLM
After: the same developer gets a named provider with cost tracking
Relevant issues
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
No live Bitdeer API key was available while preparing this PR, so there is no real end-to-end curl proof against the live endpoint. What is verified locally:
Happy to run a real curl against a live Bitdeer key if a maintainer or the Bitdeer team can supply one for verification before merge.
Type
🆕 New Feature
Caveats (if any)
Final Attestation