Fix : Updated Anthropic-Beta header.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { FORMATS } from "./formats.js";
|
||||
import { ensureToolCallIds, fixMissingToolResponses } from "./helpers/toolCallHelper.js";
|
||||
import { prepareClaudeRequest } from "./helpers/claudeHelper.js";
|
||||
import { cloakClaudeTools } from "../utils/claudeCloaking.js";
|
||||
import { filterToOpenAIFormat } from "./helpers/openaiHelper.js";
|
||||
import { normalizeThinkingConfig } from "../services/provider.js";
|
||||
import { AntigravityExecutor } from "../executors/antigravity.js";
|
||||
@@ -67,7 +68,7 @@ function stripUnsupportedMultimodal(body, multimodal = {}) {
|
||||
}
|
||||
|
||||
// Translate request: source -> openai -> target
|
||||
export function translateRequest(sourceFormat, targetFormat, model, body, stream = true, credentials = null, provider = null, reqLogger = null, caps = null) {
|
||||
export function translateRequest(sourceFormat, targetFormat, model, body, stream = true, credentials = null, provider = null, reqLogger = null, caps = null, connectionId = null) {
|
||||
ensureInitialized();
|
||||
let result = body;
|
||||
|
||||
@@ -122,7 +123,20 @@ export function translateRequest(sourceFormat, targetFormat, model, body, stream
|
||||
// Final step: prepare request for Claude format endpoints
|
||||
if (targetFormat === FORMATS.CLAUDE) {
|
||||
const apiKey = credentials?.accessToken || credentials?.apiKey || null;
|
||||
result = prepareClaudeRequest(result, provider, apiKey);
|
||||
result = prepareClaudeRequest(result, provider, apiKey, connectionId);
|
||||
}
|
||||
|
||||
// Claude cloaking: rename client tools with _cc suffix (anti-ban)
|
||||
// Only for claude provider (not anthropic-compatible-*) with OAuth token
|
||||
if (provider === "claude") {
|
||||
const apiKey = credentials?.accessToken || credentials?.apiKey || null;
|
||||
if (apiKey?.includes("sk-ant-oat")) {
|
||||
const { body: cloakedBody, toolNameMap } = cloakClaudeTools(result);
|
||||
result = cloakedBody;
|
||||
if (toolNameMap?.size > 0) {
|
||||
result._toolNameMap = toolNameMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Antigravity cloaking: rename client tools + inject decoys (anti-ban)
|
||||
|
||||
Reference in New Issue
Block a user