@ottocode/sdk 0.1.243 → 0.1.245
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 -2
- package/src/auth/src/index.ts +2 -2
- package/src/auth/src/wallet.ts +5 -5
- package/src/config/src/index.ts +2 -2
- package/src/core/src/index.ts +6 -1
- package/src/core/src/providers/resolver.ts +9 -8
- package/src/core/src/utils/debug.ts +13 -0
- package/src/index.ts +14 -12
- package/src/providers/src/catalog-manual.ts +21 -18
- package/src/providers/src/catalog.ts +68 -40
- package/src/providers/src/env.ts +1 -1
- package/src/providers/src/index.ts +12 -12
- package/src/providers/src/{setu-client.ts → ottorouter-client.ts} +30 -30
- package/src/providers/src/pricing.ts +1 -1
- package/src/providers/src/utils.ts +1 -1
- package/src/types/src/provider.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.245",
|
|
4
4
|
"description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
|
|
5
5
|
"author": "nitishxyz",
|
|
6
6
|
"license": "MIT",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@modelcontextprotocol/sdk": "^1.12",
|
|
98
98
|
"@openauthjs/openauth": "^0.4.3",
|
|
99
99
|
"@openrouter/ai-sdk-provider": "^1.2.0",
|
|
100
|
-
"@
|
|
100
|
+
"@ottorouter/ai-sdk": "0.2.0",
|
|
101
101
|
"@solana/web3.js": "^1.98.0",
|
|
102
102
|
"ai": "^6.0.0",
|
|
103
103
|
"bs58": "^6.0.0",
|
package/src/auth/src/index.ts
CHANGED
package/src/auth/src/wallet.ts
CHANGED
|
@@ -34,25 +34,25 @@ export function isValidPrivateKey(privateKey: string): boolean {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export async function
|
|
37
|
+
export async function getOttoRouterWallet(
|
|
38
38
|
projectRoot?: string,
|
|
39
39
|
): Promise<WalletInfo | null> {
|
|
40
|
-
const auth = await getAuth('
|
|
40
|
+
const auth = await getAuth('ottorouter', projectRoot);
|
|
41
41
|
if (auth?.type === 'wallet' && auth.secret) {
|
|
42
42
|
return importWallet(auth.secret);
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export async function
|
|
47
|
+
export async function ensureOttoRouterWallet(
|
|
48
48
|
projectRoot?: string,
|
|
49
49
|
): Promise<WalletInfo> {
|
|
50
|
-
const existing = await
|
|
50
|
+
const existing = await getOttoRouterWallet(projectRoot);
|
|
51
51
|
if (existing) return existing;
|
|
52
52
|
|
|
53
53
|
const wallet = generateWallet();
|
|
54
54
|
await setAuth(
|
|
55
|
-
'
|
|
55
|
+
'ottorouter',
|
|
56
56
|
{ type: 'wallet', secret: wallet.privateKey },
|
|
57
57
|
projectRoot,
|
|
58
58
|
'global',
|
package/src/config/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ const DEFAULT_PROVIDER_SETTINGS: OttoConfig['providers'] = {
|
|
|
16
16
|
openrouter: { enabled: false },
|
|
17
17
|
opencode: { enabled: false },
|
|
18
18
|
copilot: { enabled: false },
|
|
19
|
-
|
|
19
|
+
ottorouter: { enabled: true },
|
|
20
20
|
zai: { enabled: false },
|
|
21
21
|
'zai-coding': { enabled: false },
|
|
22
22
|
moonshot: { enabled: false },
|
|
@@ -29,7 +29,7 @@ const DEFAULTS: {
|
|
|
29
29
|
} = {
|
|
30
30
|
defaults: {
|
|
31
31
|
agent: 'build',
|
|
32
|
-
provider: '
|
|
32
|
+
provider: 'ottorouter',
|
|
33
33
|
model: 'kimi-k2.5',
|
|
34
34
|
toolApproval: 'auto',
|
|
35
35
|
guidedMode: false,
|
package/src/core/src/index.ts
CHANGED
|
@@ -105,7 +105,12 @@ export {
|
|
|
105
105
|
// Logging & Debug
|
|
106
106
|
// =======================
|
|
107
107
|
export { logger, debug, info, warn, error, time } from './utils/logger.ts';
|
|
108
|
-
export {
|
|
108
|
+
export {
|
|
109
|
+
isDebugEnabled,
|
|
110
|
+
isTraceEnabled,
|
|
111
|
+
setDebugEnabled,
|
|
112
|
+
setTraceEnabled,
|
|
113
|
+
} from './utils/debug.ts';
|
|
109
114
|
|
|
110
115
|
// =======================
|
|
111
116
|
// MCP (Model Context Protocol)
|
|
@@ -5,7 +5,7 @@ import { createOpenRouter } from '@openrouter/ai-sdk-provider';
|
|
|
5
5
|
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
6
6
|
import {
|
|
7
7
|
catalog,
|
|
8
|
-
|
|
8
|
+
createOttoRouterModel,
|
|
9
9
|
createOpenAIOAuthModel,
|
|
10
10
|
} from '../../../providers/src/index.ts';
|
|
11
11
|
import { createCopilotModel } from '../../../providers/src/copilot-client.ts';
|
|
@@ -35,7 +35,7 @@ export type ProviderName =
|
|
|
35
35
|
| 'openrouter'
|
|
36
36
|
| 'opencode'
|
|
37
37
|
| 'copilot'
|
|
38
|
-
| '
|
|
38
|
+
| 'ottorouter'
|
|
39
39
|
| 'zai'
|
|
40
40
|
| 'zai-coding'
|
|
41
41
|
| 'moonshot';
|
|
@@ -163,16 +163,17 @@ export async function resolveModel(
|
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
if (provider === '
|
|
167
|
-
const privateKey =
|
|
166
|
+
if (provider === 'ottorouter') {
|
|
167
|
+
const privateKey =
|
|
168
|
+
config.apiKey || process.env.OTTOROUTER_PRIVATE_KEY || '';
|
|
168
169
|
if (!privateKey) {
|
|
169
170
|
throw new Error(
|
|
170
|
-
'
|
|
171
|
+
'OttoRouter provider requires OTTOROUTER_PRIVATE_KEY (base58 Solana secret).',
|
|
171
172
|
);
|
|
172
173
|
}
|
|
173
|
-
const baseURL = config.baseURL || process.env.
|
|
174
|
-
const rpcURL = process.env.
|
|
175
|
-
return
|
|
174
|
+
const baseURL = config.baseURL || process.env.OTTOROUTER_BASE_URL;
|
|
175
|
+
const rpcURL = process.env.OTTOROUTER_SOLANA_RPC_URL;
|
|
176
|
+
return createOttoRouterModel(
|
|
176
177
|
model,
|
|
177
178
|
{ privateKey },
|
|
178
179
|
{
|
|
@@ -6,6 +6,9 @@ type DebugSettings = {
|
|
|
6
6
|
debugScopes?: unknown;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
let debugEnabledOverride: boolean | undefined;
|
|
10
|
+
let traceEnabledOverride: boolean | undefined;
|
|
11
|
+
|
|
9
12
|
function readDebugSettings(): DebugSettings {
|
|
10
13
|
try {
|
|
11
14
|
const raw = readFileSync(getGlobalConfigPath(), 'utf-8');
|
|
@@ -17,13 +20,23 @@ function readDebugSettings(): DebugSettings {
|
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export function isDebugEnabled(): boolean {
|
|
23
|
+
if (debugEnabledOverride !== undefined) return debugEnabledOverride;
|
|
20
24
|
return readDebugSettings().debugEnabled === true;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
export function isTraceEnabled(): boolean {
|
|
28
|
+
if (traceEnabledOverride !== undefined) return traceEnabledOverride;
|
|
24
29
|
return false;
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
export function setDebugEnabled(enabled: boolean): void {
|
|
33
|
+
debugEnabledOverride = enabled;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function setTraceEnabled(enabled: boolean): void {
|
|
37
|
+
traceEnabledOverride = enabled;
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
export function getDebugScopes(): string[] {
|
|
28
41
|
const scopes = readDebugSettings().debugScopes;
|
|
29
42
|
if (!Array.isArray(scopes)) return [];
|
package/src/index.ts
CHANGED
|
@@ -63,20 +63,20 @@ export {
|
|
|
63
63
|
setEnvKey,
|
|
64
64
|
} from './providers/src/index.ts';
|
|
65
65
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
createOttoRouter,
|
|
67
|
+
createOttoRouterFetch,
|
|
68
|
+
createOttoRouterModel,
|
|
69
|
+
fetchOttoRouterBalance,
|
|
70
70
|
getPublicKeyFromPrivate,
|
|
71
71
|
fetchSolanaUsdcBalance,
|
|
72
72
|
} from './providers/src/index.ts';
|
|
73
73
|
export type {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
OttoRouterAuth,
|
|
75
|
+
OttoRouterInstance,
|
|
76
|
+
OttoRouterProviderOptions,
|
|
77
|
+
OttoRouterPaymentCallbacks,
|
|
78
|
+
OttoRouterBalanceUpdate,
|
|
79
|
+
OttoRouterBalanceResponse,
|
|
80
80
|
SolanaUsdcBalanceResponse,
|
|
81
81
|
} from './providers/src/index.ts';
|
|
82
82
|
export {
|
|
@@ -150,8 +150,8 @@ export {
|
|
|
150
150
|
generateWallet,
|
|
151
151
|
importWallet,
|
|
152
152
|
isValidPrivateKey,
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
getOttoRouterWallet,
|
|
154
|
+
ensureOttoRouterWallet,
|
|
155
155
|
} from './auth/src/index.ts';
|
|
156
156
|
export type { WalletInfo } from './auth/src/index.ts';
|
|
157
157
|
export {
|
|
@@ -290,6 +290,8 @@ export {
|
|
|
290
290
|
time,
|
|
291
291
|
isDebugEnabled,
|
|
292
292
|
isTraceEnabled,
|
|
293
|
+
setDebugEnabled,
|
|
294
|
+
setTraceEnabled,
|
|
293
295
|
} from './core/src/index.ts';
|
|
294
296
|
|
|
295
297
|
// Schema Validation
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ottorouterCatalog,
|
|
3
|
+
type OttoRouterModelCatalogEntry,
|
|
4
|
+
} from '@ottorouter/ai-sdk';
|
|
2
5
|
import type {
|
|
3
6
|
ModelInfo,
|
|
4
7
|
ModelOwner,
|
|
@@ -8,7 +11,7 @@ import type {
|
|
|
8
11
|
|
|
9
12
|
type CatalogMap = Partial<Record<ProviderId, ProviderCatalogEntry>>;
|
|
10
13
|
|
|
11
|
-
const
|
|
14
|
+
const OTTOROUTER_ID: ProviderId = 'ottorouter';
|
|
12
15
|
|
|
13
16
|
const OWNER_NPM: Record<ModelOwner, string> = {
|
|
14
17
|
openai: '@ai-sdk/openai',
|
|
@@ -21,7 +24,7 @@ const OWNER_NPM: Record<ModelOwner, string> = {
|
|
|
21
24
|
minimax: '@ai-sdk/anthropic',
|
|
22
25
|
};
|
|
23
26
|
|
|
24
|
-
function
|
|
27
|
+
function convertOttoRouterModel(m: OttoRouterModelCatalogEntry): ModelInfo {
|
|
25
28
|
const ownedBy = m.owned_by as ModelOwner;
|
|
26
29
|
return {
|
|
27
30
|
id: m.id,
|
|
@@ -52,12 +55,12 @@ function convertSetuModel(m: SetuModelCatalogEntry): ModelInfo {
|
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
function
|
|
56
|
-
const
|
|
58
|
+
function buildOttoRouterEntry(): ProviderCatalogEntry | null {
|
|
59
|
+
const ottorouterModels = ottorouterCatalog.models.map(convertOttoRouterModel);
|
|
57
60
|
|
|
58
|
-
if (!
|
|
61
|
+
if (!ottorouterModels.length) return null;
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
ottorouterModels.sort((a, b) => {
|
|
61
64
|
const ownerA = a.ownedBy ?? '';
|
|
62
65
|
const ownerB = b.ownedBy ?? '';
|
|
63
66
|
if (ownerA === ownerB) {
|
|
@@ -69,31 +72,31 @@ function buildSetuEntry(): ProviderCatalogEntry | null {
|
|
|
69
72
|
});
|
|
70
73
|
|
|
71
74
|
const defaultModelId = 'gpt-5-codex';
|
|
72
|
-
const defaultIdx =
|
|
75
|
+
const defaultIdx = ottorouterModels.findIndex((m) => m.id === defaultModelId);
|
|
73
76
|
if (defaultIdx > 0) {
|
|
74
|
-
const [picked] =
|
|
75
|
-
|
|
77
|
+
const [picked] = ottorouterModels.splice(defaultIdx, 1);
|
|
78
|
+
ottorouterModels.unshift(picked);
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
return {
|
|
79
|
-
id:
|
|
80
|
-
label: '
|
|
81
|
-
env: ['
|
|
82
|
-
api: 'https://
|
|
83
|
-
doc: 'https://
|
|
84
|
-
models:
|
|
82
|
+
id: OTTOROUTER_ID,
|
|
83
|
+
label: 'OttoRouter',
|
|
84
|
+
env: ['OTTOROUTER_PRIVATE_KEY'],
|
|
85
|
+
api: 'https://api.ottorouter.org/v1',
|
|
86
|
+
doc: 'https://ottorouter.org/docs',
|
|
87
|
+
models: ottorouterModels,
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
export function mergeManualCatalog(
|
|
89
92
|
base: CatalogMap,
|
|
90
93
|
): Record<ProviderId, ProviderCatalogEntry> {
|
|
91
|
-
const manualEntry =
|
|
94
|
+
const manualEntry = buildOttoRouterEntry();
|
|
92
95
|
const merged: Record<ProviderId, ProviderCatalogEntry> = {
|
|
93
96
|
...(base as Record<ProviderId, ProviderCatalogEntry>),
|
|
94
97
|
};
|
|
95
98
|
if (manualEntry) {
|
|
96
|
-
merged[
|
|
99
|
+
merged[OTTOROUTER_ID] = manualEntry;
|
|
97
100
|
}
|
|
98
101
|
return merged;
|
|
99
102
|
}
|
|
@@ -29,32 +29,6 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
29
29
|
output: 0,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
-
{
|
|
33
|
-
id: 'codex-mini-latest',
|
|
34
|
-
ownedBy: 'openai',
|
|
35
|
-
label: 'Codex Mini',
|
|
36
|
-
modalities: {
|
|
37
|
-
input: ['text'],
|
|
38
|
-
output: ['text'],
|
|
39
|
-
},
|
|
40
|
-
toolCall: true,
|
|
41
|
-
reasoningText: true,
|
|
42
|
-
attachment: true,
|
|
43
|
-
temperature: false,
|
|
44
|
-
knowledge: '2024-04',
|
|
45
|
-
releaseDate: '2025-05-16',
|
|
46
|
-
lastUpdated: '2025-05-16',
|
|
47
|
-
openWeights: false,
|
|
48
|
-
cost: {
|
|
49
|
-
input: 1.5,
|
|
50
|
-
output: 6,
|
|
51
|
-
cacheRead: 0.375,
|
|
52
|
-
},
|
|
53
|
-
limit: {
|
|
54
|
-
context: 200000,
|
|
55
|
-
output: 100000,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
32
|
{
|
|
59
33
|
id: 'gpt-3.5-turbo',
|
|
60
34
|
ownedBy: 'openai',
|
|
@@ -1752,7 +1726,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
1752
1726
|
reasoningText: true,
|
|
1753
1727
|
attachment: true,
|
|
1754
1728
|
temperature: true,
|
|
1755
|
-
knowledge: '2025-05',
|
|
1729
|
+
knowledge: '2025-05-31',
|
|
1756
1730
|
releaseDate: '2026-02-05',
|
|
1757
1731
|
lastUpdated: '2026-03-13',
|
|
1758
1732
|
openWeights: false,
|
|
@@ -1778,8 +1752,8 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
1778
1752
|
toolCall: true,
|
|
1779
1753
|
reasoningText: true,
|
|
1780
1754
|
attachment: true,
|
|
1781
|
-
temperature:
|
|
1782
|
-
knowledge: '2026-01',
|
|
1755
|
+
temperature: false,
|
|
1756
|
+
knowledge: '2026-01-31',
|
|
1783
1757
|
releaseDate: '2026-04-16',
|
|
1784
1758
|
lastUpdated: '2026-04-16',
|
|
1785
1759
|
openWeights: false,
|
|
@@ -1914,7 +1888,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
1914
1888
|
reasoningText: true,
|
|
1915
1889
|
attachment: true,
|
|
1916
1890
|
temperature: true,
|
|
1917
|
-
knowledge: '2025-08',
|
|
1891
|
+
knowledge: '2025-08-31',
|
|
1918
1892
|
releaseDate: '2026-02-17',
|
|
1919
1893
|
lastUpdated: '2026-03-13',
|
|
1920
1894
|
openWeights: false,
|
|
@@ -2086,7 +2060,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
2086
2060
|
cost: {
|
|
2087
2061
|
input: 0.3,
|
|
2088
2062
|
output: 2.5,
|
|
2089
|
-
cacheRead: 0.
|
|
2063
|
+
cacheRead: 0.03,
|
|
2090
2064
|
},
|
|
2091
2065
|
limit: {
|
|
2092
2066
|
context: 1048576,
|
|
@@ -2345,7 +2319,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
2345
2319
|
cost: {
|
|
2346
2320
|
input: 1.25,
|
|
2347
2321
|
output: 10,
|
|
2348
|
-
cacheRead: 0.
|
|
2322
|
+
cacheRead: 0.125,
|
|
2349
2323
|
},
|
|
2350
2324
|
limit: {
|
|
2351
2325
|
context: 1048576,
|
|
@@ -3060,7 +3034,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
3060
3034
|
reasoningText: true,
|
|
3061
3035
|
attachment: true,
|
|
3062
3036
|
temperature: true,
|
|
3063
|
-
knowledge: '2025-05-
|
|
3037
|
+
knowledge: '2025-05-31',
|
|
3064
3038
|
releaseDate: '2026-02-05',
|
|
3065
3039
|
lastUpdated: '2026-02-05',
|
|
3066
3040
|
openWeights: false,
|
|
@@ -3075,6 +3049,33 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
3075
3049
|
output: 128000,
|
|
3076
3050
|
},
|
|
3077
3051
|
},
|
|
3052
|
+
{
|
|
3053
|
+
id: 'anthropic/claude-opus-4.7',
|
|
3054
|
+
ownedBy: 'anthropic',
|
|
3055
|
+
label: 'Claude Opus 4.7',
|
|
3056
|
+
modalities: {
|
|
3057
|
+
input: ['text', 'image', 'pdf'],
|
|
3058
|
+
output: ['text'],
|
|
3059
|
+
},
|
|
3060
|
+
toolCall: true,
|
|
3061
|
+
reasoningText: true,
|
|
3062
|
+
attachment: true,
|
|
3063
|
+
temperature: false,
|
|
3064
|
+
knowledge: '2026-01-31',
|
|
3065
|
+
releaseDate: '2026-04-16',
|
|
3066
|
+
lastUpdated: '2026-04-16',
|
|
3067
|
+
openWeights: false,
|
|
3068
|
+
cost: {
|
|
3069
|
+
input: 5,
|
|
3070
|
+
output: 25,
|
|
3071
|
+
cacheRead: 0.5,
|
|
3072
|
+
cacheWrite: 6.25,
|
|
3073
|
+
},
|
|
3074
|
+
limit: {
|
|
3075
|
+
context: 1000000,
|
|
3076
|
+
output: 128000,
|
|
3077
|
+
},
|
|
3078
|
+
},
|
|
3078
3079
|
{
|
|
3079
3080
|
id: 'anthropic/claude-sonnet-4',
|
|
3080
3081
|
ownedBy: 'anthropic',
|
|
@@ -3141,6 +3142,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
3141
3142
|
reasoningText: true,
|
|
3142
3143
|
attachment: true,
|
|
3143
3144
|
temperature: true,
|
|
3145
|
+
knowledge: '2025-08-31',
|
|
3144
3146
|
releaseDate: '2026-02-17',
|
|
3145
3147
|
lastUpdated: '2026-02-17',
|
|
3146
3148
|
openWeights: false,
|
|
@@ -3687,7 +3689,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
3687
3689
|
cost: {
|
|
3688
3690
|
input: 1.25,
|
|
3689
3691
|
output: 10,
|
|
3690
|
-
cacheRead: 0.
|
|
3692
|
+
cacheRead: 0.125,
|
|
3691
3693
|
},
|
|
3692
3694
|
limit: {
|
|
3693
3695
|
context: 1048576,
|
|
@@ -7296,9 +7298,9 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
7296
7298
|
reasoningText: true,
|
|
7297
7299
|
attachment: true,
|
|
7298
7300
|
temperature: true,
|
|
7299
|
-
knowledge: '2025-
|
|
7301
|
+
knowledge: '2025-05-31',
|
|
7300
7302
|
releaseDate: '2026-02-05',
|
|
7301
|
-
lastUpdated: '2026-
|
|
7303
|
+
lastUpdated: '2026-03-13',
|
|
7302
7304
|
openWeights: false,
|
|
7303
7305
|
cost: {
|
|
7304
7306
|
input: 5,
|
|
@@ -7325,8 +7327,8 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
7325
7327
|
toolCall: true,
|
|
7326
7328
|
reasoningText: true,
|
|
7327
7329
|
attachment: true,
|
|
7328
|
-
temperature:
|
|
7329
|
-
knowledge: '2026-01',
|
|
7330
|
+
temperature: false,
|
|
7331
|
+
knowledge: '2026-01-31',
|
|
7330
7332
|
releaseDate: '2026-04-16',
|
|
7331
7333
|
lastUpdated: '2026-04-16',
|
|
7332
7334
|
openWeights: false,
|
|
@@ -7416,7 +7418,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
7416
7418
|
reasoningText: true,
|
|
7417
7419
|
attachment: true,
|
|
7418
7420
|
temperature: true,
|
|
7419
|
-
knowledge: '2025-
|
|
7421
|
+
knowledge: '2025-08-31',
|
|
7420
7422
|
releaseDate: '2026-02-17',
|
|
7421
7423
|
lastUpdated: '2026-02-17',
|
|
7422
7424
|
openWeights: false,
|
|
@@ -9689,7 +9691,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
9689
9691
|
reasoningText: true,
|
|
9690
9692
|
attachment: true,
|
|
9691
9693
|
temperature: true,
|
|
9692
|
-
knowledge: '2025-
|
|
9694
|
+
knowledge: '2025-05-31',
|
|
9693
9695
|
releaseDate: '2026-02-05',
|
|
9694
9696
|
lastUpdated: '2026-02-05',
|
|
9695
9697
|
openWeights: false,
|
|
@@ -9702,6 +9704,31 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
9702
9704
|
output: 64000,
|
|
9703
9705
|
},
|
|
9704
9706
|
},
|
|
9707
|
+
{
|
|
9708
|
+
id: 'claude-opus-4.7',
|
|
9709
|
+
ownedBy: 'anthropic',
|
|
9710
|
+
label: 'Claude Opus 4.7',
|
|
9711
|
+
modalities: {
|
|
9712
|
+
input: ['text', 'image'],
|
|
9713
|
+
output: ['text'],
|
|
9714
|
+
},
|
|
9715
|
+
toolCall: true,
|
|
9716
|
+
reasoningText: true,
|
|
9717
|
+
attachment: true,
|
|
9718
|
+
temperature: false,
|
|
9719
|
+
knowledge: '2026-01-31',
|
|
9720
|
+
releaseDate: '2026-04-16',
|
|
9721
|
+
lastUpdated: '2026-04-16',
|
|
9722
|
+
openWeights: false,
|
|
9723
|
+
cost: {
|
|
9724
|
+
input: 0,
|
|
9725
|
+
output: 0,
|
|
9726
|
+
},
|
|
9727
|
+
limit: {
|
|
9728
|
+
context: 144000,
|
|
9729
|
+
output: 64000,
|
|
9730
|
+
},
|
|
9731
|
+
},
|
|
9705
9732
|
{
|
|
9706
9733
|
id: 'claude-opus-41',
|
|
9707
9734
|
ownedBy: 'anthropic',
|
|
@@ -9789,6 +9816,7 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
|
|
|
9789
9816
|
reasoningText: true,
|
|
9790
9817
|
attachment: true,
|
|
9791
9818
|
temperature: true,
|
|
9819
|
+
knowledge: '2025-08-31',
|
|
9792
9820
|
releaseDate: '2026-02-17',
|
|
9793
9821
|
lastUpdated: '2026-02-17',
|
|
9794
9822
|
openWeights: false,
|
package/src/providers/src/env.ts
CHANGED
|
@@ -7,7 +7,7 @@ const ENV_VARS: Record<ProviderId, string> = {
|
|
|
7
7
|
openrouter: 'OPENROUTER_API_KEY',
|
|
8
8
|
opencode: 'OPENCODE_API_KEY',
|
|
9
9
|
copilot: 'GITHUB_TOKEN',
|
|
10
|
-
|
|
10
|
+
ottorouter: 'OTTOROUTER_PRIVATE_KEY',
|
|
11
11
|
zai: 'ZAI_API_KEY',
|
|
12
12
|
'zai-coding': 'ZAI_CODING_API_KEY',
|
|
13
13
|
moonshot: 'MOONSHOT_API_KEY',
|
|
@@ -25,22 +25,22 @@ export { validateProviderModel } from './validate.ts';
|
|
|
25
25
|
export { estimateModelCostUsd } from './pricing.ts';
|
|
26
26
|
export { providerEnvVar, readEnvKey, setEnvKey } from './env.ts';
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
createOttoRouter,
|
|
29
|
+
createOttoRouterFetch,
|
|
30
|
+
createOttoRouterModel,
|
|
31
|
+
fetchOttoRouterBalance,
|
|
32
32
|
getPublicKeyFromPrivate,
|
|
33
33
|
fetchSolanaUsdcBalance,
|
|
34
|
-
} from './
|
|
34
|
+
} from './ottorouter-client.ts';
|
|
35
35
|
export type {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
OttoRouterAuth,
|
|
37
|
+
OttoRouterInstance,
|
|
38
|
+
OttoRouterProviderOptions,
|
|
39
|
+
OttoRouterPaymentCallbacks,
|
|
40
|
+
OttoRouterBalanceUpdate,
|
|
41
|
+
OttoRouterBalanceResponse,
|
|
42
42
|
SolanaUsdcBalanceResponse,
|
|
43
|
-
} from './
|
|
43
|
+
} from './ottorouter-client.ts';
|
|
44
44
|
export {
|
|
45
45
|
createOpenAIOAuthFetch,
|
|
46
46
|
createOpenAIOAuthModel,
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
createOttoRouter,
|
|
3
3
|
fetchBalance,
|
|
4
4
|
fetchWalletUsdcBalance,
|
|
5
5
|
getPublicKeyFromPrivate as _getPublicKeyFromPrivate,
|
|
6
|
-
type
|
|
6
|
+
type OttoRouterConfig,
|
|
7
7
|
type PaymentCallbacks,
|
|
8
8
|
type BalanceUpdate,
|
|
9
9
|
type BalanceResponse,
|
|
10
10
|
type WalletUsdcBalance,
|
|
11
|
-
type
|
|
12
|
-
type
|
|
13
|
-
} from '@
|
|
11
|
+
type OttoRouterAuth as _OttoRouterAuth,
|
|
12
|
+
type OttoRouterInstance,
|
|
13
|
+
} from '@ottorouter/ai-sdk';
|
|
14
14
|
import type { LanguageModelV3Middleware } from '@ai-sdk/provider';
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type OttoRouterBalanceUpdate = BalanceUpdate;
|
|
17
17
|
|
|
18
|
-
export type
|
|
18
|
+
export type OttoRouterPaymentCallbacks = PaymentCallbacks;
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type OttoRouterProviderOptions = {
|
|
21
21
|
baseURL?: string;
|
|
22
22
|
rpcURL?: string;
|
|
23
23
|
network?: string;
|
|
24
24
|
maxRequestAttempts?: number;
|
|
25
25
|
maxPaymentAttempts?: number;
|
|
26
|
-
callbacks?:
|
|
26
|
+
callbacks?: OttoRouterPaymentCallbacks;
|
|
27
27
|
providerNpm?: string;
|
|
28
28
|
promptCacheKey?: string;
|
|
29
29
|
promptCacheRetention?: 'in_memory' | '24h';
|
|
@@ -32,33 +32,33 @@ export type SetuProviderOptions = {
|
|
|
32
32
|
middleware?: LanguageModelV3Middleware | LanguageModelV3Middleware[];
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export type
|
|
35
|
+
export type OttoRouterAuth = _OttoRouterAuth;
|
|
36
36
|
|
|
37
|
-
export type
|
|
37
|
+
export type OttoRouterBalanceResponse = BalanceResponse;
|
|
38
38
|
|
|
39
39
|
export type SolanaUsdcBalanceResponse = WalletUsdcBalance;
|
|
40
40
|
|
|
41
|
-
export function
|
|
42
|
-
auth:
|
|
43
|
-
options:
|
|
41
|
+
export function createOttoRouterFetch(
|
|
42
|
+
auth: OttoRouterAuth,
|
|
43
|
+
options: OttoRouterProviderOptions = {},
|
|
44
44
|
): typeof fetch {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
45
|
+
const ottorouter = createOttoRouter(buildOttoRouterConfig(auth, options));
|
|
46
|
+
return ottorouter.fetch() as typeof fetch;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export function
|
|
49
|
+
export function createOttoRouterModel(
|
|
50
50
|
model: string,
|
|
51
|
-
auth:
|
|
52
|
-
options:
|
|
51
|
+
auth: OttoRouterAuth,
|
|
52
|
+
options: OttoRouterProviderOptions = {},
|
|
53
53
|
) {
|
|
54
|
-
const
|
|
55
|
-
return
|
|
54
|
+
const ottorouter = createOttoRouter(buildOttoRouterConfig(auth, options));
|
|
55
|
+
return ottorouter.model(model);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function
|
|
59
|
-
auth:
|
|
60
|
-
options:
|
|
61
|
-
):
|
|
58
|
+
function buildOttoRouterConfig(
|
|
59
|
+
auth: OttoRouterAuth,
|
|
60
|
+
options: OttoRouterProviderOptions = {},
|
|
61
|
+
): OttoRouterConfig {
|
|
62
62
|
return {
|
|
63
63
|
auth,
|
|
64
64
|
baseURL: options.baseURL,
|
|
@@ -78,10 +78,10 @@ function buildSetuConfig(
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export async function
|
|
82
|
-
auth:
|
|
81
|
+
export async function fetchOttoRouterBalance(
|
|
82
|
+
auth: OttoRouterAuth,
|
|
83
83
|
baseURL?: string,
|
|
84
|
-
): Promise<
|
|
84
|
+
): Promise<OttoRouterBalanceResponse | null> {
|
|
85
85
|
return fetchBalance(auth, baseURL);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -90,7 +90,7 @@ export function getPublicKeyFromPrivate(privateKey: string): string | null {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export async function fetchSolanaUsdcBalance(
|
|
93
|
-
auth:
|
|
93
|
+
auth: OttoRouterAuth,
|
|
94
94
|
network: 'mainnet' | 'devnet' = 'mainnet',
|
|
95
95
|
): Promise<SolanaUsdcBalanceResponse | null> {
|
|
96
96
|
if (auth.privateKey) {
|
|
@@ -105,4 +105,4 @@ export async function fetchSolanaUsdcBalance(
|
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export {
|
|
108
|
+
export { createOttoRouter, type OttoRouterInstance };
|
|
@@ -34,7 +34,7 @@ const PREFERRED_FAST_MODELS: Partial<Record<ProviderId, string[]>> = {
|
|
|
34
34
|
google: ['gemini-2.0-flash-lite'],
|
|
35
35
|
openrouter: ['anthropic/claude-3.5-haiku'],
|
|
36
36
|
opencode: ['claude-3-5-haiku'],
|
|
37
|
-
|
|
37
|
+
ottorouter: ['kimi-k2-turbo-preview'],
|
|
38
38
|
zai: ['glm-4.5-flash'],
|
|
39
39
|
copilot: ['gpt-4.1-mini'],
|
|
40
40
|
};
|