Skip to content

feat(provider): add Kenari as OpenAI-compatible JSON provider - #32095

Open
doedja wants to merge 2 commits into
BerriAI:litellm_internal_stagingfrom
doedja:feat/kenari-provider
Open

feat(provider): add Kenari as OpenAI-compatible JSON provider#32095
doedja wants to merge 2 commits into
BerriAI:litellm_internal_stagingfrom
doedja:feat/kenari-provider

Conversation

@doedja

@doedja doedja commented Jul 4, 2026

Copy link
Copy Markdown

Relevant issues

N/A (new provider addition via the JSON-based provider path)

Type

🆕 New Feature

Changes

Adds Kenari as a JSON-configured OpenAI-compatible provider, following the same pattern as the neosantara addition (#29646).

Kenari is an LLM gateway with IDR (Indonesian Rupiah) billing, serving models from DeepSeek, GLM, Kimi, Qwen, Claude, GPT and others through one OpenAI-compatible endpoint at https://kenari.id/v1.

  • litellm/llms/openai_like/providers.json: kenari entry (KENARI_API_KEY, KENARI_API_BASE override). No param_mappings needed: the API accepts max_completion_tokens natively.
  • litellm/types/utils.py: LlmProviders.KENARI enum value.
  • provider_endpoints_support.json + backup: chat completions entry.
  • tests/test_litellm/llms/kenari/test_kenari.py: registry, env-var config, prefix detection, complete-URL tests (mirrors the neosantara test file).

Testing

$ pytest tests/test_litellm/llms/kenari/test_kenari.py -q
4 passed

Verified live against the production endpoint:

import litellm
r = litellm.completion(
    model="kenari/deepseek-v4-flash",
    messages=[{"role": "user", "content": "Say OK"}],
)
# content: "OK", usage reported; streaming also verified

@doedja

doedja commented Jul 4, 2026

Copy link
Copy Markdown
Author

@greptileai

@CLAassistant

CLAassistant commented Jul 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Kenari as an OpenAI-compatible JSON-configured provider, following the same pattern established by the neosantara addition. All changes are minimal and self-contained.

  • providers.json gains a kenari entry with base_url, api_key_env, api_base_env, and supported_endpoints; param_mappings is intentionally omitted because the Kenari gateway natively accepts max_completion_tokens.
  • LlmProviders.KENARI is added to the enum, and the two endpoint-support JSON files (root + backup) are updated in sync.
  • Four new mock-only tests cover registry lookup, env-var override, prefix detection, and URL construction — no real network calls are made.

Confidence Score: 5/5

Safe to merge — all changes are additive JSON/enum additions with no effect on existing providers or request paths.

The change touches only configuration files and a new test file. No production logic is modified; new providers are loaded lazily from the JSON registry at runtime. All tests are mock-based and pass locally.

No files require special attention.

Important Files Changed

Filename Overview
litellm/llms/openai_like/providers.json Adds kenari entry with all required fields (base_url, api_key_env, api_base_env, supported_endpoints); correctly omits param_mappings because the API accepts max_completion_tokens natively.
litellm/types/utils.py Adds KENARI = "kenari" enum member to LlmProviders in the correct alphabetical neighbourhood; straightforward one-liner addition.
tests/test_litellm/llms/kenari/test_kenari.py Four mock-only tests covering registry lookup, env-var override, prefix detection, and URL construction — no real network calls, follows the neosantara test pattern.
provider_endpoints_support.json Adds the kenari block with all endpoint flags; the url field pointing to a yet-to-be-published docs page was flagged in a prior review thread.
litellm/provider_endpoints_support_backup.json Mirror of the root provider_endpoints_support.json kept in sync; identical kenari block added.

Reviews (4): Last reviewed commit: "feat(provider): add Kenari as OpenAI-com..." | Re-trigger Greptile

},
"kenari": {
"display_name": "Kenari (`kenari`)",
"url": "https://docs.litellm.ai/docs/providers/kenari",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The url field points to https://docs.litellm.ai/docs/providers/kenari, which doesn't exist yet. Per the repo's custom rule, docs must live in the litellm-docs repo rather than here. Until that page is published, this link will 404 for anyone who clicks it from the UI or the JSON. Consider either creating the docs page in the litellm-docs repo before merging or temporarily using the base docs URL.

Rule Used: Prevent documentation from being added - needs to ... (source)

Comment thread litellm/llms/openai_like/providers.json
@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Kenari as a JSON-configured OpenAI-compatible provider, following the same pattern as the neosantara addition. The five Kenari-specific files are minimal and correct; the provider JSON entry, the LlmProviders.KENARI enum value, the endpoint support entries, and the four mock-only unit tests all look good.

  • The kenari entry in providers.json correctly omits param_mappings (the API accepts max_completion_tokens natively) and supported_endpoints (only chat completions is supported, consistent with the provider_endpoints_support.json entry).
  • The PR includes 50+ files unrelated to Kenari (MCP server work, UI components, guardrails, enterprise callbacks, CI config). These appear to be upstream changes merged into the author's branch; they should be rebased out before merging so reviewers can focus on the actual provider change.
  • The docs URL referenced in provider_endpoints_support.json (https://docs.litellm.ai/docs/providers/kenari) points to a page that does not yet exist, and an unexplained CI maxForks reduction (8 → 6) was included.

Confidence Score: 4/5

The Kenari-specific changes are correct and safe; the main risk before merging is the 50+ unrelated upstream files that need to be rebased out and the broken docs URL.

The five files that actually implement the Kenari provider are clean, minimal, and follow the established JSON-provider pattern exactly. The concerns are the missing docs page behind the URL already committed to both endpoint-support JSON files, and an unexplained CI fork-count reduction that belongs in a separate change. The large number of unrelated files swept in from upstream does not introduce bugs in the Kenari path but makes the PR harder to reason about and could mask unreviewed changes.

provider_endpoints_support.json and litellm/provider_endpoints_support_backup.json (broken docs URL); .circleci/config.yml (unrelated fork-count change)

Important Files Changed

Filename Overview
litellm/llms/openai_like/providers.json Adds kenari JSON entry with correct base_url, api_key_env, and api_base_env; no param_mappings needed since the API natively accepts max_completion_tokens; no supported_endpoints key since only chat completions is supported
litellm/types/utils.py Adds LlmProviders.KENARI = "kenari" enum value in the correct alphabetical position relative to NEOSANTARA
provider_endpoints_support.json Adds kenari endpoint support entry with chat_completions: true and all others false; references a docs URL (https://docs.litellm.ai/docs/providers/kenari) that does not yet exist
litellm/provider_endpoints_support_backup.json Same kenari entry as provider_endpoints_support.json; both files updated in sync; same broken docs URL concern
tests/test_litellm/llms/kenari/test_kenari.py Four unit tests (registry lookup, env-var config, provider prefix detection, complete URL construction) using mocks only; correctly mirrors the neosantara pattern without the responses-API and param-mapping tests that neosantara needs but kenari does not
.circleci/config.yml Reduces UI test maxForks from 8 to 6; this change is unrelated to the Kenari provider addition and has no explanation

Reviews (2): Last reviewed commit: "feat(provider): add Kenari as OpenAI-com..." | Re-trigger Greptile

Comment thread .circleci/config.yml

CI=true npm run test -- --run \
--pool forks --poolOptions.forks.maxForks=8
--pool forks --poolOptions.forks.maxForks=6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unrelated CI change with no explanation

Reducing --poolOptions.forks.maxForks from 8 to 6 has nothing to do with adding the Kenari provider. If this was intentional (e.g. to fix flaky CI due to resource contention), it should be in its own PR with a rationale. As-is it will silently slow down the UI test job for every future PR.

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!

"rerank": false
}
},
"kenari": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Docs URL references a page that does not yet exist

The "url" field points to https://docs.litellm.ai/docs/providers/kenari, but no corresponding page has been added to the litellm-docs repo yet (documentation for this repo must live there per the project guidelines). Until that page is published, every UI element or tooling that renders this link will show a 404. Per the same guidelines, docs cannot be added in this repo. Please ensure the docs page is created and live before this PR is merged, or defer the url entry until it is.

Rule Used: Prevent documentation from being added - needs to ... (source)

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

from litellm._uuid import uuid
from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
from litellm.proxy._types import ObjectPermissionDict, SpecialMCPServerNames
from litellm.proxy._types import ObjectPermissionDict, SpecialMCPServerName, SpecialMCPServerNames
from litellm._uuid import uuid
from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
from litellm.proxy._types import ObjectPermissionDict, SpecialMCPServerNames
from litellm.proxy._types import ObjectPermissionDict, SpecialMCPServerName, SpecialMCPServerNames
from litellm._uuid import uuid
from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
from litellm.proxy._types import ObjectPermissionDict, SpecialMCPServerNames
from litellm.proxy._types import ObjectPermissionDict, SpecialMCPServerName, SpecialMCPServerNames
from litellm.proxy.management_helpers.object_permission_utils import (
_set_object_permission,
enforce_all_proxy_mcp_servers_grant_is_admin_only,
handle_update_object_permission_common,

async def invalidate(
self, subject_token: str, server: ServerSpec, config: TokenExchangeConfig, *, tenant_id: str = ""
) -> None: ...

async def exchange(
self, subject_token: str, server: ServerSpec, config: TokenExchangeConfig, *, tenant_id: str = ""
) -> Result[OAuthToken, CredError]: ...
Comment on lines +1888 to +1897
async def _resolve_v2_auth(
self,
*,
server: MCPServer,
spec: ServerSpec,
provider: UpstreamCredentialProvider,
subject_token: Optional[str],
user_api_key_auth: Optional[UserAPIKeyAuth],
extra_headers: Optional[dict[str, str]],
) -> tuple[Optional[httpx.Auth], Optional[dict[str, str]]]:
from litellm.proxy.common_utils.encrypt_decrypt_utils import decrypt_value_helper
from litellm.proxy.common_utils.user_api_key_cache import get_management_object_ttl
from litellm.proxy.utils import ProxyLogging
from litellm.proxy.utils import ProxyLogging, get_server_root_path
@doedja
doedja changed the base branch from main to litellm_internal_staging July 4, 2026 01:25
@doedja
doedja force-pushed the feat/kenari-provider branch from e6333fa to 4365d89 Compare July 4, 2026 01:29
@doedja

doedja commented Jul 4, 2026

Copy link
Copy Markdown
Author

Addressed the review feedback:

  • Rebased the branch onto litellm_internal_staging after retargeting the base, so the unrelated upstream files (MCP server, guardrails, .circleci/config.yml maxForks change, etc.) are gone from the diff. It is now exactly the 5 Kenari files.
  • Made supported_endpoints explicit (["/v1/chat/completions"]) to match the neighbouring providers, with a test assertion.
  • Docs URL: opened the companion docs page in the litellm-docs repo (docs: add Kenari provider page litellm-docs#483) so https://docs.litellm.ai/docs/providers/kenari resolves once that merges.

@greptileai

@doedja

doedja commented Jul 4, 2026

Copy link
Copy Markdown
Author

@greptileai

doedja added 2 commits August 9, 2026 02:26
Kenari (https://kenari.id) is an OpenAI-compatible LLM gateway with
IDR-denominated billing, serving models from DeepSeek, GLM, Kimi,
Qwen, Claude, GPT and others at https://kenari.id/v1.

Follows the JSON-based provider pattern (same shape as neosantara):
- providers.json entry (KENARI_API_KEY / KENARI_API_BASE)
- LlmProviders.KENARI enum value
- provider_endpoints_support entries
- registry/config/prefix-detection/URL tests

Kenari accepts max_completion_tokens natively, so no param mapping
is needed. Verified live: litellm.completion on kenari/deepseek-v4-flash,
streaming and non-streaming.
@doedja
doedja force-pushed the feat/kenari-provider branch from b3d5e2b to 94259f9 Compare August 8, 2026 19:34
@doedja

doedja commented Aug 8, 2026

Copy link
Copy Markdown
Author

Rebased onto current litellm_internal_staging. This had drifted to 2,319 commits behind, which is probably most of why it went quiet, and it is current again now.

Scope is unchanged: the providers.json entry, the LlmProviders enum value, both endpoint-support files, and the test file. Nothing unrelated came along in the rebase.

If the JSON provider shape has moved since this was written, point me at a recent example and I will match it. Also happy to be told if there is a label or a reviewer this should go through, since I am not sure the earlier bot review ever completed.

@codspeed-hq

codspeed-hq Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing doedja:feat/kenari-provider (94259f9) with litellm_internal_staging (b0fd3e1)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (cfd64d4) during the generation of this report, so 4c1fb9b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants