Skip to content

Commit 8ff8896

Browse files
committed
fix: preserve max_output_tokens in transformed requests
1 parent 3b251e5 commit 8ff8896

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

lib/request/request-transformer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,6 @@ export async function transformRequestBody(
10881088
body.include = resolveInclude(modelConfig, body);
10891089

10901090
// Remove unsupported parameters
1091-
body.max_output_tokens = undefined;
10921091
body.max_completion_tokens = undefined;
10931092

10941093
return body;

test/request-transformer.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,14 +1437,24 @@ describe('Request Transformer Module', () => {
14371437
expect(result.input![0].role).toBe('user');
14381438
});
14391439

1440-
it('should remove unsupported parameters', async () => {
1440+
it('should preserve max_output_tokens while removing max_completion_tokens', async () => {
14411441
const body: RequestBody = {
14421442
model: 'gpt-5',
14431443
input: [],
14441444
max_output_tokens: 1000,
14451445
max_completion_tokens: 2000,
14461446
};
14471447
const result = await transformRequestBody(body, codexInstructions);
1448+
expect(result.max_output_tokens).toBe(1000);
1449+
expect(result.max_completion_tokens).toBeUndefined();
1450+
});
1451+
1452+
it('should leave max_output_tokens unset when not provided', async () => {
1453+
const body: RequestBody = {
1454+
model: 'gpt-5',
1455+
input: [],
1456+
};
1457+
const result = await transformRequestBody(body, codexInstructions);
14481458
expect(result.max_output_tokens).toBeUndefined();
14491459
expect(result.max_completion_tokens).toBeUndefined();
14501460
});

0 commit comments

Comments
 (0)