@ottocode/server 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/server",
3
- "version": "0.1.264",
3
+ "version": "0.1.265",
4
4
  "description": "HTTP API server for ottocode",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -61,8 +61,8 @@
61
61
  "typecheck": "tsc --noEmit"
62
62
  },
63
63
  "dependencies": {
64
- "@ottocode/database": "0.1.264",
65
- "@ottocode/sdk": "0.1.264",
64
+ "@ottocode/database": "0.1.265",
65
+ "@ottocode/sdk": "0.1.265",
66
66
  "@hono/zod-openapi": "^1.1.5",
67
67
  "ai-sdk-ollama": "^3.8.3",
68
68
  "drizzle-orm": "^0.44.5",
@@ -140,6 +140,7 @@ async function processAskRequest(
140
140
  opencode: { enabled: true },
141
141
  copilot: { enabled: true },
142
142
  ottorouter: { enabled: true },
143
+ xai: { enabled: true },
143
144
  zai: { enabled: true },
144
145
  'zai-coding': { enabled: true },
145
146
  moonshot: { enabled: true },
@@ -19,6 +19,7 @@ import {
19
19
  resolveOttoRouterModel,
20
20
  type ResolveOttoRouterModelOptions,
21
21
  } from './ottorouter.ts';
22
+ import { getXaiInstance } from './xai.ts';
22
23
  import { getZaiInstance, getZaiCodingInstance } from './zai.ts';
23
24
  import { resolveOpencodeModel } from './opencode.ts';
24
25
  import { getMoonshotInstance } from './moonshot.ts';
@@ -73,6 +74,9 @@ export async function resolveModel(
73
74
  autoPayThresholdUsd: options?.autoPayThresholdUsd,
74
75
  });
75
76
  }
77
+ if (provider === 'xai') {
78
+ return getXaiInstance(cfg, model);
79
+ }
76
80
  if (provider === 'zai') {
77
81
  return getZaiInstance(cfg, model);
78
82
  }
@@ -190,6 +190,7 @@ function getReasoningProviderTarget(
190
190
  const npmBinding = getModelNpmBinding(provider, model);
191
191
  if (npmBinding === '@ai-sdk/anthropic') return 'anthropic';
192
192
  if (npmBinding === '@ai-sdk/openai') return 'openai';
193
+ if (npmBinding === '@ai-sdk/xai') return 'openai';
193
194
  if (npmBinding === '@ai-sdk/google') return 'google';
194
195
  if (npmBinding === 'ai-sdk-ollama') return 'ollama';
195
196
  if (npmBinding === '@ai-sdk/openai-compatible') return 'openai-compatible';
@@ -0,0 +1,8 @@
1
+ import type { OttoConfig } from '@ottocode/sdk';
2
+ import { getAuth, createXaiModel } from '@ottocode/sdk';
3
+
4
+ export async function getXaiInstance(cfg: OttoConfig, model: string) {
5
+ const auth = await getAuth('xai', cfg.projectRoot);
6
+ const apiKey = auth?.type === 'api' ? auth.key : undefined;
7
+ return createXaiModel(model, { apiKey });
8
+ }