@theokit/sdk 4.13.1 → 4.14.0
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/CHANGELOG.md +6 -0
- package/dist/{cron-C7catiH8.d.ts → cron-DY0uC1ng.d.ts} +7 -0
- package/dist/{cron-DK1WVZnI.d.cts → cron-ElTj1cSH.d.cts} +7 -0
- package/dist/cron.cjs +134 -8
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +134 -8
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +134 -8
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +134 -8
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +134 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +134 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/openai.d.ts +1 -0
- package/dist/internal/providers/builtin/cerebras.d.ts +5 -0
- package/dist/internal/providers/builtin/cohere.d.ts +6 -0
- package/dist/internal/providers/builtin/deepinfra.d.ts +2 -0
- package/dist/internal/providers/builtin/google.d.ts +6 -0
- package/dist/internal/providers/builtin/groq.d.ts +2 -0
- package/dist/internal/providers/builtin/mistral.d.ts +2 -0
- package/dist/internal/providers/builtin/openai-compatible.d.ts +1 -0
- package/dist/internal/providers/builtin/perplexity.d.ts +5 -0
- package/dist/internal/providers/builtin/together.d.ts +2 -0
- package/dist/internal/providers/builtin/xai.d.ts +2 -0
- package/dist/models.cjs +116 -2
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +116 -2
- package/dist/models.js.map +1 -1
- package/dist/provider-catalog.json +467 -143
- package/dist/types/provider-profile.d.ts +7 -0
- package/package.json +1 -1
package/dist/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
|
@@ -11404,7 +11404,13 @@ var ANTHROPIC = {
|
|
|
11404
11404
|
baseUrl: "https://api.anthropic.com",
|
|
11405
11405
|
modelsUrl: "https://api.anthropic.com/v1/models",
|
|
11406
11406
|
hostname: "api.anthropic.com",
|
|
11407
|
-
fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"]
|
|
11407
|
+
fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"],
|
|
11408
|
+
// M45 — the Anthropic beta-features header (interleaved thinking + fine-grained tool streaming). An
|
|
11409
|
+
// Anthropic API constant, adapted verbatim from OpenCode's anthropic plugin (MIT © 2025 opencode). The
|
|
11410
|
+
// SANCTIONED behavior delta of M45 (ADR D4) — consumed by the anthropic transport's extraHeaders wiring.
|
|
11411
|
+
extraHeaders: {
|
|
11412
|
+
"anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"
|
|
11413
|
+
}
|
|
11408
11414
|
};
|
|
11409
11415
|
|
|
11410
11416
|
// src/internal/providers/builtin/bedrock.ts
|
|
@@ -11439,6 +11445,101 @@ function resolveBedrockBaseUrl(modelId) {
|
|
|
11439
11445
|
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
11440
11446
|
}
|
|
11441
11447
|
|
|
11448
|
+
// src/internal/providers/builtin/openai-compatible.ts
|
|
11449
|
+
function openAiCompatibleProfile(p) {
|
|
11450
|
+
return {
|
|
11451
|
+
apiMode: "chat_completions",
|
|
11452
|
+
authType: "api_key",
|
|
11453
|
+
fallbackModels: [],
|
|
11454
|
+
...p
|
|
11455
|
+
};
|
|
11456
|
+
}
|
|
11457
|
+
|
|
11458
|
+
// src/internal/providers/builtin/cerebras.ts
|
|
11459
|
+
var CEREBRAS = openAiCompatibleProfile({
|
|
11460
|
+
name: "cerebras",
|
|
11461
|
+
baseUrl: "https://api.cerebras.ai/v1",
|
|
11462
|
+
envVars: ["CEREBRAS_API_KEY"],
|
|
11463
|
+
fallbackModels: ["gpt-oss-120b", "zai-glm-4.7"],
|
|
11464
|
+
extraHeaders: { "X-Cerebras-3rd-Party-Integration": "theokit" },
|
|
11465
|
+
hostname: "api.cerebras.ai"
|
|
11466
|
+
});
|
|
11467
|
+
|
|
11468
|
+
// src/internal/providers/builtin/cohere.ts
|
|
11469
|
+
var COHERE = openAiCompatibleProfile({
|
|
11470
|
+
name: "cohere",
|
|
11471
|
+
baseUrl: "https://api.cohere.ai/compatibility/v1",
|
|
11472
|
+
envVars: ["COHERE_API_KEY", "CO_API_KEY"],
|
|
11473
|
+
fallbackModels: ["command-a-03-2025"],
|
|
11474
|
+
hostname: "api.cohere.ai"
|
|
11475
|
+
});
|
|
11476
|
+
|
|
11477
|
+
// src/internal/providers/builtin/deepinfra.ts
|
|
11478
|
+
var DEEPINFRA = openAiCompatibleProfile({
|
|
11479
|
+
name: "deepinfra",
|
|
11480
|
+
baseUrl: "https://api.deepinfra.com/v1/openai",
|
|
11481
|
+
envVars: ["DEEPINFRA_API_KEY"],
|
|
11482
|
+
fallbackModels: ["Qwen/Qwen3-32B"],
|
|
11483
|
+
hostname: "api.deepinfra.com"
|
|
11484
|
+
});
|
|
11485
|
+
|
|
11486
|
+
// src/internal/providers/builtin/google.ts
|
|
11487
|
+
var GOOGLE = openAiCompatibleProfile({
|
|
11488
|
+
name: "google",
|
|
11489
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
11490
|
+
envVars: ["GOOGLE_API_KEY", "GEMINI_API_KEY"],
|
|
11491
|
+
fallbackModels: ["gemini-2.5-pro", "gemini-2.5-flash"],
|
|
11492
|
+
hostname: "generativelanguage.googleapis.com"
|
|
11493
|
+
});
|
|
11494
|
+
|
|
11495
|
+
// src/internal/providers/builtin/groq.ts
|
|
11496
|
+
var GROQ = openAiCompatibleProfile({
|
|
11497
|
+
name: "groq",
|
|
11498
|
+
baseUrl: "https://api.groq.com/openai/v1",
|
|
11499
|
+
envVars: ["GROQ_API_KEY"],
|
|
11500
|
+
fallbackModels: ["llama-3.3-70b-versatile", "llama-3.1-8b-instant"],
|
|
11501
|
+
hostname: "api.groq.com"
|
|
11502
|
+
});
|
|
11503
|
+
|
|
11504
|
+
// src/internal/providers/builtin/mistral.ts
|
|
11505
|
+
var MISTRAL = openAiCompatibleProfile({
|
|
11506
|
+
name: "mistral",
|
|
11507
|
+
baseUrl: "https://api.mistral.ai/v1",
|
|
11508
|
+
envVars: ["MISTRAL_API_KEY"],
|
|
11509
|
+
fallbackModels: ["mistral-large-latest", "codestral-latest"],
|
|
11510
|
+
hostname: "api.mistral.ai"
|
|
11511
|
+
});
|
|
11512
|
+
|
|
11513
|
+
// src/internal/providers/builtin/perplexity.ts
|
|
11514
|
+
var PERPLEXITY = openAiCompatibleProfile({
|
|
11515
|
+
name: "perplexity",
|
|
11516
|
+
baseUrl: "https://api.perplexity.ai",
|
|
11517
|
+
chatCompletionsPath: "/chat/completions",
|
|
11518
|
+
envVars: ["PERPLEXITY_API_KEY"],
|
|
11519
|
+
fallbackModels: ["sonar-pro", "sonar"],
|
|
11520
|
+
hostname: "api.perplexity.ai"
|
|
11521
|
+
});
|
|
11522
|
+
|
|
11523
|
+
// src/internal/providers/builtin/together.ts
|
|
11524
|
+
var TOGETHER = openAiCompatibleProfile({
|
|
11525
|
+
name: "together",
|
|
11526
|
+
aliases: ["togetherai"],
|
|
11527
|
+
baseUrl: "https://api.together.xyz/v1",
|
|
11528
|
+
envVars: ["TOGETHER_API_KEY"],
|
|
11529
|
+
fallbackModels: ["Qwen/Qwen2.5-7B-Instruct-Turbo"],
|
|
11530
|
+
hostname: "api.together.xyz"
|
|
11531
|
+
});
|
|
11532
|
+
|
|
11533
|
+
// src/internal/providers/builtin/xai.ts
|
|
11534
|
+
var XAI = openAiCompatibleProfile({
|
|
11535
|
+
name: "xai",
|
|
11536
|
+
aliases: ["grok"],
|
|
11537
|
+
baseUrl: "https://api.x.ai/v1",
|
|
11538
|
+
envVars: ["XAI_API_KEY"],
|
|
11539
|
+
fallbackModels: ["grok-4.5", "grok-4.3"],
|
|
11540
|
+
hostname: "api.x.ai"
|
|
11541
|
+
});
|
|
11542
|
+
|
|
11442
11543
|
// src/internal/providers/builtin/gemini.ts
|
|
11443
11544
|
var GEMINI = {
|
|
11444
11545
|
name: "gemini",
|
|
@@ -11863,7 +11964,11 @@ var OPENROUTER = {
|
|
|
11863
11964
|
baseUrl: "https://openrouter.ai/api",
|
|
11864
11965
|
modelsUrl: "https://openrouter.ai/api/v1/models",
|
|
11865
11966
|
hostname: "openrouter.ai",
|
|
11866
|
-
|
|
11967
|
+
// M45 — models refreshed (claude-3-haiku retired upstream).
|
|
11968
|
+
fallbackModels: ["openai/gpt-4o-mini", "anthropic/claude-haiku-4-5"],
|
|
11969
|
+
// M45 — OpenRouter app-attribution headers (mechanism from OpenCode's openrouter plugin, MIT; VALUES are
|
|
11970
|
+
// theokit's own — copying another app's referer would misattribute traffic).
|
|
11971
|
+
extraHeaders: { "HTTP-Referer": "https://usetheo.dev", "X-Title": "theokit" }
|
|
11867
11972
|
};
|
|
11868
11973
|
|
|
11869
11974
|
// src/internal/providers/builtin/vertex.ts
|
|
@@ -11912,6 +12017,15 @@ function registerBuiltins() {
|
|
|
11912
12017
|
registerProvider(LLAMACPP);
|
|
11913
12018
|
registerProvider(BEDROCK);
|
|
11914
12019
|
registerProvider(VERTEX);
|
|
12020
|
+
registerProvider(GOOGLE);
|
|
12021
|
+
registerProvider(MISTRAL);
|
|
12022
|
+
registerProvider(GROQ);
|
|
12023
|
+
registerProvider(COHERE);
|
|
12024
|
+
registerProvider(DEEPINFRA);
|
|
12025
|
+
registerProvider(TOGETHER);
|
|
12026
|
+
registerProvider(XAI);
|
|
12027
|
+
registerProvider(PERPLEXITY);
|
|
12028
|
+
registerProvider(CEREBRAS);
|
|
11915
12029
|
registerCatalogProviders();
|
|
11916
12030
|
}
|
|
11917
12031
|
|
|
@@ -12179,14 +12293,16 @@ var AnthropicClient = class {
|
|
|
12179
12293
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
|
|
12180
12294
|
async *stream(request, signal) {
|
|
12181
12295
|
const body = buildAnthropicBody(request);
|
|
12296
|
+
const headers = {
|
|
12297
|
+
"content-type": "application/json",
|
|
12298
|
+
"x-api-key": this.options.apiKey,
|
|
12299
|
+
"anthropic-version": this.options.version ?? "2023-06-01"
|
|
12300
|
+
};
|
|
12301
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
12182
12302
|
const response = await this.fetchImpl(`${this.baseUrl}/v1/messages`, {
|
|
12183
12303
|
method: "POST",
|
|
12184
12304
|
signal,
|
|
12185
|
-
headers
|
|
12186
|
-
"content-type": "application/json",
|
|
12187
|
-
"x-api-key": this.options.apiKey,
|
|
12188
|
-
"anthropic-version": this.options.version ?? "2023-06-01"
|
|
12189
|
-
},
|
|
12305
|
+
headers,
|
|
12190
12306
|
body: JSON.stringify(body)
|
|
12191
12307
|
});
|
|
12192
12308
|
if (!response.ok) {
|
|
@@ -13063,11 +13179,13 @@ var OpenAIClient = class {
|
|
|
13063
13179
|
constructor(options) {
|
|
13064
13180
|
this.options = options;
|
|
13065
13181
|
this.baseUrl = options.baseUrl ?? "https://api.openai.com";
|
|
13182
|
+
this.chatPath = options.chatCompletionsPath ?? (/\/v\d+[a-z]*(\/|$)/.test(new URL(this.baseUrl).pathname) ? "/chat/completions" : "/v1/chat/completions");
|
|
13066
13183
|
this.fetchImpl = options.fetch ?? fetch;
|
|
13067
13184
|
}
|
|
13068
13185
|
options;
|
|
13069
13186
|
name = "openai";
|
|
13070
13187
|
baseUrl;
|
|
13188
|
+
chatPath;
|
|
13071
13189
|
fetchImpl;
|
|
13072
13190
|
/**
|
|
13073
13191
|
* Whether this client recovers leaked Hermes tool-call dialect from assistant
|
|
@@ -13090,7 +13208,7 @@ var OpenAIClient = class {
|
|
|
13090
13208
|
const providerId = this.options.providerName ?? this.name;
|
|
13091
13209
|
let response;
|
|
13092
13210
|
try {
|
|
13093
|
-
response = await this.fetchImpl(`${this.baseUrl}
|
|
13211
|
+
response = await this.fetchImpl(`${this.baseUrl}${this.chatPath}`, {
|
|
13094
13212
|
method: "POST",
|
|
13095
13213
|
signal,
|
|
13096
13214
|
headers,
|
|
@@ -14187,6 +14305,9 @@ function selectTransport(profile, apiKey) {
|
|
|
14187
14305
|
if (profile.extractToolCallsFromContent === true) {
|
|
14188
14306
|
opts.extractToolCallsFromContent = true;
|
|
14189
14307
|
}
|
|
14308
|
+
if (profile.chatCompletionsPath !== void 0) {
|
|
14309
|
+
opts.chatCompletionsPath = profile.chatCompletionsPath;
|
|
14310
|
+
}
|
|
14190
14311
|
if (profile.name === "openai" && process.env.OPENAI_ORGANIZATION !== void 0) {
|
|
14191
14312
|
opts.organization = process.env.OPENAI_ORGANIZATION;
|
|
14192
14313
|
}
|
|
@@ -14206,6 +14327,11 @@ function selectTransport(profile, apiKey) {
|
|
|
14206
14327
|
}
|
|
14207
14328
|
const opts = { apiKey };
|
|
14208
14329
|
opts.baseUrl = process.env.ANTHROPIC_API_BASE_URL ?? profile.baseUrl;
|
|
14330
|
+
const t = applyTransform();
|
|
14331
|
+
assertOAuthResolved(t);
|
|
14332
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
14333
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
14334
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
14209
14335
|
return new AnthropicClient(opts);
|
|
14210
14336
|
}
|
|
14211
14337
|
if (profile.apiMode === "bedrock_anthropic") {
|