Merge pull request 'feat(qwen): Alibaba Qwen built-in over Model Studio's OpenAI-compatible mode' (#27)
This commit was merged in pull request #27.
This commit is contained in:
@@ -122,6 +122,7 @@ Chains are health-tracked per target:
|
||||
|----------|-----------|-------------|------------------|
|
||||
| OpenAI (+compatible) | `openai` | `OPENAI_API_KEY` | https://api.openai.com/v1 |
|
||||
| Kimi (Moonshot AI) | `kimi` | `KIMI_API_KEY` | https://api.moonshot.ai/v1 |
|
||||
| Qwen (Alibaba) | `qwen` | `QWEN_API_KEY` | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 |
|
||||
| Anthropic (+compatible) | `anthropic` | `ANTHROPIC_API_KEY` | https://api.anthropic.com |
|
||||
| Google (Gemini) | `google` | `GOOGLE_API_KEY` / `GEMINI_API_KEY` | Gemini API (official SDK) |
|
||||
| Ollama Cloud | `ollama-cloud` | `OLLAMA_API_KEY` | https://ollama.com |
|
||||
@@ -134,6 +135,19 @@ the openai client (like llama-swap). The `kimi` built-in defaults to the
|
||||
international endpoint; reach the China endpoint (or any other host) with a
|
||||
`kimi://` DSN, e.g. `LLM_KCN=kimi://[email protected]/v1`.
|
||||
|
||||
Qwen is the same shape: Alibaba Model Studio's OpenAI-compatible mode, reusing
|
||||
the openai client. The `qwen` built-in defaults to the international
|
||||
(Singapore) host; reach the China host or a workspace-scoped regional one with
|
||||
a `qwen://` DSN, e.g.
|
||||
`LLM_QCN=qwen://[email protected]/compatible-mode/v1`. Model Studio
|
||||
also fronts the same models with an Anthropic-compatible `/v1/messages` shim —
|
||||
majordomo does **not** use it, because on that surface `reasoning_effort` is
|
||||
dropped, `Request.Schema` stops being enforced, and cached-token accounting
|
||||
disappears; see [ADR-0027](docs/adr/0027-qwen-builtin.md). Two Alibaba-side
|
||||
quirks are worth knowing: thinking is on by default for some models (e.g.
|
||||
`qwen3.7-plus`), and the Qwen3 open-source models require streaming while
|
||||
thinking, so buffered `Generate` calls want a Max/Plus model.
|
||||
|
||||
OpenAI-compatible / Anthropic-compatible endpoints: construct the provider
|
||||
with a name and base URL and register it —
|
||||
|
||||
@@ -165,7 +179,7 @@ m, _ := reg.Parse("m5/qwen3:30b,m1/qwen3:30b,thinking")
|
||||
```
|
||||
|
||||
DSN format: `scheme://[token@]host[/path]`, scheme ∈ `foreman`, `ollama`,
|
||||
`ollama-cloud`, `openai`, `kimi`, `anthropic`, `google`/`gemini`, `llama-swap`,
|
||||
`ollama-cloud`, `openai`, `kimi`, `qwen`, `anthropic`, `google`/`gemini`, `llama-swap`,
|
||||
`llama-swaps`, or any scheme you add with `RegisterScheme`. The token is the
|
||||
credential (bearer token / API key); the base URL is always `https://host[/path]`
|
||||
— except `llama-swap`, which builds `http://host[:port]` since it's local-first
|
||||
@@ -420,6 +434,7 @@ to build one.
|
||||
|----------------------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
| OpenAI (+compatible) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Kimi (Moonshot AI) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅³ | ✅ |
|
||||
| Qwen (Alibaba) | ✅ | ✅ | ✅ | ✅ | ✅⁴ | ✅⁴ | ✅ |
|
||||
| Anthropic (+compat) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Google (Gemini) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Ollama Cloud | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
@@ -444,6 +459,13 @@ probe and management methods on `*llamaswap.Provider`.
|
||||
level; whether a call succeeds depends on the Moonshot model — only the vision
|
||||
variants (e.g. `moonshot-v1-8k-vision-preview`) accept images.
|
||||
|
||||
⁴ Qwen also reuses the openai client (ADR-0027), so both columns are present at
|
||||
the client level and gated by the Model Studio model you name: `json_schema`
|
||||
structured output is on the Max/Plus families, image inputs on the `qwen-vl-*`
|
||||
/ `qwen3-vl-*` models. `reasoning_effort` rides through as a top-level field —
|
||||
one reason the built-in speaks OpenAI-compat rather than Model Studio's
|
||||
Anthropic-compat shim.
|
||||
|
||||
Notes: Ollama has no native tool_choice — `"none"` drops the tools;
|
||||
`"required"`/named choices are best-effort ignored there. Ollama Cloud
|
||||
ignores the `format` field (verified live), so the provider also states
|
||||
|
||||
Reference in New Issue
Block a user