feat: add byesu as a JSON-configured OpenAI-compatible provider#32999
feat: add byesu as a JSON-configured OpenAI-compatible provider#32999amdmsz wants to merge 5 commits into
Conversation
Greptile SummaryThis PR registers
Confidence Score: 4/5The production changes are small and low-risk; the test suite has one assertion that can break in any environment where BYESU_API_BASE is set. The three production-file edits are straightforward additions that follow the existing JSON-provider pattern exactly. The only real concern is in the new test: test_byesu_api_base_and_key_resolution does not isolate itself from the BYESU_API_BASE environment variable, so the assertion api_base == 'https://byesu.com/v1' will silently fail if that variable is present in a CI runner or developer environment. The production code itself is correct and the provider will work as intended at runtime. tests/test_litellm/llms/openai_like/test_byesu_provider.py — the API-base resolution test needs the environment variable mocked out to be hermetic.
|
| Filename | Overview |
|---|---|
| litellm/llms/openai_like/providers.json | Adds the byesu block following the existing JSON provider pattern; base_class: "openai_gpt" is redundant since that is the default value in json_loader.py. |
| litellm/constants.py | Adds "byesu" to openai_compatible_providers; insertion point is out of JSON-file order but has no functional impact. |
| litellm/types/utils.py | Adds BYESU = "byesu" enum member to LlmProviders; straightforward and correct. |
| tests/test_litellm/llms/openai_like/test_byesu_provider.py | New mock-only test suite; the test_byesu_api_base_and_key_resolution test is environment-sensitive and will fail if BYESU_API_BASE is set in the CI environment. |
Reviews (1): Last reviewed commit: "Add byesu provider tests" | Re-trigger Greptile
| "byesu": { | ||
| "base_url": "https://byesu.com/v1", | ||
| "api_key_env": "BYESU_API_KEY", | ||
| "api_base_env": "BYESU_API_BASE", | ||
| "base_class": "openai_gpt", | ||
| "param_mappings": { | ||
| "max_completion_tokens": "max_tokens" | ||
| }, | ||
| "supported_endpoints": ["/v1/chat/completions", "/v1/responses"] | ||
| }, |
There was a problem hiding this comment.
base_class: "openai_gpt" is the default value already applied by json_loader.py (data.get("base_class", "openai_gpt")), so explicitly setting it here is redundant. Every other entry in this file omits it. Removing it keeps the block consistent with its neighbors.
| "byesu": { | |
| "base_url": "https://byesu.com/v1", | |
| "api_key_env": "BYESU_API_KEY", | |
| "api_base_env": "BYESU_API_BASE", | |
| "base_class": "openai_gpt", | |
| "param_mappings": { | |
| "max_completion_tokens": "max_tokens" | |
| }, | |
| "supported_endpoints": ["/v1/chat/completions", "/v1/responses"] | |
| }, | |
| "byesu": { | |
| "base_url": "https://byesu.com/v1", | |
| "api_key_env": "BYESU_API_KEY", | |
| "api_base_env": "BYESU_API_BASE", | |
| "param_mappings": { | |
| "max_completion_tokens": "max_tokens" | |
| }, | |
| "supported_endpoints": ["/v1/chat/completions", "/v1/responses"] | |
| }, |
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!
|
|
||
| # Defaults to the byesu base URL | ||
| api_base, _ = config._get_openai_compatible_provider_info(None, "test-key") |
There was a problem hiding this comment.
Environment-sensitive assertion may fail in CI
_get_openai_compatible_provider_info checks BYESU_API_BASE via get_secret_str(provider.api_base_env) before falling back to the hardcoded base_url. If that environment variable is set anywhere in the CI runner the assertion api_base == "https://byesu.com/v1" will fail. Patch or monkeypatch the env var to ensure the test is hermetic, similar to how test_tensormesh_provider.py uses monkeypatch.setenv in its fixtures.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9518ccbc78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """ | ||
| Tests for the `byesu` JSON-configured OpenAI-compatible provider. |
There was a problem hiding this comment.
Remove new comments prohibited by CLAUDE.md
This new file adds docstrings/comments starting with this module docstring, but /workspace/litellm/AGENTS.md points to /workspace/litellm/CLAUDE.md, which says "Do not write any comments" unless a user explicitly asks for them. Since this change was not requested as documentation, please remove the explanatory docstrings/comments from the new test code.
Useful? React with 👍 / 👎.
Fixes the check_provider_folders_documented code-quality check which requires every provider in openai_like/providers.json to be documented here. Byesu supports /chat/completions and /responses.
Register byesu as a JSON-configured OpenAI-compatible provider
Adds byesu (byesu.com) as a first-class provider prefix (
byesu/) via the JSON provider registry, so users can call it without manually settingapi_baseeach time.byesu is an AI API gateway exposing a standard OpenAI-compatible endpoint (
https://byesu.com/v1, Chat Completions + Responses). No custom Python handler is needed — it plugs into the existingopenai_likeJSON mechanism, same as publicai / tensormesh / cometapi.Changes
litellm/llms/openai_like/providers.json— add thebyesublock (base_class: openai_gpt,max_completion_tokens → max_tokensmapping,/v1/chat/completions+/v1/responses).litellm/constants.py— add"byesu"toopenai_compatible_providers.litellm/types/utils.py— addBYESU = "byesu"toLlmProviders.tests/test_litellm/llms/openai_like/test_byesu_provider.py— new tests (JSON registry discovery, provider routing, dynamic-config base URL / key resolution, param mapping,/responsessupport). No network calls.Endpoint verification
/v1/chat/completionsand/v1/responsesreturn auth errors (not 404) on byesu, confirming the routes exist; a bogus path returns 404 for contrast.Honest note
I don't have a local Python/Poetry env set up for litellm on this machine, so I could not run
make format/make lint/ the unit test locally — the edits were made against the current source and validated for JSON/Python syntax + against the realjson_loader.py/dynamic_config.pyinternals the test relies on. Please point out anything CI flags and I'll fix it right away.Companion docs PR: BerriAI/litellm-docs#549