From 02df20cd552318fdc56d2cea5eb9b32387b521b0 Mon Sep 17 00:00:00 2001 From: Krislu1221 <258380416+Krislu1221@users.noreply.github.com> Date: Wed, 22 Jul 2026 21:40:20 +0800 Subject: [PATCH] =?UTF-8?q?docs(providers):=20add=20ModelScope=20(?= =?UTF-8?q?=E9=AD=94=E6=90=AD)=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ModelScope is a fully implemented provider (nanobot/providers/registry.py, image_generation.py, schema.py) with async image-generation task submission and polling, but was previously undocumented in docs/providers.md. This patch adds a ModelScope entry under 'Common Provider Patterns', covering: - Default base URL: https://api-inference.modelscope.cn/v1 - OpenAI-compatible chat/completions endpoint - Async image-generation flow (task submit + status poll) - Automatic 'modelscope/' prefix stripping when calling the API - A minimal nanobot.yaml example No code changes; docs-only. --- docs/providers.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/providers.md b/docs/providers.md index f5b8657b6..d78deba4b 100644 --- a/docs/providers.md +++ b/docs/providers.md @@ -337,6 +337,37 @@ If your custom endpoint documents a nonstandard thinking toggle, set `providers. This named custom provider path is not for Anthropic-compatible endpoints. For Anthropic-compatible proxies, use `providers.anthropic.apiBase` and set the preset provider to `anthropic`. +### ModelScope + +ModelScope (魔搭社区) exposes an OpenAI-compatible LLM endpoint plus a separate async image generation API. Both are covered by the built-in `modelscope` provider. + +```json +{ + "providers": { + "modelscope": { + "apiKey": "${MODELSCOPE_API_KEY}" + } + }, + "modelPresets": { + "primary": { + "provider": "modelscope", + "model": "Qwen/Qwen3-235B-A22B-Instruct-2507", + "maxTokens": 8192, + "contextWindowTokens": 65536 + } + }, + "agents": { + "defaults": { + "modelPreset": "primary" + } + } +} +``` + +Use the model ID exactly as ModelScope publishes it (usually `Namespace/model-name`). The default base URL is `https://api-inference.modelscope.cn/v1`; override with `providers.modelscope.apiBase` only if your account routes through a different host. Model IDs may optionally be prefixed with `modelscope/`; the prefix is stripped before the request is sent. + +ModelScope also provides image generation through the same provider key. Reference it as the image model in your agent config, for example `imageModel: "modelscope/MusePublic/489_ckpt_FLUX_1"`; nanobot handles the async submit/poll pattern automatically. + ### Ollama Start Ollama separately, then point nanobot at the OpenAI-compatible endpoint.