pi-yandex-bridge 0.2.8 → 0.2.9
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/index.ts +6 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -32,7 +32,8 @@ import type {
|
|
|
32
32
|
// ─── constants ────────────────────────────────────────────────────────────────
|
|
33
33
|
|
|
34
34
|
const IAM_TOKEN_URL = "https://iam.api.cloud.yandex.net/iam/v1/tokens";
|
|
35
|
-
const
|
|
35
|
+
const AI_FETCH_URL = "https://llm.api.cloud.yandex.net/v1";
|
|
36
|
+
const AI_BASE_URL = "https://ai.api.cloud.yandex.net/v1";
|
|
36
37
|
const AUTH_PATH = join(homedir(), ".pi", "agent", "auth.json");
|
|
37
38
|
|
|
38
39
|
const OAUTH_CLIENT_ID = "0414b7213b22435fa65051f64270584f";
|
|
@@ -55,8 +56,8 @@ function prettyModelName(id: string): string {
|
|
|
55
56
|
const match = id.match(/^gpt:\/\/([^/]+)\/(.+?)(?:(\/latest))?$/);
|
|
56
57
|
if (!match) return id;
|
|
57
58
|
const [, folderId, slug, hasLatest] = match;
|
|
58
|
-
const tag = hasLatest ? "l" : "";
|
|
59
|
-
return `${slug}{${folderId.slice(-5)}${tag
|
|
59
|
+
const tag = hasLatest ? "/l" : "";
|
|
60
|
+
return `${slug}{${folderId.slice(-5)}${tag}}`;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
function modelEntry(id: string, folderId: string) {
|
|
@@ -66,7 +67,7 @@ function modelEntry(id: string, folderId: string) {
|
|
|
66
67
|
api: "openai-responses" as const,
|
|
67
68
|
provider: "yandex",
|
|
68
69
|
baseUrl: AI_BASE_URL,
|
|
69
|
-
reasoning:
|
|
70
|
+
reasoning: true,
|
|
70
71
|
input: ["text"] as ("text" | "image")[],
|
|
71
72
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
72
73
|
contextWindow: 128_000,
|
|
@@ -117,7 +118,7 @@ async function fetchModelIds(
|
|
|
117
118
|
const ac = new AbortController();
|
|
118
119
|
const timer = setTimeout(() => ac.abort(), 5_000);
|
|
119
120
|
try {
|
|
120
|
-
const res = await fetch(`${
|
|
121
|
+
const res = await fetch(`${AI_FETCH_URL}/models`, {
|
|
121
122
|
headers: {
|
|
122
123
|
Authorization: authHeader,
|
|
123
124
|
"OpenAI-Project": folderId,
|