claude-codex-proxy 1.0.5-beta.14 → 1.0.5-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/direct-api.js
CHANGED
|
@@ -219,6 +219,10 @@ export async function sendMessage(anthropicRequest, accessToken, accountId, cont
|
|
|
219
219
|
throw error;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
if (response.status === 400) {
|
|
223
|
+
throw createHTTPError(`INVALID_REQUEST: ${errorText}`, 400, 'invalid_request_error', response.status);
|
|
224
|
+
}
|
|
225
|
+
|
|
222
226
|
throw createUpstreamHTTPError(response, errorText);
|
|
223
227
|
}
|
|
224
228
|
|
package/src/format-converter.js
CHANGED
|
@@ -146,11 +146,11 @@ export function convertAnthropicToResponsesAPI(anthropicRequest) {
|
|
|
146
146
|
const instructions = extractSystemPrompt(system);
|
|
147
147
|
|
|
148
148
|
const request = {
|
|
149
|
-
model: model
|
|
149
|
+
model: model,
|
|
150
150
|
input: convertMessagesToInput(cleanedMessages),
|
|
151
151
|
tools: tools ? convertAnthropicToolsToOpenAI(tools) : [],
|
|
152
|
-
tool_choice:
|
|
153
|
-
parallel_tool_calls: true,
|
|
152
|
+
tool_choice: 'auto',
|
|
153
|
+
parallel_tool_calls: tool_choice?.disable_parallel_tool_use !== true,
|
|
154
154
|
store: false,
|
|
155
155
|
stream: true,
|
|
156
156
|
include: []
|
|
@@ -131,7 +131,12 @@ export async function handleMessages(req, res) {
|
|
|
131
131
|
rotator.markInvalid(account.email, 'Auth expired');
|
|
132
132
|
continue;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
|
|
135
|
+
if (error.status === 400 || error.anthropicErrorType === 'invalid_request_error') {
|
|
136
|
+
logger.info(`[Messages] Invalid request on ${account.email}; stopping account rotation`);
|
|
137
|
+
return handleStreamError(res, error, upstreamModel, startTime);
|
|
138
|
+
}
|
|
139
|
+
|
|
135
140
|
return handleStreamError(res, error, upstreamModel, startTime);
|
|
136
141
|
}
|
|
137
142
|
}
|