[FEATURE] 支持通过脚本动态生成 API 请求头 Support dynamically generating API request headers via scripts
Before you begin
- I have searched existing issues to avoid duplicates
- I am willing to contribute a PR for this feature
Is your feature request related to a problem? Please describe.
目前 Read Frog 已支持在 API 提供商的高级选项中配置自定义请求头。
现有配置方式为静态 JSON,例如:
{
"X-Custom-Header": "value",
"Authorization": "Bearer token"
}这种方式适合固定请求头,但无法覆盖以下场景:
- 每次请求都需要生成不同的时间戳
- 请求头中需要加入随机值或 Request ID,例如:OpenCode Go Subscribe 自 9 月 6 日起要求添加的请求头
- 需要根据当前请求动态配置
thinking type和reasoning_effort
因此想请问,目前 Read Frog 的开发规划中,是否有 通过用户 JavaScript 脚本动态生成请求头 的相关计划。
如果没有,我可以提交一份 PR 参与贡献。
English Version
Read Frog currently supports configuring custom request headers in the advanced options of API providers.
The current configuration method is static JSON, for example:
{
"X-Custom-Header": "value",
"Authorization": "Bearer token"
}This works well for fixed request headers, but cannot cover the following scenarios:
- A different timestamp needs to be generated for each request
- Random values or Request IDs need to be included in request headers, for example: the request header required by OpenCode Go Subscribe starting September 6
thinking typeandreasoning_effortneed to be dynamically configured based on the current request
Therefore, I would like to ask whether Read Frog's development roadmap includes any plans for dynamically generating request headers via user JavaScript scripts.
If not, I can submit a PR to contribute.
Describe the solution you'd like
功能目标
希望可以在以下位置:
API 提供商 → 高级选项 → 请求头
编写一个简单的 JavaScript 函数。
脚本默认使用 export default 导出,并由 Read Frog 在实际请求发送前执行。
例如:
export default function (context) {
return {
"X-Timestamp": String(context.now),
"X-Model": context.model
}
}脚本返回的对象将作为本次请求的动态 Header。
这样可以在不修改 Read Frog 本身请求逻辑的情况下,根据当前请求上下文动态生成请求头。
English Version
Feature Goal
It would be great to be able to write a simple JavaScript function in the following location:
API Provider → Advanced Options → Request Headers
The script would be exported by default using export default, and executed by Read Frog before the actual request is sent.
For example:
export default function (context) {
return {
"X-Timestamp": String(context.now),
"X-Model": context.model
}
}The object returned by the script would be used as the dynamic headers for that request.
In this way, request headers can be dynamically generated based on the current request context without modifying Read Frog's own request logic.
Which area(s) would this feature affect? (Select all that apply)
Browser Extension
Additional context
No response
Source: mengxi-ream/read-frog