Skip to content

feat(cli): add ModelScope as a built-in third-party API provider#4150

Merged
pomelo-nwu merged 1 commit into
QwenLM:mainfrom
Col0ring:feat/modelscope-provider
May 14, 2026
Merged

feat(cli): add ModelScope as a built-in third-party API provider#4150
pomelo-nwu merged 1 commit into
QwenLM:mainfrom
Col0ring:feat/modelscope-provider

Conversation

@Col0ring

Copy link
Copy Markdown
Contributor

Summary

  • What changed: Add ModelScope as a built-in third-party API provider in the auth setup flow. Users can now pick "ModelScope API Key" during the auth wizard and get a pre-configured baseUrl (https://api-inference.modelscope.cn/v1), env key (MODELSCOPE_API_KEY), and a curated list of preset models with sane defaults (1M context window, thinking enabled).
  • Why it changed: ModelScope's OpenAI-compatible Inference API is widely used in the Chinese developer community, but currently users have to fall back to the generic "Custom" provider and manually configure baseUrl, env key, model list, and context window. Adding it as a first-class provider matches the existing pattern used for DeepSeek, Minimax, ZAI, IdeaLab, etc.
  • Reviewer focus:
    • packages/cli/src/auth/providers/thirdParty/modelscope.ts — provider config (id, baseUrl, envKey, preset models, UI metadata).
    • packages/cli/src/auth/allProviders.ts — registration in the provider registry and ALL_PROVIDERS array (insertion order matches the existing third-party group).
    • packages/cli/src/auth/providers/thirdParty/modelscope.test.ts — unit tests covering provider config and buildInstallPlan behavior for known and unknown model IDs.

Validation

  • Commands run:
    # Unit test for the new provider
    cd packages/cli && npx vitest run src/auth/providers/thirdParty/modelscope.test.ts
    
    # Repo-wide typecheck
    npm run typecheck
  • Prompts / inputs used: N/A (auth provider config + unit tests, no interactive prompt).
  • Expected result:
    • All 3 unit tests pass (provider config shape, install plan with known model IDs, fallback for unknown model IDs).
    • npm run typecheck passes across all workspaces.
  • Observed result:
    • modelscope.test.ts3 passed (3), duration ~4.4s.
    • npm run typecheck — clean across @qwen-code/qwen-code, @qwen-code/qwen-code-core, @qwen-code/sdk, @qwen-code/webui.
  • Quickest reviewer verification path:
    1. cd packages/cli && npx vitest run src/auth/providers/thirdParty/modelscope.test.ts
    2. Run npm run dev and open the auth wizard (/auth); confirm "ModelScope API Key" appears in the third-party group and that the preset baseUrl/env key/models are populated.
  • Evidence (output, logs, screenshots, video, JSON, before/after, etc.):
     ✓ src/auth/providers/thirdParty/modelscope.test.ts (3 tests) 3ms
     Test Files  1 passed (1)
          Tests  3 passed (3)
    

Scope / Risk

  • Main risk or tradeoff: Hard-coded preset model IDs may go stale as ModelScope publishes new models. Mitigated by modelsEditable: true, so users can add/edit their own model list at install time.
  • Not covered / not validated: No live end-to-end call against the real ModelScope endpoint in CI (would require an API key). Manual smoke test recommended before merge.
  • Breaking changes / migration notes: None. Pure additive change — no existing provider, type, or public API is modified.

Testing Matrix

🍏 🪟 🐧
npm run ⚠️ ⚠️
npx ⚠️ ⚠️
Docker ⚠️ ⚠️ ⚠️
Podman ⚠️ N/A N/A
Seatbelt ⚠️ N/A N/A

Testing matrix notes:

  • Validated locally on macOS via npx vitest and npm run typecheck. The change is a static config plus unit tests, so platform-specific risk is minimal — Windows / Linux / sandbox runners should behave identically.

Linked Issues / Bugs

@pomelo-nwu pomelo-nwu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM — clean additive change, follows existing provider patterns exactly. CI green, tests solid.

— qwen code / claude-opus-4-6

@pomelo-nwu pomelo-nwu merged commit dd1d686 into QwenLM:main May 14, 2026
8 checks passed
TaimoorSiddiquiOfficial pushed a commit to TaimoorSiddiquiOfficial/HopCode that referenced this pull request May 15, 2026
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
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