Skip to content

feat: add byesu as a JSON-configured OpenAI-compatible provider#32999

Open
amdmsz wants to merge 5 commits into
BerriAI:litellm_internal_stagingfrom
amdmsz:register-byesu-provider
Open

feat: add byesu as a JSON-configured OpenAI-compatible provider#32999
amdmsz wants to merge 5 commits into
BerriAI:litellm_internal_stagingfrom
amdmsz:register-byesu-provider

Conversation

@amdmsz

@amdmsz amdmsz commented Jul 12, 2026

Copy link
Copy Markdown

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 setting api_base each 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 existing openai_like JSON mechanism, same as publicai / tensormesh / cometapi.

Changes

  • litellm/llms/openai_like/providers.json — add the byesu block (base_class: openai_gpt, max_completion_tokens → max_tokens mapping, /v1/chat/completions + /v1/responses).
  • litellm/constants.py — add "byesu" to openai_compatible_providers.
  • litellm/types/utils.py — add BYESU = "byesu" to LlmProviders.
  • 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, /responses support). No network calls.

Endpoint verification

/v1/chat/completions and /v1/responses return 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 real json_loader.py / dynamic_config.py internals the test relies on. Please point out anything CI flags and I'll fix it right away.

Companion docs PR: BerriAI/litellm-docs#549

@CLAassistant

CLAassistant commented Jul 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@amdmsz amdmsz changed the title Add byesu as a JSON-configured OpenAI-compatible provider feat: add byesu as a JSON-configured OpenAI-compatible provider Jul 12, 2026
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR registers byesu as a JSON-configured OpenAI-compatible provider by following the same three-file pattern used by publicai, tensormesh, and others: an entry in providers.json, a string in openai_compatible_providers, and an LlmProviders enum member. No custom Python handler is introduced.

  • providers.json — adds the byesu block with base_url, api_key_env, api_base_env, param_mappings, and supported_endpoints for /v1/responses.
  • constants.py / types/utils.py — register the provider slug in the two standard locations.
  • New test file exercises JSON registry discovery, provider routing, dynamic-config resolution, param mapping, and Responses API support entirely with mocks.

Confidence Score: 4/5

The 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.

Important Files Changed

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

Comment on lines +61 to +70
"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"]
},

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 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.

Suggested change
"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!

Comment on lines +55 to +57

# Defaults to the byesu base URL
api_base, _ = config._get_openai_compatible_provider_info(None, "test-key")

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.

P1 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

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +1 to +2
"""
Tests for the `byesu` JSON-configured OpenAI-compatible provider.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@codspeed-hq

codspeed-hq Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing amdmsz:register-byesu-provider (6facd4e) with litellm_internal_staging (b200d66)

Open in CodSpeed

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.
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.

2 participants