@ottocode/sdk 0.1.264 → 0.1.265
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 +2 -1
- package/src/config/src/index.ts +1 -0
- package/src/core/src/providers/resolver.ts +10 -0
- package/src/index.ts +2 -0
- package/src/providers/src/catalog.ts +1126 -220
- package/src/providers/src/env.ts +1 -0
- package/src/providers/src/index.ts +2 -0
- package/src/providers/src/pricing.ts +3 -0
- package/src/providers/src/registry.ts +2 -0
- package/src/providers/src/utils.ts +3 -0
- package/src/providers/src/xai-client.ts +15 -0
- package/src/types/src/provider.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.265",
|
|
4
4
|
"description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
|
|
5
5
|
"author": "nitishxyz",
|
|
6
6
|
"license": "MIT",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"@ai-sdk/google": "^3.0.0",
|
|
99
99
|
"@ai-sdk/openai": "^3.0.0",
|
|
100
100
|
"@ai-sdk/openai-compatible": "^2.0.0",
|
|
101
|
+
"@ai-sdk/xai": "^3.0.0",
|
|
101
102
|
"@modelcontextprotocol/sdk": "^1.12",
|
|
102
103
|
"@openauthjs/openauth": "^0.4.3",
|
|
103
104
|
"@openrouter/ai-sdk-provider": "^1.2.0",
|
package/src/config/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ const DEFAULT_PROVIDER_SETTINGS: OttoConfig['providers'] = {
|
|
|
18
18
|
opencode: { enabled: false },
|
|
19
19
|
copilot: { enabled: false },
|
|
20
20
|
ottorouter: { enabled: true },
|
|
21
|
+
xai: { enabled: false },
|
|
21
22
|
zai: { enabled: false },
|
|
22
23
|
'zai-coding': { enabled: false },
|
|
23
24
|
moonshot: { enabled: false },
|
|
@@ -4,6 +4,7 @@ import { google, createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
|
4
4
|
import { createOllama } from 'ai-sdk-ollama';
|
|
5
5
|
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
|
|
6
6
|
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
7
|
+
import { createXai } from '@ai-sdk/xai';
|
|
7
8
|
import {
|
|
8
9
|
catalog,
|
|
9
10
|
createOttoRouterModel,
|
|
@@ -39,6 +40,7 @@ export type ProviderName =
|
|
|
39
40
|
| 'opencode'
|
|
40
41
|
| 'copilot'
|
|
41
42
|
| 'ottorouter'
|
|
43
|
+
| 'xai'
|
|
42
44
|
| 'zai'
|
|
43
45
|
| 'zai-coding'
|
|
44
46
|
| 'moonshot'
|
|
@@ -201,6 +203,14 @@ export async function resolveModel(
|
|
|
201
203
|
);
|
|
202
204
|
}
|
|
203
205
|
|
|
206
|
+
if (provider === 'xai') {
|
|
207
|
+
const entry = catalog[provider];
|
|
208
|
+
const apiKey = config.apiKey || process.env.XAI_API_KEY || '';
|
|
209
|
+
const baseURL = config.baseURL || entry?.api;
|
|
210
|
+
const instance = createXai({ apiKey, baseURL });
|
|
211
|
+
return instance(model);
|
|
212
|
+
}
|
|
213
|
+
|
|
204
214
|
if (provider === 'zai') {
|
|
205
215
|
const entry = catalog[provider];
|
|
206
216
|
const apiKey =
|
package/src/index.ts
CHANGED
|
@@ -142,6 +142,8 @@ export {
|
|
|
142
142
|
export type { AnthropicOAuthConfig } from './providers/src/index.ts';
|
|
143
143
|
export { createGoogleModel } from './providers/src/index.ts';
|
|
144
144
|
export type { GoogleProviderConfig } from './providers/src/index.ts';
|
|
145
|
+
export { createXaiModel } from './providers/src/index.ts';
|
|
146
|
+
export type { XaiProviderConfig } from './providers/src/index.ts';
|
|
145
147
|
export { createZaiModel, createZaiCodingModel } from './providers/src/index.ts';
|
|
146
148
|
export type { ZaiProviderConfig } from './providers/src/index.ts';
|
|
147
149
|
export {
|