@oh-my-pi/pi-ai 18.3.2 → 18.3.4
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [18.3.4] - 2026-09-27
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed Anthropic OAuth requests capping output at 64k tokens; they now request the model's full ceiling (128k on Opus 5.5), matching Claude Code and API-key requests
|
|
10
|
+
|
|
5
11
|
## [18.3.2] - 2026-09-25
|
|
6
12
|
|
|
7
13
|
### Fixed
|
|
@@ -36,5 +36,3 @@ export declare function adoptRequiredClaudeCodeVersion(error: unknown): boolean;
|
|
|
36
36
|
export declare const claudeToolPrefix: string;
|
|
37
37
|
/** Identity block prepended by Claude Code's CLI runtime. */
|
|
38
38
|
export declare const claudeCodeSystemInstruction = "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
39
|
-
/** Claude Code's per-request output-token ceiling. */
|
|
40
|
-
export declare const CLAUDE_CODE_MAX_OUTPUT_TOKENS = 64000;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -27,8 +27,7 @@ export type { StopDetails } from "./providers/anthropic-wire.js";
|
|
|
27
27
|
export type { AssistantMessageEventStream } from "./utils/event-stream.js";
|
|
28
28
|
/**
|
|
29
29
|
* Ceiling on the output-token count omp requests from any OpenAI-family endpoint
|
|
30
|
-
* (openai-responses, azure/xai responses, and openai-completions).
|
|
31
|
-
* Anthropic's {@link CLAUDE_CODE_MAX_OUTPUT_TOKENS}.
|
|
30
|
+
* (openai-responses, azure/xai responses, and openai-completions).
|
|
32
31
|
*
|
|
33
32
|
* Catalog `maxTokens` frequently reflects a model's context window rather than a
|
|
34
33
|
* given upstream's real per-request output cap. OpenRouter, for instance,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "18.3.
|
|
3
|
+
"version": "18.3.4",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -155,11 +155,11 @@
|
|
|
155
155
|
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
156
156
|
},
|
|
157
157
|
"dependencies": {
|
|
158
|
-
"@oh-my-pi/omptype": "18.3.
|
|
159
|
-
"@oh-my-pi/pi-catalog": "18.3.
|
|
160
|
-
"@oh-my-pi/pi-natives": "18.3.
|
|
161
|
-
"@oh-my-pi/pi-utils": "18.3.
|
|
162
|
-
"@oh-my-pi/pi-wire": "18.3.
|
|
158
|
+
"@oh-my-pi/omptype": "18.3.4",
|
|
159
|
+
"@oh-my-pi/pi-catalog": "18.3.4",
|
|
160
|
+
"@oh-my-pi/pi-natives": "18.3.4",
|
|
161
|
+
"@oh-my-pi/pi-utils": "18.3.4",
|
|
162
|
+
"@oh-my-pi/pi-wire": "18.3.4"
|
|
163
163
|
},
|
|
164
164
|
"devDependencies": {
|
|
165
165
|
"@types/bun": "^1.3.14"
|
|
@@ -116,7 +116,6 @@ import {
|
|
|
116
116
|
type TextBlockParam,
|
|
117
117
|
} from "./anthropic-wire";
|
|
118
118
|
import {
|
|
119
|
-
CLAUDE_CODE_MAX_OUTPUT_TOKENS,
|
|
120
119
|
claudeCodeSdkVersion,
|
|
121
120
|
claudeCodeSystemInstruction,
|
|
122
121
|
adoptRequiredClaudeCodeVersion,
|
|
@@ -4255,6 +4254,9 @@ function extractClaudeCodeFirstUserMessageText(messages: readonly Message[]): st
|
|
|
4255
4254
|
*/
|
|
4256
4255
|
const ANTHROPIC_CONTROL = Symbol("anthropicControl");
|
|
4257
4256
|
|
|
4257
|
+
/** `max_tokens` requested when the catalog has no output ceiling for the model. */
|
|
4258
|
+
const UNKNOWN_MODEL_MAX_OUTPUT_TOKENS = 64_000;
|
|
4259
|
+
|
|
4258
4260
|
/** One control message: tool changes (removals first) and an optional per-message effort. */
|
|
4259
4261
|
type AnthropicControlSpec = { toolChanges: AnthropicToolChange[]; effort?: AnthropicOutputEffort };
|
|
4260
4262
|
|
|
@@ -4738,11 +4740,9 @@ function buildParams(
|
|
|
4738
4740
|
}
|
|
4739
4741
|
const outputConfig = Object.keys(outputConfigEntries).length ? outputConfigEntries : undefined;
|
|
4740
4742
|
|
|
4741
|
-
//
|
|
4742
|
-
//
|
|
4743
|
-
|
|
4744
|
-
const modelMaxTokens = model.maxTokens ?? CLAUDE_CODE_MAX_OUTPUT_TOKENS;
|
|
4745
|
-
const maxOutputTokens = isOAuthToken ? Math.min(CLAUDE_CODE_MAX_OUTPUT_TOKENS, modelMaxTokens) : modelMaxTokens;
|
|
4743
|
+
// OAuth and API-key requests alike get the full model ceiling; Claude Code
|
|
4744
|
+
// itself requests 128k on Opus 5.5.
|
|
4745
|
+
const maxOutputTokens = model.maxTokens ?? UNKNOWN_MODEL_MAX_OUTPUT_TOKENS;
|
|
4746
4746
|
|
|
4747
4747
|
// A caller-owned client targets its own endpoint: route body betas by the
|
|
4748
4748
|
// client's URL when it exposes one, not the model's routing. Otherwise the
|
|
@@ -4773,7 +4773,7 @@ function buildParams(
|
|
|
4773
4773
|
...(systemBlocks && { system: systemBlocks }),
|
|
4774
4774
|
...(tools !== undefined && { tools }),
|
|
4775
4775
|
...(metadata && { metadata }),
|
|
4776
|
-
max_tokens: Math.min(maxOutputTokens, options?.maxTokens ??
|
|
4776
|
+
max_tokens: Math.min(maxOutputTokens, options?.maxTokens ?? maxOutputTokens),
|
|
4777
4777
|
...(thinking && { thinking }),
|
|
4778
4778
|
...(contextManagement && { context_management: contextManagement }),
|
|
4779
4779
|
...(compactionRequest && {
|
|
@@ -70,5 +70,3 @@ export function adoptRequiredClaudeCodeVersion(error: unknown): boolean {
|
|
|
70
70
|
export const claudeToolPrefix: string = "_";
|
|
71
71
|
/** Identity block prepended by Claude Code's CLI runtime. */
|
|
72
72
|
export const claudeCodeSystemInstruction = "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
73
|
-
/** Claude Code's per-request output-token ceiling. */
|
|
74
|
-
export const CLAUDE_CODE_MAX_OUTPUT_TOKENS = 64000;
|
package/src/types.ts
CHANGED
|
@@ -60,8 +60,7 @@ export type { AssistantMessageEventStream } from "./utils/event-stream";
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Ceiling on the output-token count omp requests from any OpenAI-family endpoint
|
|
63
|
-
* (openai-responses, azure/xai responses, and openai-completions).
|
|
64
|
-
* Anthropic's {@link CLAUDE_CODE_MAX_OUTPUT_TOKENS}.
|
|
63
|
+
* (openai-responses, azure/xai responses, and openai-completions).
|
|
65
64
|
*
|
|
66
65
|
* Catalog `maxTokens` frequently reflects a model's context window rather than a
|
|
67
66
|
* given upstream's real per-request output cap. OpenRouter, for instance,
|