@absolutejs/ai 0.2.2 → 0.2.4
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 +12 -0
- package/changelog.json +31 -0
- package/dist/ai/index.js +154 -15
- package/dist/ai/index.js.map +8 -7
- package/dist/ai/models/index.js +70 -2
- package/dist/ai/models/index.js.map +5 -4
- package/dist/ai/providers/anthropic.js +111 -5
- package/dist/ai/providers/anthropic.js.map +6 -5
- package/dist/ai/providers/gemini.js +210 -3
- package/dist/ai/providers/gemini.js.map +6 -4
- package/dist/ai/providers/openai.js +144 -10
- package/dist/ai/providers/openai.js.map +6 -5
- package/dist/ai/providers/openaiCompatible.js +146 -12
- package/dist/ai/providers/openaiCompatible.js.map +6 -5
- package/dist/ai/providers/openaiResponses.js +108 -4
- package/dist/ai/providers/openaiResponses.js.map +5 -4
- package/dist/ai/providers/openrouter.js +147 -11
- package/dist/ai/providers/openrouter.js.map +7 -6
- package/dist/src/ai/models/index.d.ts +1 -0
- package/dist/src/ai/models/reasoning.d.ts +15 -0
- package/dist/src/ai/providers/reasoning.d.ts +3 -0
- package/dist/types/ai.d.ts +1 -1
- package/package.json +1 -1
package/dist/ai/models/index.js
CHANGED
|
@@ -343,6 +343,68 @@ var MODEL_METADATA = {
|
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
var getModelMetadata = (provider, id) => MODEL_METADATA[`${provider}:${id}`];
|
|
346
|
+
// src/ai/models/reasoning.ts
|
|
347
|
+
var REASONING_EFFORTS = [
|
|
348
|
+
"none",
|
|
349
|
+
"minimal",
|
|
350
|
+
"low",
|
|
351
|
+
"medium",
|
|
352
|
+
"high",
|
|
353
|
+
"xhigh",
|
|
354
|
+
"max"
|
|
355
|
+
];
|
|
356
|
+
var isReasoningSelection = (value) => value === "auto" || REASONING_EFFORTS.some((effort) => effort === value);
|
|
357
|
+
var profile = (kind, efforts, description, source) => ({ kind, efforts, description, source });
|
|
358
|
+
var claude = profile("effort", ["low", "medium", "high", "xhigh", "max"], "More thinking for harder problems; higher settings can take longer and use more credits.", "https://platform.claude.com/docs/en/build-with-claude/effort");
|
|
359
|
+
var claude46 = {
|
|
360
|
+
...claude,
|
|
361
|
+
efforts: ["low", "medium", "high", "max"]
|
|
362
|
+
};
|
|
363
|
+
var haiku = profile("budget", ["none", "low", "medium", "high"], "Thinking-token budget: Low 2,048; Medium 8,192; High 16,384. Actual usage can be lower.", "https://platform.claude.com/docs/en/build-with-claude/extended-thinking");
|
|
364
|
+
var gpt = profile("effort", ["none", "low", "medium", "high", "xhigh", "max"], claude.description, "https://developers.openai.com/api/docs/models/gpt-5.6-sol");
|
|
365
|
+
var gemini = profile("effort", ["low", "medium", "high"], claude.description, "https://ai.google.dev/gemini-api/docs/openai");
|
|
366
|
+
var deepseek = profile("effort", ["none", "low", "high", "max"], claude.description, "https://api-docs.deepseek.com/guides/thinking_mode/");
|
|
367
|
+
var mistral = profile("effort", ["none", "high"], "Minimal thinking or full reasoning. This model does not offer intermediate effort levels.", "https://docs.mistral.ai/studio/conversations/reasoning");
|
|
368
|
+
var qwen = profile("budget", ["none", "low", "medium", "high"], haiku.description, "https://help.aliyun.com/en/model-studio/deep-thinking");
|
|
369
|
+
var MODEL_REASONING = {
|
|
370
|
+
"anthropic:claude-fable-5-1": claude,
|
|
371
|
+
"anthropic:claude-opus-5": claude,
|
|
372
|
+
"anthropic:claude-sonnet-5": claude,
|
|
373
|
+
"anthropic:claude-sonnet-4-6": claude46,
|
|
374
|
+
"anthropic:claude-opus-4-6": claude46,
|
|
375
|
+
"anthropic:claude-haiku-4-5": haiku,
|
|
376
|
+
"openai:gpt-6-astra": {
|
|
377
|
+
...gpt,
|
|
378
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
379
|
+
source: "https://developers.openai.com/api/docs/models/gpt-6-astra"
|
|
380
|
+
},
|
|
381
|
+
"openai:gpt-5.6-sol": gpt,
|
|
382
|
+
"openai:gpt-5.6-terra": gpt,
|
|
383
|
+
"openai:gpt-5.6-luna": gpt,
|
|
384
|
+
"google:gemini-3.8-flash": gemini,
|
|
385
|
+
"google:gemini-3.1-pro-preview": gemini,
|
|
386
|
+
"google:gemini-2.5-flash": profile("budget", ["none", "low", "medium", "high"], "Thinking-token budget: Low 1,024; Medium 8,192; High 24,576.", gemini.source),
|
|
387
|
+
"xai:grok-4.6": profile("effort", ["low", "medium", "high", "xhigh"], "Always reasons. Choose how much thinking it should do.", "https://docs.x.ai/developers/model-capabilities/text/reasoning"),
|
|
388
|
+
"deepseek:deepseek-flash": deepseek,
|
|
389
|
+
"deepseek:deepseek-v4-pro": deepseek,
|
|
390
|
+
"mistral:mistral-medium-3-5": mistral,
|
|
391
|
+
"mistral:mistral-small-latest": mistral,
|
|
392
|
+
"alibaba:qwen3.8-max": qwen,
|
|
393
|
+
"alibaba:qwen3.7-plus": qwen,
|
|
394
|
+
"moonshot:kimi-k3": profile("effort", ["low", "high", "max"], "Always reasons. Choose how much thinking it should do.", "https://platform.kimi.ai/docs/guide/kimi-k3-quickstart"),
|
|
395
|
+
"moonshot:kimi-k2.7-code": profile("fixed", [], "Thinking is always enabled; this model has no documented adjustable effort control.", "https://www.kimi.ai/resources/kimi-k2-7-code")
|
|
396
|
+
};
|
|
397
|
+
var getModelReasoning = (provider, model) => MODEL_REASONING[`${provider}:${model}`];
|
|
398
|
+
var supportsReasoningSelection = (provider, model, selection) => selection === "auto" || Boolean(getModelReasoning(provider, model)?.efforts.includes(selection));
|
|
399
|
+
var reasoningSelectionLabel = (selection, provider) => {
|
|
400
|
+
if (selection === "auto")
|
|
401
|
+
return "Auto";
|
|
402
|
+
if (selection === "none")
|
|
403
|
+
return provider === "mistral" ? "Minimal" : "Off";
|
|
404
|
+
if (selection === "xhigh")
|
|
405
|
+
return "Extra high";
|
|
406
|
+
return selection.charAt(0).toUpperCase() + selection.slice(1);
|
|
407
|
+
};
|
|
346
408
|
|
|
347
409
|
// src/ai/models/index.ts
|
|
348
410
|
var MODEL_CAPABILITY_DESCRIPTIONS = {
|
|
@@ -402,9 +464,15 @@ var modelCapabilities = (metadata) => {
|
|
|
402
464
|
export {
|
|
403
465
|
MODEL_CAPABILITY_DESCRIPTIONS,
|
|
404
466
|
MODEL_METADATA,
|
|
467
|
+
MODEL_REASONING,
|
|
468
|
+
REASONING_EFFORTS,
|
|
405
469
|
getModelMetadata,
|
|
406
|
-
|
|
470
|
+
getModelReasoning,
|
|
471
|
+
isReasoningSelection,
|
|
472
|
+
modelCapabilities,
|
|
473
|
+
reasoningSelectionLabel,
|
|
474
|
+
supportsReasoningSelection
|
|
407
475
|
};
|
|
408
476
|
|
|
409
|
-
//# debugId=
|
|
477
|
+
//# debugId=FE98AA17F4CDF80C64756E2164756E21
|
|
410
478
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/ai/models/catalog.ts", "../src/ai/models/index.ts"],
|
|
3
|
+
"sources": ["../src/ai/models/catalog.ts", "../src/ai/models/reasoning.ts", "../src/ai/models/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { ModelMetadata } from \"./index\";\n\n/** Reviewed provider support, independent of application feature availability. */\nexport const MODEL_METADATA: Readonly<Record<string, ModelMetadata>> = {\n \"anthropic:claude-fable-5-1\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\n \"https://platform.claude.com/docs/en/models/overview\",\n \"https://platform.claude.com/docs/en/build-with-claude/pdf-support\",\n \"https://platform.claude.com/docs/en/build-with-claude/structured-outputs\",\n \"https://platform.claude.com/docs/en/build-with-claude/prompt-caching\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"anthropic:claude-opus-5\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\n \"https://platform.claude.com/docs/en/models/overview\",\n \"https://platform.claude.com/docs/en/build-with-claude/pdf-support\",\n \"https://platform.claude.com/docs/en/build-with-claude/structured-outputs\",\n \"https://platform.claude.com/docs/en/build-with-claude/prompt-caching\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"anthropic:claude-sonnet-5\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\n \"https://platform.claude.com/docs/en/models/overview\",\n \"https://platform.claude.com/docs/en/build-with-claude/pdf-support\",\n \"https://platform.claude.com/docs/en/build-with-claude/structured-outputs\",\n \"https://platform.claude.com/docs/en/build-with-claude/prompt-caching\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"anthropic:claude-haiku-4-5\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\", \"prompt-cache\"],\n contextWindow: 200000,\n sources: [\n \"https://platform.claude.com/docs/en/models/overview\",\n \"https://platform.claude.com/docs/en/build-with-claude/pdf-support\",\n \"https://platform.claude.com/docs/en/build-with-claude/structured-outputs\",\n \"https://platform.claude.com/docs/en/build-with-claude/prompt-caching\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"anthropic:claude-opus-4-6\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\", \"prompt-cache\"],\n sources: [\n \"https://platform.claude.com/docs/en/models/overview\",\n \"https://platform.claude.com/docs/en/build-with-claude/pdf-support\",\n \"https://platform.claude.com/docs/en/build-with-claude/structured-outputs\",\n \"https://platform.claude.com/docs/en/build-with-claude/prompt-caching\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"anthropic:claude-sonnet-4-6\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\", \"prompt-cache\"],\n sources: [\n \"https://platform.claude.com/docs/en/models/overview\",\n \"https://platform.claude.com/docs/en/build-with-claude/pdf-support\",\n \"https://platform.claude.com/docs/en/build-with-claude/structured-outputs\",\n \"https://platform.claude.com/docs/en/build-with-claude/prompt-caching\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"openai:gpt-6-astra\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1050000,\n sources: [\n \"https://developers.openai.com/api/docs/models/gpt-6-astra\",\n \"https://developers.openai.com/api/docs/guides/pdf-files\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"openai:gpt-5.6-sol\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1050000,\n sources: [\n \"https://developers.openai.com/api/docs/models/gpt-5.6-sol\",\n \"https://developers.openai.com/api/docs/guides/pdf-files\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"openai:gpt-5.6-terra\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1050000,\n sources: [\n \"https://developers.openai.com/api/docs/models/gpt-5.6-terra\",\n \"https://developers.openai.com/api/docs/guides/pdf-files\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"openai:gpt-5.6-luna\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1050000,\n sources: [\n \"https://developers.openai.com/api/docs/models/gpt-5.6-luna\",\n \"https://developers.openai.com/api/docs/guides/pdf-files\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"google:gemini-3.8-flash\": {\n input: [\"text\", \"image\", \"pdf\", \"audio\", \"video\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1048576,\n sources: [\"https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash\"],\n reviewedAt: \"2026-09-20\",\n },\n \"google:gemini-3.1-pro-preview\": {\n input: [\"text\", \"image\", \"pdf\", \"audio\", \"video\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1048576,\n sources: [\n \"https://ai.google.dev/gemini-api/docs/models/gemini-3.1-pro-preview\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"google:gemini-2.5-flash\": {\n input: [\"text\", \"image\", \"pdf\", \"audio\", \"video\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 1048576,\n sources: [\"https://ai.google.dev/gemini-api/docs/models/gemini-2.5-flash\"],\n reviewedAt: \"2026-09-20\",\n },\n \"xai:grok-4.6\": {\n input: [\"text\", \"image\"],\n output: [\"text\"],\n features: [\n \"reasoning\",\n \"tools\",\n \"structured-output\",\n \"prompt-cache\",\n \"web-search\",\n ],\n contextWindow: 500000,\n sources: [\n \"https://docs.x.ai/developers/grok-4-6\",\n \"https://docs.x.ai/developers/model-capabilities/text/structured-outputs\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"deepseek:deepseek-flash\": {\n input: [\"text\", \"image\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\"https://api-docs.deepseek.com/quick_start/pricing/\"],\n reviewedAt: \"2026-09-20\",\n },\n \"deepseek:deepseek-v4-pro\": {\n input: [\"text\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\"https://api-docs.deepseek.com/quick_start/pricing/\"],\n reviewedAt: \"2026-09-20\",\n },\n \"mistral:mistral-medium-3-5\": {\n input: [\"text\", \"image\", \"pdf\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"structured-output\"],\n contextWindow: 256000,\n sources: [\"https://docs.mistral.ai/models/mistral-medium-3-5-26-04\"],\n reviewedAt: \"2026-09-20\",\n },\n \"moonshot:kimi-k3\": {\n input: [\"text\", \"image\", \"video\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\"https://platform.kimi.ai/docs/guide/kimi-k3-quickstart\"],\n reviewedAt: \"2026-09-20\",\n },\n \"moonshot:kimi-k2.7-code\": {\n input: [\"text\", \"image\", \"video\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"prompt-cache\"],\n contextWindow: 262144,\n sources: [\"https://www.kimi.ai/resources/kimi-k2-7-code\"],\n reviewedAt: \"2026-09-20\",\n },\n \"meta:Llama-4-Maverick-17B-128E-Instruct-FP8\": {\n input: [\"text\", \"image\"],\n output: [\"text\"],\n features: [\"tools\"],\n contextWindow: 1000000,\n sources: [\n \"https://github.com/meta-llama/llama-models/blob/main/models/llama4/MODEL_CARD.md\",\n ],\n reviewedAt: \"2026-09-20\",\n },\n \"alibaba:qwen3.8-max\": {\n input: [\"text\", \"image\", \"video\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\"https://help.aliyun.com/en/model-studio/qwen3-8-max\"],\n reviewedAt: \"2026-09-20\",\n },\n \"alibaba:qwen3.7-plus\": {\n input: [\"text\", \"image\", \"video\"],\n output: [\"text\"],\n features: [\"reasoning\", \"tools\", \"prompt-cache\"],\n contextWindow: 1000000,\n sources: [\"https://help.aliyun.com/en/model-studio/qwen3-7-plus\"],\n reviewedAt: \"2026-09-20\",\n },\n};\n\nexport const getModelMetadata = (\n provider: string,\n id: string,\n): ModelMetadata | undefined => MODEL_METADATA[`${provider}:${id}`];\n",
|
|
6
|
-
"
|
|
6
|
+
"import type { ReasoningEffort } from \"../../../types/ai\";\n\nexport const REASONING_EFFORTS = [\n \"none\",\n \"minimal\",\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n \"max\",\n] as const;\nexport type ReasoningSelection = \"auto\" | ReasoningEffort;\nexport type ModelReasoning = {\n kind: \"effort\" | \"budget\" | \"fixed\";\n efforts: readonly ReasoningEffort[];\n description: string;\n source: string;\n};\nexport const isReasoningSelection = (\n value: unknown,\n): value is ReasoningSelection =>\n value === \"auto\" || REASONING_EFFORTS.some((effort) => effort === value);\nconst profile = (\n kind: ModelReasoning[\"kind\"],\n efforts: readonly ReasoningEffort[],\n description: string,\n source: string,\n): ModelReasoning => ({ kind, efforts, description, source });\nconst claude = profile(\n \"effort\",\n [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n \"More thinking for harder problems; higher settings can take longer and use more credits.\",\n \"https://platform.claude.com/docs/en/build-with-claude/effort\",\n);\nconst claude46 = {\n ...claude,\n efforts: [\"low\", \"medium\", \"high\", \"max\"] as const,\n};\nconst haiku = profile(\n \"budget\",\n [\"none\", \"low\", \"medium\", \"high\"],\n \"Thinking-token budget: Low 2,048; Medium 8,192; High 16,384. Actual usage can be lower.\",\n \"https://platform.claude.com/docs/en/build-with-claude/extended-thinking\",\n);\nconst gpt = profile(\n \"effort\",\n [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n claude.description,\n \"https://developers.openai.com/api/docs/models/gpt-5.6-sol\",\n);\nconst gemini = profile(\n \"effort\",\n [\"low\", \"medium\", \"high\"],\n claude.description,\n \"https://ai.google.dev/gemini-api/docs/openai\",\n);\nconst deepseek = profile(\n \"effort\",\n [\"none\", \"low\", \"high\", \"max\"],\n claude.description,\n \"https://api-docs.deepseek.com/guides/thinking_mode/\",\n);\nconst mistral = profile(\n \"effort\",\n [\"none\", \"high\"],\n \"Minimal thinking or full reasoning. This model does not offer intermediate effort levels.\",\n \"https://docs.mistral.ai/studio/conversations/reasoning\",\n);\nconst qwen = profile(\n \"budget\",\n [\"none\", \"low\", \"medium\", \"high\"],\n haiku.description,\n \"https://help.aliyun.com/en/model-studio/deep-thinking\",\n);\n/** Exact reviewed IDs; unknown models expose only the provider default. Reviewed 2026-09-20. */\nexport const MODEL_REASONING: Readonly<Record<string, ModelReasoning>> = {\n \"anthropic:claude-fable-5-1\": claude,\n \"anthropic:claude-opus-5\": claude,\n \"anthropic:claude-sonnet-5\": claude,\n \"anthropic:claude-sonnet-4-6\": claude46,\n \"anthropic:claude-opus-4-6\": claude46,\n \"anthropic:claude-haiku-4-5\": haiku,\n \"openai:gpt-6-astra\": {\n ...gpt,\n efforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n source: \"https://developers.openai.com/api/docs/models/gpt-6-astra\",\n },\n \"openai:gpt-5.6-sol\": gpt,\n \"openai:gpt-5.6-terra\": gpt,\n \"openai:gpt-5.6-luna\": gpt,\n \"google:gemini-3.8-flash\": gemini,\n \"google:gemini-3.1-pro-preview\": gemini,\n \"google:gemini-2.5-flash\": profile(\n \"budget\",\n [\"none\", \"low\", \"medium\", \"high\"],\n \"Thinking-token budget: Low 1,024; Medium 8,192; High 24,576.\",\n gemini.source,\n ),\n \"xai:grok-4.6\": profile(\n \"effort\",\n [\"low\", \"medium\", \"high\", \"xhigh\"],\n \"Always reasons. Choose how much thinking it should do.\",\n \"https://docs.x.ai/developers/model-capabilities/text/reasoning\",\n ),\n \"deepseek:deepseek-flash\": deepseek,\n \"deepseek:deepseek-v4-pro\": deepseek,\n \"mistral:mistral-medium-3-5\": mistral,\n \"mistral:mistral-small-latest\": mistral,\n \"alibaba:qwen3.8-max\": qwen,\n \"alibaba:qwen3.7-plus\": qwen,\n \"moonshot:kimi-k3\": profile(\n \"effort\",\n [\"low\", \"high\", \"max\"],\n \"Always reasons. Choose how much thinking it should do.\",\n \"https://platform.kimi.ai/docs/guide/kimi-k3-quickstart\",\n ),\n \"moonshot:kimi-k2.7-code\": profile(\n \"fixed\",\n [],\n \"Thinking is always enabled; this model has no documented adjustable effort control.\",\n \"https://www.kimi.ai/resources/kimi-k2-7-code\",\n ),\n};\nexport const getModelReasoning = (\n provider: string,\n model: string,\n): ModelReasoning | undefined => MODEL_REASONING[`${provider}:${model}`];\nexport const supportsReasoningSelection = (\n provider: string,\n model: string,\n selection: ReasoningSelection,\n): boolean =>\n selection === \"auto\" ||\n Boolean(getModelReasoning(provider, model)?.efforts.includes(selection));\nexport const reasoningSelectionLabel = (\n selection: ReasoningSelection,\n provider?: string,\n): string => {\n if (selection === \"auto\") return \"Auto\";\n if (selection === \"none\") return provider === \"mistral\" ? \"Minimal\" : \"Off\";\n if (selection === \"xhigh\") return \"Extra high\";\n return selection.charAt(0).toUpperCase() + selection.slice(1);\n};\n",
|
|
7
|
+
"/** Client-safe model discovery. Missing metadata means unknown, never unsupported. */\nexport type ModelModality = \"text\" | \"image\" | \"pdf\" | \"audio\" | \"video\";\nexport type ModelFeature =\n | \"reasoning\"\n | \"tools\"\n | \"structured-output\"\n | \"prompt-cache\"\n | \"web-search\";\nexport type ModelMetadata = {\n input: readonly ModelModality[];\n output: readonly ModelModality[];\n features: readonly ModelFeature[];\n contextWindow?: number;\n sources: readonly string[];\n reviewedAt: string;\n};\nexport const MODEL_CAPABILITY_DESCRIPTIONS = {\n Fast: \"Suited to quick edits and lightweight tasks; actual speed varies with the request.\",\n Reasoning: \"Can spend extra thinking time on complex problems.\",\n Tools:\n \"Supports function calls for actions such as inspecting and editing code.\",\n Vision: \"Understands images. This does not mean it generates images.\",\n PDF: \"Accepts PDF documents, including their text and visual content.\",\n Audio: \"Understands audio input. This does not mean it generates speech.\",\n Video: \"Understands video input. This does not mean it generates videos.\",\n \"Image generation\": \"Produces images as model output.\",\n \"Speech generation\": \"Produces audio as model output.\",\n \"Video generation\": \"Produces video as model output.\",\n Structured:\n \"Supports schema-constrained output for reliable structured data.\",\n Caching:\n \"The provider can reuse matching prompt content to reduce repeated processing. Cache hits are not guaranteed.\",\n Search:\n \"Supports a provider-hosted web-search tool when enabled by the application.\",\n \"Long context\":\n \"A documented context window of at least 200,000 tokens. Application and request limits may be lower.\",\n} as const;\nexport type ModelCapability = keyof typeof MODEL_CAPABILITY_DESCRIPTIONS;\nconst INPUT_BADGES: Partial<Record<ModelModality, ModelCapability>> = {\n image: \"Vision\",\n pdf: \"PDF\",\n audio: \"Audio\",\n video: \"Video\",\n};\nconst OUTPUT_BADGES: Partial<Record<ModelModality, ModelCapability>> = {\n image: \"Image generation\",\n audio: \"Speech generation\",\n video: \"Video generation\",\n};\nconst FEATURE_BADGES: Record<ModelFeature, ModelCapability> = {\n reasoning: \"Reasoning\",\n tools: \"Tools\",\n \"structured-output\": \"Structured\",\n \"prompt-cache\": \"Caching\",\n \"web-search\": \"Search\",\n};\n/** Derive badges from explicit evidence; do not infer support from model names. */\nexport const modelCapabilities = (\n metadata?: ModelMetadata,\n): ModelCapability[] => {\n if (!metadata) return [];\n const badges = new Set<ModelCapability>();\n for (const feature of metadata.features) badges.add(FEATURE_BADGES[feature]);\n for (const input of metadata.input) {\n const badge = INPUT_BADGES[input];\n if (badge) badges.add(badge);\n }\n for (const output of metadata.output) {\n const badge = OUTPUT_BADGES[output];\n if (badge) badges.add(badge);\n }\n if (metadata.contextWindow && metadata.contextWindow >= 200_000)\n badges.add(\"Long context\");\n return [...badges];\n};\nexport { MODEL_METADATA, getModelMetadata } from \"./catalog\";\n\nexport {\n MODEL_REASONING,\n REASONING_EFFORTS,\n getModelReasoning,\n isReasoningSelection,\n supportsReasoningSelection,\n reasoningSelectionLabel,\n type ModelReasoning,\n type ReasoningSelection,\n} from \"./reasoning\";\n"
|
|
7
8
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA,EACL,OAAO;AAAA,EACP,OAAO;AACT;AACA,IAAM,gBAAiE;AAAA,EACrE,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;AACA,IAAM,iBAAwD;AAAA,EAC5D,WAAW;AAAA,EACX,OAAO;AAAA,EACP,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,cAAc;AAChB;AAEO,IAAM,oBAAoB,CAC/B,aACsB;AAAA,EACtB,IAAI,CAAC;AAAA,IAAU,OAAO,CAAC;AAAA,EACvB,MAAM,SAAS,IAAI;AAAA,EACnB,WAAW,WAAW,SAAS;AAAA,IAAU,OAAO,IAAI,eAAe,QAAQ;AAAA,EAC3E,WAAW,SAAS,SAAS,OAAO;AAAA,IAClC,MAAM,QAAQ,aAAa;AAAA,IAC3B,IAAI;AAAA,MAAO,OAAO,IAAI,KAAK;AAAA,EAC7B;AAAA,EACA,WAAW,UAAU,SAAS,QAAQ;AAAA,IACpC,MAAM,QAAQ,cAAc;AAAA,IAC5B,IAAI;AAAA,MAAO,OAAO,IAAI,KAAK;AAAA,EAC7B;AAAA,EACA,IAAI,SAAS,iBAAiB,SAAS,iBAAiB;AAAA,IACtD,OAAO,IAAI,cAAc;AAAA,EAC3B,OAAO,CAAC,GAAG,MAAM;AAAA;",
|
|
10
|
+
"debugId": "FE98AA17F4CDF80C64756E2164756E21",
|
|
10
11
|
"names": []
|
|
11
12
|
}
|
|
@@ -366,17 +366,70 @@ async function* tapStream(source, params, providerName) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
// src/ai/models/reasoning.ts
|
|
370
|
+
var profile = (kind, efforts, description, source) => ({ kind, efforts, description, source });
|
|
371
|
+
var claude = profile("effort", ["low", "medium", "high", "xhigh", "max"], "More thinking for harder problems; higher settings can take longer and use more credits.", "https://platform.claude.com/docs/en/build-with-claude/effort");
|
|
372
|
+
var claude46 = {
|
|
373
|
+
...claude,
|
|
374
|
+
efforts: ["low", "medium", "high", "max"]
|
|
375
|
+
};
|
|
376
|
+
var haiku = profile("budget", ["none", "low", "medium", "high"], "Thinking-token budget: Low 2,048; Medium 8,192; High 16,384. Actual usage can be lower.", "https://platform.claude.com/docs/en/build-with-claude/extended-thinking");
|
|
377
|
+
var gpt = profile("effort", ["none", "low", "medium", "high", "xhigh", "max"], claude.description, "https://developers.openai.com/api/docs/models/gpt-5.6-sol");
|
|
378
|
+
var gemini = profile("effort", ["low", "medium", "high"], claude.description, "https://ai.google.dev/gemini-api/docs/openai");
|
|
379
|
+
var deepseek = profile("effort", ["none", "low", "high", "max"], claude.description, "https://api-docs.deepseek.com/guides/thinking_mode/");
|
|
380
|
+
var mistral = profile("effort", ["none", "high"], "Minimal thinking or full reasoning. This model does not offer intermediate effort levels.", "https://docs.mistral.ai/studio/conversations/reasoning");
|
|
381
|
+
var qwen = profile("budget", ["none", "low", "medium", "high"], haiku.description, "https://help.aliyun.com/en/model-studio/deep-thinking");
|
|
382
|
+
var MODEL_REASONING = {
|
|
383
|
+
"anthropic:claude-fable-5-1": claude,
|
|
384
|
+
"anthropic:claude-opus-5": claude,
|
|
385
|
+
"anthropic:claude-sonnet-5": claude,
|
|
386
|
+
"anthropic:claude-sonnet-4-6": claude46,
|
|
387
|
+
"anthropic:claude-opus-4-6": claude46,
|
|
388
|
+
"anthropic:claude-haiku-4-5": haiku,
|
|
389
|
+
"openai:gpt-6-astra": {
|
|
390
|
+
...gpt,
|
|
391
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
392
|
+
source: "https://developers.openai.com/api/docs/models/gpt-6-astra"
|
|
393
|
+
},
|
|
394
|
+
"openai:gpt-5.6-sol": gpt,
|
|
395
|
+
"openai:gpt-5.6-terra": gpt,
|
|
396
|
+
"openai:gpt-5.6-luna": gpt,
|
|
397
|
+
"google:gemini-3.8-flash": gemini,
|
|
398
|
+
"google:gemini-3.1-pro-preview": gemini,
|
|
399
|
+
"google:gemini-2.5-flash": profile("budget", ["none", "low", "medium", "high"], "Thinking-token budget: Low 1,024; Medium 8,192; High 24,576.", gemini.source),
|
|
400
|
+
"xai:grok-4.6": profile("effort", ["low", "medium", "high", "xhigh"], "Always reasons. Choose how much thinking it should do.", "https://docs.x.ai/developers/model-capabilities/text/reasoning"),
|
|
401
|
+
"deepseek:deepseek-flash": deepseek,
|
|
402
|
+
"deepseek:deepseek-v4-pro": deepseek,
|
|
403
|
+
"mistral:mistral-medium-3-5": mistral,
|
|
404
|
+
"mistral:mistral-small-latest": mistral,
|
|
405
|
+
"alibaba:qwen3.8-max": qwen,
|
|
406
|
+
"alibaba:qwen3.7-plus": qwen,
|
|
407
|
+
"moonshot:kimi-k3": profile("effort", ["low", "high", "max"], "Always reasons. Choose how much thinking it should do.", "https://platform.kimi.ai/docs/guide/kimi-k3-quickstart"),
|
|
408
|
+
"moonshot:kimi-k2.7-code": profile("fixed", [], "Thinking is always enabled; this model has no documented adjustable effort control.", "https://www.kimi.ai/resources/kimi-k2-7-code")
|
|
409
|
+
};
|
|
410
|
+
var getModelReasoning = (provider, model) => MODEL_REASONING[`${provider}:${model}`];
|
|
411
|
+
|
|
369
412
|
// src/ai/providers/reasoning.ts
|
|
370
413
|
var EFFORT_ORDER = [
|
|
414
|
+
"none",
|
|
371
415
|
"minimal",
|
|
372
416
|
"low",
|
|
373
417
|
"medium",
|
|
374
418
|
"high",
|
|
419
|
+
"xhigh",
|
|
375
420
|
"max"
|
|
376
421
|
];
|
|
377
|
-
var ANTHROPIC_EFFORT = [
|
|
422
|
+
var ANTHROPIC_EFFORT = [
|
|
423
|
+
/opus-4-[5-8]/,
|
|
424
|
+
/sonnet-4-6/,
|
|
425
|
+
/fable-5/,
|
|
426
|
+
/mythos-5/,
|
|
427
|
+
/opus-5/,
|
|
428
|
+
/sonnet-5/
|
|
429
|
+
];
|
|
378
430
|
var ANTHROPIC_ADAPTIVE_ONLY = [];
|
|
379
431
|
var ANTHROPIC_LEGACY_THINKING = [
|
|
432
|
+
/haiku-4-5/,
|
|
380
433
|
/sonnet-4-5/,
|
|
381
434
|
/sonnet-4-0/,
|
|
382
435
|
/sonnet-4-2025/,
|
|
@@ -385,14 +438,20 @@ var ANTHROPIC_LEGACY_THINKING = [
|
|
|
385
438
|
/opus-4-2025/,
|
|
386
439
|
/3-7-sonnet/
|
|
387
440
|
];
|
|
388
|
-
var ANTHROPIC_NO_SAMPLING = [
|
|
441
|
+
var ANTHROPIC_NO_SAMPLING = [
|
|
442
|
+
/opus-4-[78]/,
|
|
443
|
+
/fable-5/,
|
|
444
|
+
/mythos-5/,
|
|
445
|
+
/opus-5/,
|
|
446
|
+
/sonnet-5/
|
|
447
|
+
];
|
|
389
448
|
var ANTHROPIC_MAX_EFFORT = [
|
|
390
449
|
/opus-4-[678]/,
|
|
391
450
|
/sonnet-4-6/,
|
|
392
451
|
/fable-5/,
|
|
393
452
|
/mythos-5/
|
|
394
453
|
];
|
|
395
|
-
var OPENAI_REASONING = [/(^|[^a-z])o[1345](-|$)/, /gpt-
|
|
454
|
+
var OPENAI_REASONING = [/(^|[^a-z])o[1345](-|$)/, /gpt-[56]/];
|
|
396
455
|
var OPENAI_MINIMAL_EFFORT = [/gpt-5/];
|
|
397
456
|
var matches = (model, patterns) => patterns.some((pattern) => pattern.test(model));
|
|
398
457
|
var anthropicReasoningMode = (model) => {
|
|
@@ -407,6 +466,8 @@ var anthropicReasoningMode = (model) => {
|
|
|
407
466
|
var anthropicSupportsSampling = (model) => !matches(model, ANTHROPIC_NO_SAMPLING);
|
|
408
467
|
var isOpenAIReasoningModel = (model) => matches(model, OPENAI_REASONING);
|
|
409
468
|
var EFFORT_BUDGET = {
|
|
469
|
+
none: 0,
|
|
470
|
+
xhigh: 24576,
|
|
410
471
|
high: 16384,
|
|
411
472
|
low: 2048,
|
|
412
473
|
max: 32768,
|
|
@@ -452,6 +513,9 @@ var anthropicEffortValue = (model, reasoning) => {
|
|
|
452
513
|
const effort = resolveEffort(reasoning);
|
|
453
514
|
if (!effort)
|
|
454
515
|
return null;
|
|
516
|
+
const known = getModelReasoning("anthropic", model);
|
|
517
|
+
if (known?.kind === "effort")
|
|
518
|
+
return clampEffort(effort, [...known.efforts]);
|
|
455
519
|
const allowed = matches(model, ANTHROPIC_MAX_EFFORT) ? ["low", "medium", "high", "max"] : ["low", "medium", "high"];
|
|
456
520
|
return clampEffort(effort, allowed);
|
|
457
521
|
};
|
|
@@ -461,10 +525,50 @@ var openaiEffortValue = (model, reasoning) => {
|
|
|
461
525
|
const effort = resolveEffort(reasoning);
|
|
462
526
|
if (!effort)
|
|
463
527
|
return null;
|
|
528
|
+
const known = getModelReasoning("openai", model);
|
|
529
|
+
if (known)
|
|
530
|
+
return clampEffort(effort, [...known.efforts]);
|
|
464
531
|
const allowed = matches(model, OPENAI_MINIMAL_EFFORT) ? ["minimal", "low", "medium", "high"] : ["low", "medium", "high"];
|
|
465
532
|
const requested = effort === "max" ? "high" : effort;
|
|
466
533
|
return clampEffort(requested, allowed);
|
|
467
534
|
};
|
|
535
|
+
var compatibleReasoningBody = (provider, model, reasoning) => {
|
|
536
|
+
if (!reasoning)
|
|
537
|
+
return {};
|
|
538
|
+
const known = getModelReasoning(provider, model);
|
|
539
|
+
const effort = resolveEffort(reasoning);
|
|
540
|
+
if (!known || !effort)
|
|
541
|
+
return {};
|
|
542
|
+
if (!known.efforts.includes(effort))
|
|
543
|
+
throw new Error(`Unsupported reasoning effort ${effort} for ${provider}:${model}`);
|
|
544
|
+
if (provider === "alibaba")
|
|
545
|
+
return effort === "none" ? { enable_thinking: false } : {
|
|
546
|
+
enable_thinking: true,
|
|
547
|
+
thinking_budget: resolveBudgetTokens(reasoning)
|
|
548
|
+
};
|
|
549
|
+
if (provider === "deepseek")
|
|
550
|
+
return effort === "none" ? { thinking: { type: "disabled" } } : { thinking: { type: "enabled" }, reasoning_effort: effort };
|
|
551
|
+
return { reasoning_effort: effort };
|
|
552
|
+
};
|
|
553
|
+
var geminiThinkingConfig = (model, reasoning) => {
|
|
554
|
+
if (!reasoning)
|
|
555
|
+
return;
|
|
556
|
+
const profile2 = getModelReasoning("google", model);
|
|
557
|
+
const effort = resolveEffort(reasoning);
|
|
558
|
+
if (!profile2 || !effort)
|
|
559
|
+
return;
|
|
560
|
+
if (!profile2.efforts.includes(effort))
|
|
561
|
+
throw new Error(`Unsupported reasoning effort ${effort} for ${model}`);
|
|
562
|
+
if (profile2.kind === "effort")
|
|
563
|
+
return { thinkingLevel: effort };
|
|
564
|
+
const budgets = {
|
|
565
|
+
none: 0,
|
|
566
|
+
low: 1024,
|
|
567
|
+
medium: 8192,
|
|
568
|
+
high: 24576
|
|
569
|
+
};
|
|
570
|
+
return { thinkingBudget: reasoning.budgetTokens ?? budgets[effort] };
|
|
571
|
+
};
|
|
468
572
|
|
|
469
573
|
// src/ai/providers/anthropic.ts
|
|
470
574
|
var h2IfHttps = (url) => url.startsWith("https://") ? { protocol: "http2" } : {};
|
|
@@ -654,7 +758,9 @@ var buildRequestBody = (params, configuredMax, configCaching) => {
|
|
|
654
758
|
if (params.stopSequences && params.stopSequences.length > 0) {
|
|
655
759
|
body.stop_sequences = params.stopSequences;
|
|
656
760
|
}
|
|
657
|
-
const mode = params.reasoning ? anthropicReasoningMode(params.model) : "none";
|
|
761
|
+
const mode = params.reasoning && params.reasoning.effort !== "none" ? anthropicReasoningMode(params.model) : "none";
|
|
762
|
+
if (params.reasoning?.effort === "none")
|
|
763
|
+
body.thinking = { type: "disabled" };
|
|
658
764
|
const thinkingActive = mode !== "none";
|
|
659
765
|
if (!thinkingActive && anthropicSupportsSampling(params.model)) {
|
|
660
766
|
if (typeof params.temperature === "number") {
|
|
@@ -1128,5 +1234,5 @@ export {
|
|
|
1128
1234
|
anthropic
|
|
1129
1235
|
};
|
|
1130
1236
|
|
|
1131
|
-
//# debugId=
|
|
1237
|
+
//# debugId=6977D8B8BF189DF964756E2164756E21
|
|
1132
1238
|
//# sourceMappingURL=anthropic.js.map
|