@agi-cli/sdk 0.1.103 → 0.1.105
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/package.json
CHANGED
package/src/config/src/index.ts
CHANGED
|
@@ -11,7 +11,9 @@ export type ProviderName =
|
|
|
11
11
|
| 'google'
|
|
12
12
|
| 'openrouter'
|
|
13
13
|
| 'opencode'
|
|
14
|
-
| 'solforge'
|
|
14
|
+
| 'solforge'
|
|
15
|
+
| 'zai'
|
|
16
|
+
| 'zai-coding';
|
|
15
17
|
|
|
16
18
|
export type ModelConfig = {
|
|
17
19
|
apiKey?: string;
|
|
@@ -133,6 +135,42 @@ export async function resolveModel(
|
|
|
133
135
|
);
|
|
134
136
|
}
|
|
135
137
|
|
|
138
|
+
if (provider === 'zai') {
|
|
139
|
+
const entry = catalog[provider];
|
|
140
|
+
const apiKey =
|
|
141
|
+
config.apiKey ||
|
|
142
|
+
process.env.ZAI_API_KEY ||
|
|
143
|
+
process.env.ZHIPU_API_KEY ||
|
|
144
|
+
'';
|
|
145
|
+
const baseURL =
|
|
146
|
+
config.baseURL || entry?.api || 'https://api.z.ai/api/paas/v4';
|
|
147
|
+
const headers = apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined;
|
|
148
|
+
const instance = createOpenAICompatible({
|
|
149
|
+
name: entry?.label ?? 'Z.AI',
|
|
150
|
+
baseURL,
|
|
151
|
+
headers,
|
|
152
|
+
});
|
|
153
|
+
return instance(model);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (provider === 'zai-coding') {
|
|
157
|
+
const entry = catalog[provider];
|
|
158
|
+
const apiKey =
|
|
159
|
+
config.apiKey ||
|
|
160
|
+
process.env.ZAI_API_KEY ||
|
|
161
|
+
process.env.ZHIPU_API_KEY ||
|
|
162
|
+
'';
|
|
163
|
+
const baseURL =
|
|
164
|
+
config.baseURL || entry?.api || 'https://api.z.ai/api/coding/paas/v4';
|
|
165
|
+
const headers = apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined;
|
|
166
|
+
const instance = createOpenAICompatible({
|
|
167
|
+
name: entry?.label ?? 'Z.AI Coding',
|
|
168
|
+
baseURL,
|
|
169
|
+
headers,
|
|
170
|
+
});
|
|
171
|
+
return instance(model);
|
|
172
|
+
}
|
|
173
|
+
|
|
136
174
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
137
175
|
}
|
|
138
176
|
|