Skip to content

feat: add Bearer Token support and auto-detection for API auth#116

Open
cherryepbz-cyber wants to merge 3 commits intoshareAI-lab:mainfrom
cherryepbz-cyber:bearer
Open

feat: add Bearer Token support and auto-detection for API auth#116
cherryepbz-cyber wants to merge 3 commits intoshareAI-lab:mainfrom
cherryepbz-cyber:bearer

Conversation

@cherryepbz-cyber
Copy link

🚀 功能改进:支持 Bearer Token 自动识别与多模型适配

feat: add Bearer Token support and auto-detection logic

🇨🇳 中文描述 (Chinese Description)

💡 改进背景

当前的认证方式主要硬编码支持 x-api-key。为了让本项目能够无缝兼容更多主流 AI 提供商(如 OpenAI, DeepSeek, 或是用户自建的 API 代理网关),我增加了对标准 Authorization: Bearer 格式的支持。

🛠️ 主要改动

  1. 自动识别逻辑:全面更新了 agents/ 目录下的所有脚本(s01-s12)。系统现在会根据环境变量自动判断采用哪种请求头。
  2. 环境变量模板:在 .env.example 中增加了 BEARER_TOKEN 占位符。
  3. 架构对齐:在代码注释中强化了“模型即智能,代码即装甲 (Model is Agent, Code is Harness)”的工程哲学。

🧪 验证结果

  • API_KEY 模式:设置 API_KEY 时,请求头包含 x-api-key,运行正常。
  • BEARER_TOKEN 模式:设置 BEARER_TOKEN 时,请求头包含 Authorization: Bearer,运行正常。

🇺🇸 English Description

💡 Context

The current implementation primarily supports x-api-key. To ensure compatibility with a wider range of AI providers (e.g., OpenAI, DeepSeek, or custom API gateways), I have added support for the standard Authorization: Bearer format.

🛠️ Key Changes

  1. Auto-detection Logic: Updated all scripts in the agents/ directory (s01-s12). The system now automatically determines the appropriate header based on the available environment variables.
  2. Template Update: Added the BEARER_TOKEN placeholder to .env.example.
  3. Narrative Alignment: Maintained consistency with the "Model is Agent, Code is Harness" engineering philosophy throughout the codebase.

🧪 Verification

  • API_KEY Mode: Verified that requests function correctly with x-api-key.
  • BEARER_TOKEN Mode: Verified that requests function correctly with Authorization: Bearer.

Submitted by @cherryepbz-cyber

@vercel
Copy link

vercel bot commented Mar 23, 2026

@cherryepbz-cyber is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant