mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-04-21 18:26:38 +02:00
feat: add Claude API bridge - transparent OpenAI-to-Anthropic protocol conversion
When provider is set to "claude" in config, all OpenAI-compatible API calls are automatically bridged to Anthropic Claude Messages API, including: - Non-streaming and streaming chat completions - Tool calls (function calling) with full bidirectional conversion - Eino multi-agent via HTTP transport hook (claudeRoundTripper) - System message extraction, auth header conversion (Bearer → x-api-key) - SSE stream format conversion (content_block_delta → OpenAI delta) - TestOpenAI handler support for Claude connectivity testing Zero impact when provider is "openai" or empty (default behavior unchanged). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"cyberstrike-ai/internal/agents"
|
||||
"cyberstrike-ai/internal/config"
|
||||
"cyberstrike-ai/internal/einomcp"
|
||||
"cyberstrike-ai/internal/openai"
|
||||
|
||||
einoopenai "github.com/cloudwego/eino-ext/components/model/openai"
|
||||
"github.com/cloudwego/eino/adk"
|
||||
@@ -141,6 +142,9 @@ func RunDeepAgent(
|
||||
},
|
||||
}
|
||||
|
||||
// 若配置为 Claude provider,注入自动桥接 transport,对 Eino 透明走 Anthropic Messages API
|
||||
httpClient = openai.NewEinoHTTPClient(&appCfg.OpenAI, httpClient)
|
||||
|
||||
baseModelCfg := &einoopenai.ChatModelConfig{
|
||||
APIKey: appCfg.OpenAI.APIKey,
|
||||
BaseURL: strings.TrimSuffix(appCfg.OpenAI.BaseURL, "/"),
|
||||
|
||||
Reference in New Issue
Block a user