Files
Calcium-Ion 6cf0d90b5f feat(deepseek): support V4.1 Flash, the Search and Fetch APIs, and @ reasoning modifiers (#7867)
* fix(model): find channels for @-modified model names without the memory cache

With the channel memory cache off (no Redis and MEMORY_CACHE_ENABLED
unset), channel selection matched abilities by the exact requested name,
so a name such as deepseek-flash@effort:max found no channel. Retry with
the routing name when the exact name has no channel, as the cached path
already does.

* feat(deepseek): support V4.1 Flash, the Search and Fetch APIs, and @ reasoning modifiers

Follows the DeepSeek API update of 2026-10-17.

- Default models: deepseek-flash and deepseek-v4-pro, each with -none,
  -low and -max, plus deepseek-search and deepseek-fetch. The retired
  deepseek-chat, deepseek-reasoner and deepseek-v4-flash names are no
  longer listed.
- Thinking: the -none/-low/-max tails also work on deepseek-flash.
  @thinking and @effort now reach DeepSeek's own fields on Chat
  (thinking, reasoning_effort), Anthropic (thinking, output_config.effort)
  and Responses (reasoning.effort), and take precedence over the tails.
- Built-in prices: peak/off-peak expressions for deepseek-flash (also the
  deepseek-v4-flash aliases) and deepseek-v4-pro, and $0.75 per 1,000
  requests for deepseek-search and deepseek-fetch.
- Server-side search: searches and page fetches DeepSeek runs for Claude
  Code and Codex bill at $0.75 per 1,000 under deepseek_search and
  deepseek_fetch, whatever model name the client sent. Searches whose
  results already arrived stay billed when a stream ends before its final
  usage; this also applies to Alibaba's Anthropic endpoint.
- New endpoints POST /v1/tools/search and /v1/tools/fetch relay the
  DeepSeek APIs like /v1/alpha/search. A call is charged only when
  DeepSeek returns results or page content.

* fix(deepseek): price /v1/tools/search and /v1/tools/fetch by endpoint

A model named in the request body chose the billing model, so a body such
as {"query":"...","model":"deepseek-flash"} was priced as a chat model with
no tokens and the search or fetch cost nothing. Both endpoints now always
use their routing name, deepseek-search or deepseek-fetch. DeepSeek ignores
the body field, so the body is still forwarded unchanged.

* fix(deepseek): bill Claude-format page fetches at the DeepSeek Fetch price

usage.server_tool_use.web_fetch_requests always went to the web_fetch
tool price, which has no built-in value, while only searches used the
DeepSeek key. A channel can now name its own fetch key next to the search
key, and DeepSeek channels bill reported fetches under deepseek_fetch. A
channel retry clears it like the search key.
2026-10-17 23:24:33 +08:00
..
2026-07-27 15:20:19 +08:00

constant 包 (/constant)

该目录仅用于放置全局可复用的常量定义,不包含任何业务逻辑或依赖关系。

当前文件

文件 说明
azure.go 定义与 Azure 相关的全局常量,如 AzureNoRemoveDotTime(控制删除 . 的截止时间)。
cache_key.go 缓存键格式字符串及 Token 相关字段常量,统一缓存命名规则。
channel_setting.go Channel 级别的设置键,如 proxy、force_format 等。
context_key.go 定义 ContextKey 类型以及在整个项目中使用的上下文键常量(请求时间、Token/Channel/User 相关信息等)。
env.go 环境配置相关的全局变量,在启动阶段根据配置文件或环境变量注入。
finish_reason.go OpenAI/GPT 请求返回的 finish_reason 字符串常量集合。
midjourney.go Midjourney 相关错误码及动作(Action)常量与模型到动作的映射表。
setup.go 标识项目是否已完成初始化安装 (Setup 布尔值)。
task.go 各种任务(Task)平台、动作常量及模型与动作映射表,如 Suno、Midjourney 等。
user_setting.go 用户设置相关键常量以及通知类型(Email/Webhook)等。

使用约定

  1. constant 包只能被其他包引用(import),禁止在此包中引用项目内的其他自定义包。如确有需要,仅允许引用 Go 标准库。
  2. 不允许在此目录内编写任何与业务流程、数据库操作、第三方服务调用等相关的逻辑代码。
  3. 新增类型时,请保持命名语义清晰,并在本 README 的 当前文件 表格中补充说明,确保团队成员能够快速了解其用途。

⚠️ 违反以上约定将导致包之间产生不必要的耦合,影响代码可维护性与可测试性。请在提交代码前自行检查。