Skip to content

Add first-class Qwen/DashScope OpenAI-compatible preset #38

Description

@yuanhao

Context

Qwen/DashScope is currently usable through a custom OpenAI-compatible ModelConfig, but it is not first-class in yoagent:

  • No ModelConfig::qwen(...) / ModelConfig::dashscope(...)
  • No OpenAiCompat::qwen()
  • ThinkingFormat::Qwen already exists, but no preset uses it
  • The provider is absent from the Model Presets docs

This should be added as a first-class OpenAI-compatible preset, similar to DeepSeek, MiniMax, and Z.ai.

Current official API references

Primary OpenAI-compatible docs:

Feature-specific docs:

Relevant API details from docs

OpenAI-compatible Chat Completions base URLs are region-specific:

  • International/Singapore: https://dashscope-intl.aliyuncs.com/compatible-mode/v1
  • China/Beijing: https://dashscope.aliyuncs.com/compatible-mode/v1
  • US/Virginia: https://dashscope-us.aliyuncs.com/compatible-mode/v1

Auth:

  • Authorization: Bearer $DASHSCOPE_API_KEY

Endpoint:

  • POST /chat/completions

Examples in current docs use model IDs such as:

  • qwen3.6-plus
  • qwen3.5-plus
  • qwen-plus
  • qwen-flash
  • qwen3-coder-plus
  • qwen3-coder-flash

Qwen-specific Chat Completions parameters include:

  • enable_thinking
  • thinking_budget
  • enable_search
  • search_options
  • top_k

Streaming is documented with:

"stream": true,
"stream_options": { "include_usage": true }

Tool calling is supported through OpenAI-compatible tools / tool_calls for supported Qwen text and selected multimodal models.

Proposed yoagent changes

Add an OpenAI-compatible Qwen/DashScope preset:

  • Add OpenAiCompat::qwen().
  • Add ModelConfig::qwen(id, name) using the international base URL by default:
    https://dashscope-intl.aliyuncs.com/compatible-mode/v1
  • Optionally add region-specific helpers, or document how callers can override base_url for China/US regions.
  • Set:
    • provider = "qwen" or "dashscope"; choose one and document it
    • api = ApiProtocol::OpenAiCompletions
    • compat = Some(OpenAiCompat::qwen())
    • thinking_format = ThinkingFormat::Qwen
    • supports_usage_in_streaming = true
    • max_tokens_field = MaxTokensField::MaxTokens
  • Decide whether supports_reasoning_effort should remain false; current Qwen docs use Qwen-specific enable_thinking / thinking_budget, not OpenAI reasoning_effort.

Optional follow-up:

  • Extend OpenAiCompat with Qwen-specific thinking controls if yoagent wants ThinkingLevel to map to enable_thinking / thinking_budget.
  • Consider OpenAI Responses API support for Qwen separately. Qwen Responses uses a different base URL:
    https://dashscope-intl.aliyuncs.com/api/v2/apps/protocols/compatible-mode/v1

Docs/tests

Add tests for:

  • OpenAiCompat::qwen() flags.
  • ModelConfig::qwen(...) provider, base URL, protocol, and compat.
  • Request body uses max_tokens, not max_completion_tokens.
  • Existing reasoning_content parsing still works for Qwen streams.

Update docs:

  • docs/providers/model-presets.md
  • docs/providers/openai-compat.md
  • docs/providers/overview.md
  • README provider table if needed

Why this matters

Qwen/DashScope is a common hosted path for Qwen models and exposes an OpenAI-compatible API with tool calling and streaming. Since yoagent already supports adjacent first-class OpenAI-compatible providers, adding Qwen would reduce custom config boilerplate and make provider behavior explicit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions