@sayknow-cli/ai 0.5.6 → 0.5.8
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 +11 -1
- package/dist/types/model-thinking.d.ts +7 -0
- package/dist/types/providers/anthropic.d.ts +1 -1
- package/package.json +2 -2
- package/src/model-thinking.ts +47 -7
- package/src/models.json +12150 -1310
- package/src/provider-models/descriptors.ts +1 -1
- package/src/providers/anthropic.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
-
## [0.5.
|
|
5
|
+
## [0.5.8] - 2026-09-10
|
|
6
|
+
|
|
7
|
+
## [0.5.7] - 2026-09-10
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Bundled `openai-codex/gpt-6-astra` (ported from upstream #5294) so eligible ChatGPT accounts can select GPT-6 Astra without waiting for authenticated Codex discovery. The reviewed snapshot records the 272K prompt budget, 128K output cap, text-and-image input, websocket preference, low-through-max reasoning efforts, freeform `apply_patch`, and standard published pricing ($10/$50, cache read $1, cache write $12.50). Upstream's above-272K pricing tier is intentionally omitted: this fork's cost engine has no long-context tier support, so the field would be dead data. The GPT model-id parser and the generated `apply_patch` policy now recognize the `astra` variant (GPT-6), and the catalog was regenerated, which also picks up the current models.dev snapshot across gateway providers.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Bumped the advertised Claude Code client version from 2.1.219 to 2.1.267. Anthropic gates newer models (e.g. the 5.1 line) on the advertised client version and rejected requests with HTTP 400 `claude_code_version_too_old` ("version 2.1.251 or newer is required"), so those models were unusable through the Claude Code OAuth path.
|
|
6
16
|
|
|
7
17
|
## [0.5.3] - 2026-08-28
|
|
8
18
|
|
|
@@ -27,6 +27,13 @@ export declare function enrichModelThinking<TApi extends Api>(model: ApiModel<TA
|
|
|
27
27
|
* canonical rules, replacing any existing `thinking`.
|
|
28
28
|
*/
|
|
29
29
|
export declare function refreshModelThinking<TApi extends Api>(model: ApiModel<TApi>): ApiModel<TApi>;
|
|
30
|
+
/**
|
|
31
|
+
* Extract the GLM generation from a Zhipu/ZAI model id: `glm-5.3` and
|
|
32
|
+
* `glm-5.3-flash` -> 5.3, `glm-5` and `glm-5-turbo` -> 5, `glm-4.7` -> 4.7.
|
|
33
|
+
* Returns undefined for ids that are not a plain GLM generation, including the
|
|
34
|
+
* vision line (`glm-5v-turbo`), so those never inherit text-model corrections.
|
|
35
|
+
*/
|
|
36
|
+
export declare function glmGeneration(modelId: string): number | undefined;
|
|
30
37
|
/**
|
|
31
38
|
* Apply upstream metadata corrections to a mutable array of models.
|
|
32
39
|
*
|
|
@@ -50,7 +50,7 @@ export declare function isAnthropicThinkingBlockMutationError(error: unknown): b
|
|
|
50
50
|
* than only the latest one.
|
|
51
51
|
*/
|
|
52
52
|
export declare function isAnthropicThinkingSignatureInvalidError(error: unknown): boolean;
|
|
53
|
-
export declare const claudeCodeVersion = "2.1.
|
|
53
|
+
export declare const claudeCodeVersion = "2.1.267";
|
|
54
54
|
export declare const claudeCodeEntrypoint = "sdk-cli";
|
|
55
55
|
export declare const claudeToolPrefix: string;
|
|
56
56
|
export declare const claudeCodeSystemInstruction = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@sayknow-cli/ai",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.8",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://sayknow-cli.com",
|
|
7
7
|
"author": "jaybeyond",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@anthropic-ai/sdk": "^0.94.0",
|
|
45
45
|
"@bufbuild/protobuf": "^2.12.0",
|
|
46
|
-
"@sayknow-cli/utils": "0.5.
|
|
46
|
+
"@sayknow-cli/utils": "0.5.8",
|
|
47
47
|
"openai": "^6.36.0",
|
|
48
48
|
"partial-json": "^0.1.7",
|
|
49
49
|
"zod": "4.4.3"
|
package/src/model-thinking.ts
CHANGED
|
@@ -64,6 +64,7 @@ type SemVer = {
|
|
|
64
64
|
type GeminiKind = "pro" | "flash";
|
|
65
65
|
type AnthropicKind = "opus" | "sonnet" | "fable";
|
|
66
66
|
type OpenAIVariant =
|
|
67
|
+
| "astra"
|
|
67
68
|
| "base"
|
|
68
69
|
| "codex"
|
|
69
70
|
| "codex-max"
|
|
@@ -190,6 +191,24 @@ export function refreshModelThinking<TApi extends Api>(model: ApiModel<TApi>): A
|
|
|
190
191
|
return { ...model, thinking: inferModelThinking(model) };
|
|
191
192
|
}
|
|
192
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Extract the GLM generation from a Zhipu/ZAI model id: `glm-5.3` and
|
|
196
|
+
* `glm-5.3-flash` -> 5.3, `glm-5` and `glm-5-turbo` -> 5, `glm-4.7` -> 4.7.
|
|
197
|
+
* Returns undefined for ids that are not a plain GLM generation, including the
|
|
198
|
+
* vision line (`glm-5v-turbo`), so those never inherit text-model corrections.
|
|
199
|
+
*/
|
|
200
|
+
export function glmGeneration(modelId: string): number | undefined {
|
|
201
|
+
const match = modelId.toLowerCase().match(/^glm-(\d+)(?:\.(\d+))?(?![\d.v])/);
|
|
202
|
+
if (!match) return undefined;
|
|
203
|
+
const [, major, minor] = match;
|
|
204
|
+
return minor === undefined ? Number(major) : Number(`${major}.${minor}`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function glmGenerationAtLeast(modelId: string, minimum: number): boolean {
|
|
208
|
+
const generation = glmGeneration(modelId);
|
|
209
|
+
return generation !== undefined && generation >= minimum;
|
|
210
|
+
}
|
|
211
|
+
|
|
193
212
|
/**
|
|
194
213
|
* Apply upstream metadata corrections to a mutable array of models.
|
|
195
214
|
*
|
|
@@ -425,13 +444,31 @@ function applyGeneratedModelPolicy(model: ApiModel<Api>): void {
|
|
|
425
444
|
if (parsedModel.family === "openai") {
|
|
426
445
|
applyOpenAICatalogPolicy(model, parsedModel);
|
|
427
446
|
}
|
|
428
|
-
// GLM-5.2 (Zhipu/ZAI):
|
|
429
|
-
// catalog copied GLM-5.1's 200K and that stale value survives
|
|
430
|
-
// (provider-scoped models bypass the models.dev refresh in
|
|
431
|
-
// Pin
|
|
432
|
-
|
|
447
|
+
// GLM-5.2 and newer (Zhipu/ZAI): ship a 1M lossless context window, but the
|
|
448
|
+
// bundled catalog copied GLM-5.1's 200K and that stale value survives
|
|
449
|
+
// generate-models (provider-scoped models bypass the models.dev refresh in
|
|
450
|
+
// applyGlobalModelsDevFallback). Pin the true 1M so context-cap /
|
|
451
|
+
// auto-compaction thresholds aren't tripped ~5x early.
|
|
452
|
+
//
|
|
453
|
+
// Matched by generation rather than by exact id so the next GLM point
|
|
454
|
+
// release inherits the correct window instead of silently regressing to
|
|
455
|
+
// whatever the catalog happens to carry. The correction only raises a
|
|
456
|
+
// stale-low window: a future generation that genuinely ships more than 1M
|
|
457
|
+
// keeps its larger catalog value instead of being clamped down to 1M.
|
|
458
|
+
if (model.provider === "zai" && glmGenerationAtLeast(model.id, 5.2) && model.contextWindow < 1_000_000) {
|
|
433
459
|
model.contextWindow = 1_000_000;
|
|
434
460
|
}
|
|
461
|
+
// Alibaba Token Plan's qwen3.8-max-preview is routed through the OpenAI
|
|
462
|
+
// Responses API. models.dev recently started publishing the whole
|
|
463
|
+
// alibaba-token-plan provider, and its blanket chat-completions mapping wins
|
|
464
|
+
// the generate-models merge, so a regeneration silently reroutes this one
|
|
465
|
+
// paid model. Pin the routing that ships today and is covered by
|
|
466
|
+
// register-builtins' Responses lazy-path watchdog until the endpoint is
|
|
467
|
+
// re-verified; the catalog's other metadata (vision input, 131K output cap)
|
|
468
|
+
// is still inherited.
|
|
469
|
+
if (model.provider === "alibaba-token-plan" && model.id === "qwen3.8-max-preview") {
|
|
470
|
+
model.api = "openai-responses" as typeof model.api;
|
|
471
|
+
}
|
|
435
472
|
// MiniMax-M3: MiniMax exposes a 1M context tier, but usage beyond 512K is
|
|
436
473
|
// billed separately. Keep bundled/default metadata at the billing-safe 512K
|
|
437
474
|
// unless an explicit paid-tier contract is added.
|
|
@@ -468,7 +505,10 @@ function inferGeneratedApplyPatchToolType(
|
|
|
468
505
|
model: ApiModel<Api>,
|
|
469
506
|
parsedModel: ParsedModel,
|
|
470
507
|
): ApiModel<Api>["applyPatchToolType"] {
|
|
471
|
-
if (
|
|
508
|
+
if (
|
|
509
|
+
parsedModel.family !== "openai" ||
|
|
510
|
+
(parsedModel.version.major !== 5 && !(parsedModel.version.major === 6 && parsedModel.variant === "astra"))
|
|
511
|
+
) {
|
|
472
512
|
return undefined;
|
|
473
513
|
}
|
|
474
514
|
if (model.provider === "openai" && model.api === "openai-responses") {
|
|
@@ -778,7 +818,7 @@ function parseAnthropicModel(modelId: string): AnthropicModel | null {
|
|
|
778
818
|
|
|
779
819
|
function parseOpenAIModel(modelId: string): OpenAIModel | null {
|
|
780
820
|
const match =
|
|
781
|
-
/gpt-(\d+(?:\.\d+){0,2})(?:-(codex-spark|codex-mini|codex-max|codex|luna|mini|max|nano|sol|terra))?$/.exec(
|
|
821
|
+
/gpt-(\d+(?:\.\d+){0,2})(?:-(astra|codex-spark|codex-mini|codex-max|codex|luna|mini|max|nano|sol|terra))?$/.exec(
|
|
782
822
|
modelId,
|
|
783
823
|
);
|
|
784
824
|
if (!match) {
|