forked from voocel/ainovel-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.example.jsonc
More file actions
127 lines (121 loc) · 6.5 KB
/
Copy pathconfig.example.jsonc
File metadata and controls
127 lines (121 loc) · 6.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
// 默认使用的 provider、model 和推理强度。
// ★ provider 的值是下面 providers 里的一个 key 名(一根“指针”),不是协议名——
// 改 provider 必须保证 providers 里有同名条目,否则启动会报“未配置凭证”。
// 运行时用 /model 面板切换会写回全局配置 ~/.ainovel/config.json。
"provider": "openrouter",
"model": "google/gemini-2.5-flash",
// 可选。默认推理强度:off / low / medium / high / xhigh / max。
// 省略或空字符串 = 不覆盖,沿用模型/provider 默认。
"reasoning_effort": "medium",
// Provider 凭证库。key 自定义,用作上面 provider 字段引用的目标。
// 已知 provider(openai/anthropic/gemini/openrouter/deepseek/qwen/glm/grok/mimo/ollama/bedrock)
// 可省略 type;自定义代理必须显式声明 type 指明 API 协议。
"providers": {
"openrouter": {
"api_key": "sk-or-v1-xxx",
"base_url": "https://openrouter.ai/api/v1",
// 可选。声明 /model 面板候选;省略时回退到配置中已出现过的同 provider 模型。
"models": ["google/gemini-3.0-flash", "google/gemini-3.1-pro"],
// 可选。透传给该 provider 每次请求的额外参数(采样参数如 temperature/top_p/
// min_p,或厂商特有键如 nvidia 开 think 的 chat_template_kwargs),逐字并入请求体。
// 仅对 OpenAI 兼容类 provider 生效(openrouter/deepseek/qwen/glm/grok/ollama…);
// type:"openai" 会按官方参数白名单过滤。值由用户自负其责。
"extra_body": { "temperature": 0.8, "min_p": 0.05 },
// 可选。provider 级配置,透传给 HTTP 客户端层(不是请求体),用于需要
// 自定义 User-Agent / headers / anthropic_beta 的代理。
"extra": {
"user_agent": "my-client/1.0",
"headers": { "X-Custom-Client": "my-client" }
}
},
"anthropic": {
"api_key": "sk-ant-xxx",
"models": ["claude-sonnet-4", "claude-opus-4"]
},
"ollama": {
// ollama / bedrock / 显式 type 的自定义代理可以省略 api_key
// base_url 需带 /v1(ollama 的 OpenAI 兼容端点在 /v1 下)
"base_url": "http://localhost:11434/v1",
"models": ["qwen3:14b"]
},
"claude-code-proxy": {
// 自定义 Anthropic 代理。如果上游限制只能由 Claude Code 客户端访问,
// 用 extra 透传 user_agent / anthropic_beta / headers。
// base_url 不需要带 /v1。
"type": "anthropic",
"api_key": "sk-xxx",
"base_url": "https://proxy.example.com",
"models": ["claude-sonnet-4-6"],
"extra": {
"user_agent": "claude-code/2.1.183",
"anthropic_beta": "claude-code-20250219",
"headers": {
"X-Stainless-Lang": "js",
"X-Stainless-Package-Version": "0.94.0",
"X-Stainless-Runtime": "node"
}
}
},
"codex-proxy": {
// 自定义 OpenAI/NewAPI 代理。如果上游限制只能由 Codex 客户端访问,
// 用 extra 覆盖 User-Agent,并透传 Codex 识别头。
// base_url 按代理实际地址填写;OpenAI 协议通常需要 /v1。
"type": "openai",
"api_key": "sk-xxx",
"base_url": "https://proxy.example.com/v1",
"models": ["gpt-5.4", "gpt-5.4-mini", "MiniMax-M3"],
// 可选。OpenAI 协议 endpoint:chat(默认 /v1/chat/completions)/
// responses(/v1/responses)。Codex 类代理通常需要 responses。
"api": "responses",
"extra": {
"user_agent": "codex-tui/0.142.3 (Mac OS 26.5.1; arm64) Apple_Terminal/470.2 (codex-tui; 0.142.3)",
"headers": {
"Originator": "codex-tui",
"Session_id": "replace-with-random-session-id",
"X-Codex-Turn-Metadata": "replace-with-random-turn-metadata"
}
}
}
},
// 可选。按角色覆盖默认模型;未配的角色使用上面的 model。
// reasoning_effort 也可按角色覆盖;未配时继承顶层 reasoning_effort。
// 角色:coordinator / architect / writer / editor。fallbacks 在主模型失败时按序尝试。
// 注意:这里的 provider 同样是“指针”,必须指向 providers 里存在的 key。
// "roles": {
// "writer": {
// "provider": "anthropic",
// "model": "claude-sonnet-4",
// "reasoning_effort": "high",
// "fallbacks": [{ "provider": "openrouter", "model": "google/gemini-3.0-pro" }]
// },
// "architect": { "provider": "openrouter", "model": "google/gemini-3.1-pro" }
// },
// 写作风格:default / suspense / fantasy / romance。
"style": "default"
// 可选。显式指定上下文压缩使用的窗口大小。省略 / 0 = 按模型名自动解析
//(registry 命中用真实窗口,未命中兜底 200k)。配了就优先用:既能给 registry
// 查不到的自定义模型指定真实窗口,也能把名义 1M 窗口钉在 300k 提前触发压缩,
// 避免在注意力衰退区才压缩。仅影响压缩阈值,不改变 API 实际请求长度。
// "context_window": 300000
// 可选。单本书(output 目录)的成本预算,挂机保险丝。book_usd > 0 才启用。
// 累计花费达到 warn_ratio 时告警不停机;达到 100% 在当前子代理任务结束后
// 优雅停机(hard_stop=true 则越线立即停)。停机后上调 book_usd 即可恢复续跑。
// 注意:自定义模型若注册表查不到价格且 provider 不自报 cost,预算形同虚设。
// "budget": {
// "book_usd": 50,
// "warn_ratio": 0.8,
// "hard_stop": false
// },
// 可选。无人值守告警,缺省启用(macOS osascript / Linux notify-send 桌面通知)。
// 配置 command 后改走自定义命令(手机推送走这里):字段经环境变量
// $NOTIFY_TITLE / $NOTIFY_BODY / $NOTIFY_KIND / $NOTIFY_LEVEL 传入,完整 JSON 同时写 stdin。
// events 可选过滤:run_end(完成/停止)/ repeat(指令重复,疑似空转)/ budget(预算)。
// "notify": {
// "enabled": true,
// // 标题/正文含中文与空格,必须经 --data-urlencode 传参,不可拼进 URL 路径或 HTTP 头。
// // Bark (iOS): "command": "curl -s --data-urlencode \"title=$NOTIFY_TITLE\" --data-urlencode \"body=$NOTIFY_BODY\" https://api.day.app/<key>"
// // ntfy (iOS/Android): "command": "curl -s -G --data-urlencode \"title=$NOTIFY_TITLE\" --data-urlencode \"message=$NOTIFY_BODY\" ntfy.sh/<topic>/publish"
// "events": ["run_end", "repeat", "budget"]
// }
}