Plateau Nguyen
0e994f959c
feat(providers): explicit prompt cache for DashScope/Qwen ( #1127 )
...
* feat(providers): explicit prompt cache for DashScope/Qwen
Extend OpenAI-compat path with Anthropic-style cache_control:ephemeral
inline blocks for Alibaba DashScope endpoints (provider_type=bailian or
URL contains "dashscope"). Verified live: qwen3.6-plus / qwen3.5-plus /
qwen3-coder-plus all return 99.7% cache hit rate on 6K-token prefix,
yielding ~89% token cost reduction on cached prefix (90% Alibaba discount).
- isDashScope(): 3-source detection (URL + providerType + name) handles
reverse-proxied endpoints; covers both "dashscope" and "bailian"
- buildRequestBody wraps system content with SplitSystemPromptForCache
(exported from anthropic_request.go) using <!-- GOCLAW_CACHE_BOUNDARY -->
- Tool prefix cache: cache_control on last tool definition, with 4-marker
budget guard
- Parse cache_creation_input_tokens from prompt_tokens_details into
Usage.CacheCreationTokens; propagates via existing span metadata writers
- Runtime escape hatch: GOCLAW_DISABLE_DASHSCOPE_CACHE=true
- Live integration smoke test (build tag integration, env-gated)
* chore(providers): polish per PR #1127 review
- Use strings.Repeat instead of custom repeat() helper in smoke test
- Clarify BuildRequestBodyForTest is test-only, not public API
* feat(providers): enable thinking for Qwen 3.7/3.6, observe cache in smoke test
Qwen3.7-plus and qwen3.6-plus support deep thinking but were missing from
dashscopeThinkingModels, so enable_thinking/thinking_budget was silently
skipped. Add both to the whitelist and test.
Add qwen3.7-plus to the cache smoke test as cache-optional: Alibaba's
context-cache doc does not yet list 3.7/3.6 for explicit cache, and the
cache wrap is a safe no-op when unsupported, so a no-cache result is logged
rather than failed to avoid a flaky live assertion.
Claude-Session: https://claude.ai/code/session_01X3jkrc7N3ar8ZGzUJWyNS5
* fix(providers): preserve DashScope detection for proxy routes
2026-06-19 10:59:02 +07:00
..
2026-05-22 20:59:47 +07:00
2026-05-22 20:59:47 +07:00
2026-03-27 10:19:16 +07:00
2026-03-27 10:19:16 +07:00
2026-04-09 21:15:19 +07:00
2026-04-24 00:16:14 +07:00
2026-04-09 21:15:19 +07:00
2026-05-31 12:44:29 +07:00
2026-05-17 15:51:56 +07:00
2026-03-29 18:01:08 +07:00
2026-04-09 21:15:19 +07:00
2026-06-12 10:40:59 +07:00
2026-06-12 10:40:59 +07:00
2026-05-17 15:51:56 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-10 19:35:02 +07:00
2026-04-10 19:35:02 +07:00
2026-04-09 21:15:19 +07:00
2026-03-14 18:13:52 +07:00
2026-04-10 16:32:54 +07:00
2026-04-17 19:02:53 +07:00
2026-03-29 18:01:08 +07:00
2026-06-12 10:40:59 +07:00
2026-05-22 20:59:47 +07:00
2026-04-12 10:24:07 +07:00
2026-03-23 08:08:23 +07:00
2026-04-12 10:24:07 +07:00
2026-05-20 22:17:13 +07:00
2026-03-23 08:08:23 +07:00
2026-04-11 21:22:23 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-04-13 21:01:21 +07:00
2026-04-13 21:01:21 +07:00
2026-05-24 11:27:02 +07:00
2026-05-24 11:27:02 +07:00
2026-05-24 11:27:02 +07:00
2026-04-11 23:22:17 +07:00
2026-05-21 16:44:43 +07:00
2026-05-21 16:44:43 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-22 20:59:47 +07:00
2026-06-03 11:01:14 +07:00
2026-05-31 14:01:29 +07:00
2026-04-09 21:15:19 +07:00
2026-04-24 00:16:14 +07:00
2026-04-24 00:16:14 +07:00
2026-03-29 23:51:53 +07:00
2026-03-27 09:28:42 +07:00
2026-04-09 21:15:19 +07:00
2026-04-10 10:13:58 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-03-28 13:33:25 +07:00
2026-05-17 15:33:55 +07:00
2026-06-05 00:48:38 +07:00
2026-06-05 00:48:38 +07:00
2026-05-22 21:53:10 +07:00
2026-05-22 21:53:10 +07:00
2026-05-24 11:13:03 +07:00
2026-05-24 11:13:03 +07:00
2026-05-22 20:59:47 +07:00
2026-03-29 18:01:08 +07:00
2026-03-14 18:13:52 +07:00
2026-04-16 17:19:50 +07:00
2026-03-14 18:13:52 +07:00
2026-03-14 18:13:52 +07:00
2026-03-23 22:57:39 +07:00
2026-04-16 17:19:50 +07:00
2026-03-29 12:54:12 +07:00
2026-03-23 22:57:26 +07:00
2026-05-20 22:17:13 +07:00
2026-05-20 22:17:13 +07:00
2026-03-27 09:35:57 +07:00
2026-03-27 10:19:16 +07:00
2026-06-05 00:48:38 +07:00
2026-04-09 21:15:19 +07:00
2026-05-24 11:27:02 +07:00
2026-03-23 22:57:26 +07:00
2026-04-09 21:15:19 +07:00
2026-04-23 19:16:12 +07:00
2026-04-16 15:09:48 +07:00
2026-05-11 14:58:19 +07:00
2026-05-11 15:41:27 +07:00
2026-05-11 15:41:27 +07:00
2026-05-11 14:58:19 +07:00
2026-05-24 11:13:03 +07:00
2026-03-30 21:36:09 +07:00
2026-03-30 21:36:09 +07:00
2026-06-12 17:57:48 +07:00
2026-06-15 10:16:47 +07:00
2026-06-15 14:14:16 +07:00
2026-06-15 10:16:47 +07:00
2026-03-25 14:50:43 +07:00
2026-05-24 11:13:03 +07:00
2026-04-24 00:16:14 +07:00
2026-04-24 00:16:14 +07:00
2026-04-03 15:44:39 +07:00
2026-05-21 16:37:19 +07:00
2026-06-19 10:59:02 +07:00
2026-06-05 00:48:38 +07:00
2026-06-19 10:59:02 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-13 21:01:21 +07:00
2026-05-31 13:22:07 +07:00
2026-05-31 22:05:59 +07:00
2026-06-12 10:40:59 +07:00
2026-05-24 15:14:43 +07:00
2026-05-31 11:05:47 +07:00
2026-05-31 11:05:47 +07:00
2026-05-31 22:05:59 +07:00
2026-05-31 19:42:05 +07:00
2026-05-31 19:42:05 +07:00
2026-05-31 16:49:23 +07:00
2026-05-22 20:59:47 +07:00
2026-05-22 20:59:47 +07:00
2026-06-12 10:38:53 +07:00
2026-06-12 10:38:53 +07:00
2026-04-11 23:22:17 +07:00
2026-06-12 15:38:23 +07:00
2026-06-12 15:38:23 +07:00
2026-05-31 12:44:29 +07:00
2026-05-31 12:44:29 +07:00
2026-06-12 10:38:53 +07:00
2026-04-16 17:07:56 +07:00
2026-06-12 10:38:53 +07:00
2026-06-12 10:38:53 +07:00
2026-06-12 10:38:53 +07:00
2026-05-21 16:37:50 +07:00
2026-05-24 15:57:21 +07:00
2026-06-12 14:57:09 +07:00
2026-05-24 15:57:21 +07:00
2026-05-31 12:24:22 +07:00
2026-05-21 16:37:50 +07:00
2026-05-24 15:57:21 +07:00
2026-06-12 15:38:23 +07:00
2026-03-29 22:33:17 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-05-24 11:13:03 +07:00
2026-03-23 10:17:47 +07:00
2026-03-27 09:35:57 +07:00
2026-05-24 11:13:03 +07:00
2026-04-13 19:19:51 +07:00
2026-03-23 22:57:26 +07:00
2026-03-23 22:57:26 +07:00
2026-03-29 22:33:17 +07:00
2026-03-29 22:33:17 +07:00
2026-04-12 10:24:07 +07:00
2026-04-16 15:49:50 +07:00
2026-04-16 15:49:50 +07:00
2026-04-13 21:01:21 +07:00
2026-04-09 21:15:19 +07:00
2026-04-16 15:49:50 +07:00
2026-05-11 14:58:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-06-12 00:14:40 +07:00
2026-06-12 00:14:40 +07:00
2026-04-20 00:05:19 +07:00
2026-04-20 00:05:19 +07:00
2026-04-20 00:05:19 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-04-20 00:05:19 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 19:16:12 +07:00
2026-04-23 08:31:53 +07:00
2026-05-23 09:34:29 +07:00
2026-05-23 00:16:03 +07:00
2026-05-24 11:13:03 +07:00
2026-06-12 17:51:12 +07:00
2026-04-17 19:07:01 +07:00
2026-04-09 21:15:19 +07:00
2026-04-11 21:22:23 +07:00
2026-03-30 14:12:18 +07:00
2026-05-17 15:51:56 +07:00
2026-04-13 10:59:27 +07:00
2026-05-28 20:55:23 +07:00
2026-05-28 20:55:23 +07:00
2026-06-09 23:04:59 +07:00
2026-06-09 23:04:59 +07:00
2026-04-23 18:56:57 +07:00
2026-04-12 13:25:15 +07:00
2026-04-11 21:22:23 +07:00
2026-04-12 14:31:36 +07:00
2026-04-13 21:42:17 +07:00
2026-04-20 00:05:19 +07:00
2026-04-20 00:05:19 +07:00
2026-04-09 21:15:19 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-11 13:29:24 +07:00
2026-05-20 16:33:49 +07:00
2026-05-11 13:29:24 +07:00
2026-05-11 13:29:24 +07:00
2026-05-20 16:33:49 +07:00
2026-05-11 13:29:24 +07:00
2026-05-11 13:29:24 +07:00
2026-05-11 13:29:24 +07:00
2026-03-25 22:17:33 +07:00
2026-05-11 14:58:19 +07:00