@rise-so/pi-grok-build 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -16,8 +16,9 @@ One dependency-free core with two adapters:
16
16
 
17
17
  | Model | Context | Pricing (per Mtok in/out/cache-read) | Notes |
18
18
  |---|---|---|---|
19
- | `grok-build-0.1` | 256k | $1.00 / $2.00 / $0.20 | flagship; aliases `grok-code-fast-1` upstream; pricing live-verified |
19
+ | `grok-build-0.1` | 256k | $1.00 / $2.00 / $0.20 | aliases `grok-code-fast-1` upstream; pricing live-verified |
20
20
  | `grok-4.3` | 1M | $1.25 / $2.50 / $0.20 | reasoning model; pricing live-verified; live pricing doubles past 200k tokens (pi records the base tier) |
21
+ | `grok-4.5` | 500k | $2.00 / $6.00 / $0.50 | reasoning model; documented efforts **low / medium / high** (default high, can't be disabled); pricing live-verified; long-context tier doubles past 200k |
21
22
  | `grok-composer-2.5-fast` | 200k | $3.00 / $15.00 / $0.50 | responds on `/responses` but is **absent from the live `/models` catalog**; context/output metadata from third-party registries |
22
23
 
23
24
  ### Media models (not wired up)
@@ -49,7 +50,8 @@ Then pick a model:
49
50
 
50
51
  ```sh
51
52
  pi --model xai-grok-build/grok-build-0.1
52
- pi --model xai-grok-build/grok-4.3 -p "one-shot prompt"
53
+ pi --model xai-grok-build/grok-4.5 -p "one-shot prompt"
54
+ pi --model xai-grok-build/grok-4.5:high -p "harder task"
53
55
  ```
54
56
 
55
57
  No `npm install` is needed for pi imports — pi's loader aliases
@@ -132,11 +134,12 @@ guards this with an import grep; keep it green.
132
134
  time; a concurrent Grok CLI login collides on the port.
133
135
  - OAuth is the only auth path, by policy. There is no `$XAI_API_KEY` handling,
134
136
  no API-key login row, and no reading of other programs' credential files.
135
- - Context windows and pricing for `grok-build-0.1` / `grok-4.3` are confirmed
136
- by xAI's live `GET /v1/models` (see `pnpm smoke:models`). `maxTokens` output
137
- caps are registry metadata only. `grok-composer-2.5-fast` is unlisted in the
138
- live catalog (it serves anyway); its context/output figures come from
139
- third-party registries and its pricing is maintainer-supplied.
137
+ - Context windows and pricing for `grok-build-0.1` / `grok-4.3` / `grok-4.5`
138
+ are confirmed by xAI's live `GET /v1/models` (see `pnpm smoke:models`).
139
+ `maxTokens` output caps are registry metadata only. `grok-composer-2.5-fast`
140
+ is unlisted in the live catalog (it serves anyway); its context/output
141
+ figures come from third-party registries and its pricing is
142
+ maintainer-supplied.
140
143
 
141
144
  ## Development
142
145
 
package/dist/extension.js CHANGED
@@ -45,6 +45,8 @@ export default function xaiGrokBuild(pi) {
45
45
  id: model.id,
46
46
  name: model.name,
47
47
  reasoning: model.reasoning,
48
+ // Only some catalog entries set thinkingLevelMap; `in` narrows the union.
49
+ ...("thinkingLevelMap" in model ? { thinkingLevelMap: { ...model.thinkingLevelMap } } : {}),
48
50
  input: [...model.input],
49
51
  cost: { ...model.cost },
50
52
  contextWindow: model.contextWindow,
@@ -1,4 +1,4 @@
1
1
  import { type Provider } from "@earendil-works/pi-ai";
2
2
  import { type XaiOptions } from "./xai-grok-build.js";
3
- export { GROK_43_MODEL, GROK_BUILD_MODEL, GROK_COMPOSER_MODEL, GROK_MODELS, XAI_BASE_URL, XAI_MODEL_ID, XAI_PROVIDER_ID, type XaiOptions, } from "./xai-grok-build.js";
3
+ export { GROK_43_MODEL, GROK_45_MODEL, GROK_BUILD_MODEL, GROK_COMPOSER_MODEL, GROK_MODELS, XAI_BASE_URL, XAI_MODEL_ID, XAI_PROVIDER_ID, type XaiOptions, } from "./xai-grok-build.js";
4
4
  export declare function xaiGrokBuildResponsesProvider(options?: XaiOptions): Provider<"openai-responses">;
package/dist/provider.js CHANGED
@@ -9,7 +9,7 @@
9
9
  import { createProvider, } from "@earendil-works/pi-ai";
10
10
  import { openAIResponsesApi } from "@earendil-works/pi-ai/api/openai-responses.lazy";
11
11
  import { GROK_MODELS, XAI_BASE_URL, XAI_PROVIDER_ID, loginXai, refreshXai, requireXaiOAuthCredential, } from "./xai-grok-build.js";
12
- export { GROK_43_MODEL, GROK_BUILD_MODEL, GROK_COMPOSER_MODEL, GROK_MODELS, XAI_BASE_URL, XAI_MODEL_ID, XAI_PROVIDER_ID, } from "./xai-grok-build.js";
12
+ export { GROK_43_MODEL, GROK_45_MODEL, GROK_BUILD_MODEL, GROK_COMPOSER_MODEL, GROK_MODELS, XAI_BASE_URL, XAI_MODEL_ID, XAI_PROVIDER_ID, } from "./xai-grok-build.js";
13
13
  export function xaiGrokBuildResponsesProvider(options = {}) {
14
14
  const opts = { ...options };
15
15
  return createProvider({
@@ -43,6 +43,32 @@ export declare const GROK_43_MODEL: {
43
43
  readonly supportsLongCacheRetention: false;
44
44
  };
45
45
  };
46
+ export declare const GROK_45_MODEL: {
47
+ id: string;
48
+ name: string;
49
+ api: "openai-responses";
50
+ provider: string;
51
+ baseUrl: string;
52
+ reasoning: true;
53
+ thinkingLevelMap: {
54
+ readonly off: null;
55
+ readonly minimal: null;
56
+ readonly xhigh: null;
57
+ };
58
+ input: ("text" | "image")[];
59
+ cost: {
60
+ input: number;
61
+ output: number;
62
+ cacheRead: number;
63
+ cacheWrite: number;
64
+ };
65
+ contextWindow: number;
66
+ maxTokens: number;
67
+ compat: {
68
+ readonly sendSessionIdHeader: false;
69
+ readonly supportsLongCacheRetention: false;
70
+ };
71
+ };
46
72
  export declare const GROK_COMPOSER_MODEL: {
47
73
  id: string;
48
74
  name: string;
@@ -104,6 +130,31 @@ export declare const GROK_MODELS: readonly [{
104
130
  readonly sendSessionIdHeader: false;
105
131
  readonly supportsLongCacheRetention: false;
106
132
  };
133
+ }, {
134
+ id: string;
135
+ name: string;
136
+ api: "openai-responses";
137
+ provider: string;
138
+ baseUrl: string;
139
+ reasoning: true;
140
+ thinkingLevelMap: {
141
+ readonly off: null;
142
+ readonly minimal: null;
143
+ readonly xhigh: null;
144
+ };
145
+ input: ("text" | "image")[];
146
+ cost: {
147
+ input: number;
148
+ output: number;
149
+ cacheRead: number;
150
+ cacheWrite: number;
151
+ };
152
+ contextWindow: number;
153
+ maxTokens: number;
154
+ compat: {
155
+ readonly sendSessionIdHeader: false;
156
+ readonly supportsLongCacheRetention: false;
157
+ };
107
158
  }, {
108
159
  id: string;
109
160
  name: string;
@@ -29,10 +29,10 @@ const MODEL_COMPAT = {
29
29
  supportsLongCacheRetention: false,
30
30
  };
31
31
  // Catalog notes:
32
- // - Context windows and per-Mtok pricing for grok-build-0.1 and grok-4.3 are
33
- // confirmed by xAI's live GET /v1/models (see `pnpm smoke:models`). Live
34
- // pricing doubles past a 200k-token threshold; pi's cost model has no
35
- // long-context tier, so the base tier is recorded.
32
+ // - Context windows and per-Mtok pricing for grok-build-0.1, grok-4.3, and
33
+ // grok-4.5 are confirmed by xAI's live GET /v1/models (see
34
+ // `pnpm smoke:models`). Live pricing doubles past a 200k-token threshold;
35
+ // pi's cost model has no long-context tier, so the base tier is recorded.
36
36
  // - maxTokens values are third-party registry metadata, unverified against
37
37
  // live output caps: pi-ai sends max_output_tokens only when stream options
38
38
  // set maxTokens, which they normally don't.
@@ -40,6 +40,13 @@ const MODEL_COMPAT = {
40
40
  // accepts /responses calls with a subscription OAuth token. Context/output
41
41
  // metadata comes from third-party registries; pricing was supplied by the
42
42
  // maintainer (not machine-verifiable against /models since it's unlisted).
43
+ // - grok-4.5 is a reasoning model. xAI's docs specify reasoning_effort
44
+ // low/medium/high (default high, cannot be disabled); a live probe showed
45
+ // "minimal" and "xhigh" also return 200 but they are undocumented (and
46
+ // "xhigh" means agent count on grok-4.20-multi-agent, not depth), so only
47
+ // the documented levels are exposed: off/minimal/xhigh are nulled. Nulling
48
+ // "off" also stops pi's openai-responses path from sending
49
+ // `reasoning.effort: "none"` (a live 400) when no effort is set.
43
50
  //
44
51
  // The credential also sees media models (grok-imagine-image,
45
52
  // grok-imagine-image-quality, grok-imagine-video, grok-imagine-video-1.5).
@@ -81,6 +88,31 @@ export const GROK_43_MODEL = {
81
88
  maxTokens: 65_536,
82
89
  compat: MODEL_COMPAT,
83
90
  };
91
+ /** Documented efforts only: low / medium / high (default high; see catalog notes). */
92
+ const GROK_45_THINKING_LEVEL_MAP = {
93
+ off: null,
94
+ minimal: null,
95
+ xhigh: null,
96
+ };
97
+ export const GROK_45_MODEL = {
98
+ id: "grok-4.5",
99
+ name: "Grok 4.5",
100
+ api: "openai-responses",
101
+ provider: XAI_PROVIDER_ID,
102
+ baseUrl: XAI_BASE_URL,
103
+ reasoning: true,
104
+ thinkingLevelMap: GROK_45_THINKING_LEVEL_MAP,
105
+ input: ["text", "image"],
106
+ cost: {
107
+ input: 2,
108
+ output: 6,
109
+ cacheRead: 0.5,
110
+ cacheWrite: 0,
111
+ },
112
+ contextWindow: 500_000,
113
+ maxTokens: 65_536,
114
+ compat: MODEL_COMPAT,
115
+ };
84
116
  export const GROK_COMPOSER_MODEL = {
85
117
  id: "grok-composer-2.5-fast",
86
118
  name: "Grok Composer 2.5 Fast",
@@ -99,7 +131,12 @@ export const GROK_COMPOSER_MODEL = {
99
131
  maxTokens: 32_768,
100
132
  compat: MODEL_COMPAT,
101
133
  };
102
- export const GROK_MODELS = [GROK_BUILD_MODEL, GROK_43_MODEL, GROK_COMPOSER_MODEL];
134
+ export const GROK_MODELS = [
135
+ GROK_BUILD_MODEL,
136
+ GROK_43_MODEL,
137
+ GROK_45_MODEL,
138
+ GROK_COMPOSER_MODEL,
139
+ ];
103
140
  /** pi hands back `Record<string, unknown>`. Narrow at the boundary; fail fast. */
104
141
  export function requireXaiOAuthCredential(value) {
105
142
  const access = stringValue(value["access"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rise-so/pi-grok-build",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "xAI Grok Build provider for pi: OAuth login (borrowed Grok CLI client) plus Grok chat models over the OpenAI Responses API. OAuth only. Usable as a pi extension or as a pi-ai library provider.",
6
6
  "license": "MIT",
package/src/extension.ts CHANGED
@@ -63,6 +63,8 @@ export default function xaiGrokBuild(pi: ExtensionAPI): void {
63
63
  id: model.id,
64
64
  name: model.name,
65
65
  reasoning: model.reasoning,
66
+ // Only some catalog entries set thinkingLevelMap; `in` narrows the union.
67
+ ...("thinkingLevelMap" in model ? { thinkingLevelMap: { ...model.thinkingLevelMap } } : {}),
66
68
  input: [...model.input],
67
69
  cost: { ...model.cost },
68
70
  contextWindow: model.contextWindow,
package/src/provider.ts CHANGED
@@ -27,6 +27,7 @@ import {
27
27
 
28
28
  export {
29
29
  GROK_43_MODEL,
30
+ GROK_45_MODEL,
30
31
  GROK_BUILD_MODEL,
31
32
  GROK_COMPOSER_MODEL,
32
33
  GROK_MODELS,
@@ -36,10 +36,10 @@ const MODEL_COMPAT = {
36
36
  } as const;
37
37
 
38
38
  // Catalog notes:
39
- // - Context windows and per-Mtok pricing for grok-build-0.1 and grok-4.3 are
40
- // confirmed by xAI's live GET /v1/models (see `pnpm smoke:models`). Live
41
- // pricing doubles past a 200k-token threshold; pi's cost model has no
42
- // long-context tier, so the base tier is recorded.
39
+ // - Context windows and per-Mtok pricing for grok-build-0.1, grok-4.3, and
40
+ // grok-4.5 are confirmed by xAI's live GET /v1/models (see
41
+ // `pnpm smoke:models`). Live pricing doubles past a 200k-token threshold;
42
+ // pi's cost model has no long-context tier, so the base tier is recorded.
43
43
  // - maxTokens values are third-party registry metadata, unverified against
44
44
  // live output caps: pi-ai sends max_output_tokens only when stream options
45
45
  // set maxTokens, which they normally don't.
@@ -47,6 +47,13 @@ const MODEL_COMPAT = {
47
47
  // accepts /responses calls with a subscription OAuth token. Context/output
48
48
  // metadata comes from third-party registries; pricing was supplied by the
49
49
  // maintainer (not machine-verifiable against /models since it's unlisted).
50
+ // - grok-4.5 is a reasoning model. xAI's docs specify reasoning_effort
51
+ // low/medium/high (default high, cannot be disabled); a live probe showed
52
+ // "minimal" and "xhigh" also return 200 but they are undocumented (and
53
+ // "xhigh" means agent count on grok-4.20-multi-agent, not depth), so only
54
+ // the documented levels are exposed: off/minimal/xhigh are nulled. Nulling
55
+ // "off" also stops pi's openai-responses path from sending
56
+ // `reasoning.effort: "none"` (a live 400) when no effort is set.
50
57
  //
51
58
  // The credential also sees media models (grok-imagine-image,
52
59
  // grok-imagine-image-quality, grok-imagine-video, grok-imagine-video-1.5).
@@ -91,6 +98,33 @@ export const GROK_43_MODEL = {
91
98
  compat: MODEL_COMPAT,
92
99
  } satisfies Model<"openai-responses">;
93
100
 
101
+ /** Documented efforts only: low / medium / high (default high; see catalog notes). */
102
+ const GROK_45_THINKING_LEVEL_MAP = {
103
+ off: null,
104
+ minimal: null,
105
+ xhigh: null,
106
+ } as const;
107
+
108
+ export const GROK_45_MODEL = {
109
+ id: "grok-4.5",
110
+ name: "Grok 4.5",
111
+ api: "openai-responses",
112
+ provider: XAI_PROVIDER_ID,
113
+ baseUrl: XAI_BASE_URL,
114
+ reasoning: true,
115
+ thinkingLevelMap: GROK_45_THINKING_LEVEL_MAP,
116
+ input: ["text", "image"],
117
+ cost: {
118
+ input: 2,
119
+ output: 6,
120
+ cacheRead: 0.5,
121
+ cacheWrite: 0,
122
+ },
123
+ contextWindow: 500_000,
124
+ maxTokens: 65_536,
125
+ compat: MODEL_COMPAT,
126
+ } satisfies Model<"openai-responses">;
127
+
94
128
  export const GROK_COMPOSER_MODEL = {
95
129
  id: "grok-composer-2.5-fast",
96
130
  name: "Grok Composer 2.5 Fast",
@@ -110,7 +144,12 @@ export const GROK_COMPOSER_MODEL = {
110
144
  compat: MODEL_COMPAT,
111
145
  } satisfies Model<"openai-responses">;
112
146
 
113
- export const GROK_MODELS = [GROK_BUILD_MODEL, GROK_43_MODEL, GROK_COMPOSER_MODEL] as const;
147
+ export const GROK_MODELS = [
148
+ GROK_BUILD_MODEL,
149
+ GROK_43_MODEL,
150
+ GROK_45_MODEL,
151
+ GROK_COMPOSER_MODEL,
152
+ ] as const;
114
153
 
115
154
  export type XaiOptions = {
116
155
  /**