chore(provider): 添加 Requesty 提供商 - #420
Open
Thibaultjaigu wants to merge 1 commit into
Open
Thibaultjaigu wants to merge 1 commit into
Thibaultjaigu wants to merge 1 commit into
Conversation
Register Requesty as a first class provider next to OpenRouter: adapter with model discovery from /v1/models/managed merged with /v1/models, registry and catalog entries, app attribution headers for chat and embedding requests, and the frontend display name and embedding dimensions support.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
RequestyAdapter(backend/app/models/adapters/requesty.py),并在registry.py、adapters/__init__.py、catalog/service.py的_PROVIDER_DEFINITIONS、ModelProvider.provider_type描述中注册requesty。/v1/models/managed(Requesty 维护的托管模型,如gpt-5.4-mini),再合并/v1/models完整目录(vendor/model格式,如openai/gpt-4o-mini)。managed 失败时回退到完整目录;/v1/models返回 403 时直接抛出,方便连接校验发现无效 Key。model_provider_service.py中的_get_model_discovery_provider_type将requesty路由到该适配器。helpers/requesty_attribution.py,在对话(_model_request_headers)、Embedding 和模型发现请求中附带HTTP-Referer与X-Title,自定义请求头仍然优先。前端provider-utils.ts增加显示名称,并把requesty加入支持 Embedding 维度的列表。不支持 Rerank(Requesty 没有 rerank 接口),也没有加入任何默认或自动选择逻辑。关联 Issue / PR
无
变更类型
问题原因
无
自查清单
补充信息
测试方式: 在设置中选择 Requesty,填入 Key(https://app.requesty.ai/api-keys),拉取模型后选择
openai/gpt-4o-mini或托管模型gpt-5.4-mini。EU 用户可以把地址改为https://router.eu.requesty.ai/v1。本地验证: 新增
tests/models/test_requesty_adapter.py(managed 优先与去重、managed 失败回退、403 抛出、Embedding 过滤、对话与 Embedding 归因头),后端完整 pytest 通过 1823 个;test_create_chat_model_adds_opencode_headers_for_openai_compatible_endpoint在未安装项目包时因版本号为 0.0.0 失败,upstream/main 上同样失败,与本次改动无关。新文件 ruff 与 ty 无报错。另外用真实 Key 通过仓库代码走了一遍:模型发现返回 921 个模型,openai/gpt-4o-mini普通与流式对话正常,openai/text-embedding-3-small在dimensions=256下返回 256 维。前端只改了两行字符串,未在本地跑完整的 oxlint 类型检查。目前 Requesty 的公开
/v1/models不列出 Embedding 模型,所以 Embedding 列表可能为空,需要手动填写模型 ID(例如openai/text-embedding-3-small)。Disclosure: I work at Requesty. Happy to adjust anything to match project conventions.