feat(atlascloud): add Atlas Cloud OpenAI-compatible translation provider#68
feat(atlascloud): add Atlas Cloud OpenAI-compatible translation provider#68lucaszhu-hue wants to merge 3 commits into
Conversation
Atlas Cloud (https://www.atlascloud.ai) exposes an OpenAI-compatible /v1/chat/completions endpoint, so it slots into the existing pluggable translation provider system with minimal surface. - Add providers/atlascloud with Atlas defaults (base_url, default model deepseek-ai/DeepSeek-V3-0324, ATLASCLOUD_API_KEY env / atlascloud.env file) and reuse the shared OpenAI-compatible transport/translation handlers from the DeepSeek provider instead of duplicating retry/streaming/diagnostics. - Register ATLASCLOUD_RUNTIME and make resolve_active_provider_runtime() env-selectable via RETAIN_TRANSLATION_PROVIDER. Default stays "deepseek", so runtime behavior is unchanged unless explicitly opted in. - Document the provider switch in doc/core/api/local-dev.md and the translation llm README; document the atlascloud.env credential file and add a placeholder-only atlascloud.env.example. - Add provider runtime contract tests for the new provider. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thank you for submitting the PR. If a third-party API has been added, please complete the following:
|
- Atlas provider default model -> deepseek-ai/deepseek-v4-pro (reasoning), with a max_tokens>=512 note in code and docs. - README: add Atlas Cloud block (logo + copy + UTM link) at the top, an opt-in env snippet, and the full 59-model Atlas LLM list in a collapsed <details>. Default translation provider stays deepseek. - doc/core/api/local-dev.md: default model + reasoning note updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks for the review @wxyhgk! Addressed all three points:
Architecture check ( |
Summary
Adds Atlas Cloud as an optional translation provider. Atlas Cloud exposes an OpenAI-compatible
/v1/chat/completionsendpoint, so it plugs into the existing pluggable provider system (shared/provider_registry.py+providers/<provider>/) with a minimal footprint, exactly as described inbackend/scripts/services/translation/llm/README.md("新增 provider 时,优先在providers/<provider>/下新增实现 … 在shared/provider_registry.py注册 runtime").Changes:
providers/atlascloud/— Atlas defaults only (base_url=https://api.atlascloud.ai/v1, default modeldeepseek-ai/deepseek-v4-pro,ATLASCLOUD_API_KEYenv /atlascloud.envfile) plus a matchingget_api_key. The OpenAI-compatible transport and translation handlers are reused from the DeepSeek provider rather than duplicated, so retry/streaming/DNS/diagnostics logic stays in one place.shared/provider_registry.py— registersATLASCLOUD_RUNTIMEand makesresolve_active_provider_runtime()selectable via theRETAIN_TRANSLATION_PROVIDERenv var. Default remainsdeepseek, so runtime behavior is unchanged unless a user explicitly opts in. Unknown values raise a clear error listing known providers.README.md— adds an Atlas Cloud block at the very top (logo + intro + UTM link), an opt-inRETAIN_TRANSLATION_PROVIDER=atlascloudenv snippet, and the full Atlas Cloud LLM model list (59 models, grouped by vendor) inside a collapsed<details>. The default translation experience is unchanged.doc/core/api/local-dev.mdgains a "翻译 provider" section (DeepSeek default + Atlas Cloud opt-in);services/translation/llm/README.mdlists the new provider dir and the env switch;backend/scripts/.env/README.mddocuments theatlascloud.envcredential file with a placeholder-onlyatlascloud.env.example.devtools/tests/translation/test_atlascloud_provider_runtime.pylocks in the default-stays-deepseek contract, the Atlas defaults, transport reuse, env selection (case-insensitive), and the unknown-provider error.deepseek-ai/deepseek-v4-prois a reasoning model, so the docs and the provider default note that callers should give it enoughmax_tokens(>= 512); otherwise the budget is spent on the reasoning trace andcontentcomes back empty withfinish_reason=length.Why This PR
The translation layer is already provider-agnostic (base_url/model/api_key flow through from the frontend/Rust API, with DeepSeek as the default). This PR gives users a documented, one-env-var way to route translation through Atlas Cloud's unified OpenAI-compatible API — useful for accessing additional models or a different provider — without changing the default experience or touching the working DeepSeek path.
Validation
pytest devtools/tests/translation/test_atlascloud_provider_runtime.py devtools/tests/translation/test_provider_runtime_contract.py→ 8 passed.48 failed, 452 passedvsupstream/mainbaseline48 failed, 446 passed— the failing set is byte-for-byte identical (the pre-existing failures are environment-only, from absolute paths / missingfitz/typstbinaries unrelated to the provider layer); the +6 passes are the new Atlas tests.deepseek-ai/deepseek-v4-prowithmax_tokens=512→ HTTP 200,finish_reason=stop, non-empty content (correct EN→ZH translation).RETAIN_TRANSLATION_PROVIDER=atlascloud:provider_runtimeresolves toatlascloud,get_api_key()readsATLASCLOUD_API_KEY, andrequest_chat_content(...)against the live endpoint (deepseek-ai/deepseek-v4-pro) returned a correct EN→ZH translation.atlascloud.env.examplecontains only a placeholder and real*.envfiles remain git-ignored.🤝 Partnership & contact
This PR comes from the Atlas Cloud team. Beyond the integration above, we'd love to explore a closer collaboration with retain-pdf — for example co-marketing or a featured integration.
If that sounds interesting, reach out anytime:
And of course, happy to revise this PR to match your project's conventions — just leave a comment. 🙌