We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
max_tokens
1 parent 4050bf6 commit 43894b0Copy full SHA for 43894b0
src/main.ts
@@ -18,6 +18,16 @@ const providers: CreateAnthropicProxyOptions["providers"] = {
18
openai: createOpenAI({
19
apiKey: process.env.OPENAI_API_KEY,
20
baseURL: process.env.OPENAI_API_URL,
21
+ fetch: (async (url, init) => {
22
+ if (init?.body && typeof init.body === "string") {
23
+ const body = JSON.parse(init.body);
24
+ const maxTokens = body.max_tokens;
25
+ delete body["max_tokens"];
26
+ body.max_completion_tokens = maxTokens;
27
+ init.body = JSON.stringify(body);
28
+ }
29
+ return globalThis.fetch(url, init);
30
+ }) as typeof fetch,
31
}),
32
azure: createAzure({
33
apiKey: process.env.AZURE_API_KEY,
0 commit comments