@oh-my-pi/pi-ai 17.3.5 → 17.3.7
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
|
@@ -813,7 +813,7 @@ export declare class AuthStorage {
|
|
|
813
813
|
/**
|
|
814
814
|
* Whether a request could resolve a key for this provider, including
|
|
815
815
|
* cross-provider env aliases (`xai-oauth` borrowing `XAI_API_KEY`).
|
|
816
|
-
* Use this for explicit model preflight (`xai-oauth/grok-4.
|
|
816
|
+
* Use this for explicit model preflight (`xai-oauth/grok-4.6`); use
|
|
817
817
|
* {@link hasAuth} for auto-availability so the default picker stays on
|
|
818
818
|
* paid `xai` when only `XAI_API_KEY` is set.
|
|
819
819
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-ai",
|
|
4
|
-
"version": "17.3.
|
|
4
|
+
"version": "17.3.7",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bufbuild/protobuf": "^2.12.1",
|
|
41
|
-
"@oh-my-pi/omptype": "17.3.
|
|
42
|
-
"@oh-my-pi/pi-catalog": "17.3.
|
|
43
|
-
"@oh-my-pi/pi-utils": "17.3.
|
|
44
|
-
"@oh-my-pi/pi-wire": "17.3.
|
|
41
|
+
"@oh-my-pi/omptype": "17.3.7",
|
|
42
|
+
"@oh-my-pi/pi-catalog": "17.3.7",
|
|
43
|
+
"@oh-my-pi/pi-utils": "17.3.7",
|
|
44
|
+
"@oh-my-pi/pi-wire": "17.3.7"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@bufbuild/protoc-gen-es": "^2.12.1",
|
package/src/auth-storage.ts
CHANGED
|
@@ -2698,7 +2698,7 @@ export class AuthStorage {
|
|
|
2698
2698
|
/**
|
|
2699
2699
|
* Whether a request could resolve a key for this provider, including
|
|
2700
2700
|
* cross-provider env aliases (`xai-oauth` borrowing `XAI_API_KEY`).
|
|
2701
|
-
* Use this for explicit model preflight (`xai-oauth/grok-4.
|
|
2701
|
+
* Use this for explicit model preflight (`xai-oauth/grok-4.6`); use
|
|
2702
2702
|
* {@link hasAuth} for auto-availability so the default picker stays on
|
|
2703
2703
|
* paid `xai` when only `XAI_API_KEY` is set.
|
|
2704
2704
|
*/
|
|
@@ -2732,8 +2732,8 @@ export class AuthStorage {
|
|
|
2732
2732
|
* `getEnvApiKey("xai-oauth")` also accepts `XAI_API_KEY` so an explicit
|
|
2733
2733
|
* `xai-oauth/…` stream can still borrow the paid key. Availability and
|
|
2734
2734
|
* origin must not: otherwise an API-key-only setup marks SuperGrok as
|
|
2735
|
-
* signed in and `pickDefaultAvailableModel` prefers `xai-oauth/grok-4.
|
|
2736
|
-
* over paid `xai/grok-4.
|
|
2735
|
+
* signed in and `pickDefaultAvailableModel` prefers `xai-oauth/grok-4.6`
|
|
2736
|
+
* over paid `xai/grok-4.6`.
|
|
2737
2737
|
*/
|
|
2738
2738
|
#hasDedicatedEnvAuth(provider: string): boolean {
|
|
2739
2739
|
if (provider === "xai-oauth") {
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
parseStreamingJsonThrottled,
|
|
32
32
|
stringifyJson,
|
|
33
33
|
structuredCloneJSON,
|
|
34
|
+
USER_AGENT,
|
|
34
35
|
} from "@oh-my-pi/pi-utils";
|
|
35
36
|
import * as AIError from "../error";
|
|
36
37
|
import {
|
|
@@ -315,6 +316,10 @@ export function resolveOpenAIRequestSetup(
|
|
|
315
316
|
if (options.defaultBaseUrl !== undefined) {
|
|
316
317
|
baseUrl = baseUrl ?? ($env.OPENAI_BASE_URL?.trim() || options.defaultBaseUrl);
|
|
317
318
|
}
|
|
319
|
+
// Attribute xAI traffic as omp unless a User-Agent is already set.
|
|
320
|
+
if (model.provider === "xai" || model.provider === "xai-oauth") {
|
|
321
|
+
setHeaderIfAbsent(headers, "User-Agent", USER_AGENT);
|
|
322
|
+
}
|
|
318
323
|
const requestHeaders = { ...headers };
|
|
319
324
|
// A keyless provider (`auth: none` in models.yml) resolves to the `N/A`
|
|
320
325
|
// sentinel rather than a real key. Injecting `Authorization: Bearer N/A`
|