@aituber-onair/chat 0.48.0 → 0.50.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/README.ja.md +125 -21
- package/README.md +132 -21
- package/dist/cjs/constants/claude.d.ts +15 -0
- package/dist/cjs/constants/claude.d.ts.map +1 -1
- package/dist/cjs/constants/claude.js +61 -1
- package/dist/cjs/constants/claude.js.map +1 -1
- package/dist/cjs/constants/deepseek.d.ts +6 -0
- package/dist/cjs/constants/deepseek.d.ts.map +1 -1
- package/dist/cjs/constants/deepseek.js +47 -0
- package/dist/cjs/constants/deepseek.js.map +1 -1
- package/dist/cjs/constants/kimi.d.ts +5 -1
- package/dist/cjs/constants/kimi.d.ts.map +1 -1
- package/dist/cjs/constants/kimi.js +8 -1
- package/dist/cjs/constants/kimi.js.map +1 -1
- package/dist/cjs/constants/openrouter.d.ts +18 -0
- package/dist/cjs/constants/openrouter.d.ts.map +1 -1
- package/dist/cjs/constants/openrouter.js +88 -1
- package/dist/cjs/constants/openrouter.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/ChatServiceFactory.d.ts.map +1 -1
- package/dist/cjs/services/ChatServiceFactory.js +17 -2
- package/dist/cjs/services/ChatServiceFactory.js.map +1 -1
- package/dist/cjs/services/providers/ChatServiceProvider.d.ts +22 -5
- package/dist/cjs/services/providers/ChatServiceProvider.d.ts.map +1 -1
- package/dist/cjs/services/providers/claude/ClaudeChatService.d.ts +3 -1
- package/dist/cjs/services/providers/claude/ClaudeChatService.d.ts.map +1 -1
- package/dist/cjs/services/providers/claude/ClaudeChatService.js +51 -4
- package/dist/cjs/services/providers/claude/ClaudeChatService.js.map +1 -1
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.d.ts.map +1 -1
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.js +13 -2
- package/dist/cjs/services/providers/claude/ClaudeChatServiceProvider.js.map +1 -1
- package/dist/cjs/services/providers/claude/claudeMessageConverter.d.ts.map +1 -1
- package/dist/cjs/services/providers/claude/claudeMessageConverter.js +7 -1
- package/dist/cjs/services/providers/claude/claudeMessageConverter.js.map +1 -1
- package/dist/cjs/services/providers/deepseek/DeepSeekChatService.d.ts +2 -1
- package/dist/cjs/services/providers/deepseek/DeepSeekChatService.d.ts.map +1 -1
- package/dist/cjs/services/providers/deepseek/DeepSeekChatService.js +9 -2
- package/dist/cjs/services/providers/deepseek/DeepSeekChatService.js.map +1 -1
- package/dist/cjs/services/providers/deepseek/DeepSeekChatServiceProvider.d.ts.map +1 -1
- package/dist/cjs/services/providers/deepseek/DeepSeekChatServiceProvider.js +1 -1
- package/dist/cjs/services/providers/deepseek/DeepSeekChatServiceProvider.js.map +1 -1
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatService.d.ts +8 -3
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatService.d.ts.map +1 -1
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatService.js +85 -32
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatService.js.map +1 -1
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatServiceProvider.d.ts.map +1 -1
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatServiceProvider.js +1 -0
- package/dist/cjs/services/providers/geminiNano/GeminiNanoChatServiceProvider.js.map +1 -1
- package/dist/cjs/services/providers/kimi/KimiChatService.d.ts.map +1 -1
- package/dist/cjs/services/providers/kimi/KimiChatService.js +3 -5
- package/dist/cjs/services/providers/kimi/KimiChatService.js.map +1 -1
- package/dist/cjs/services/providers/kimi/KimiChatServiceProvider.d.ts.map +1 -1
- package/dist/cjs/services/providers/kimi/KimiChatServiceProvider.js +1 -1
- package/dist/cjs/services/providers/kimi/KimiChatServiceProvider.js.map +1 -1
- package/dist/cjs/services/providers/openai/openaiRequestBuilder.d.ts.map +1 -1
- package/dist/cjs/services/providers/openai/openaiRequestBuilder.js +8 -0
- package/dist/cjs/services/providers/openai/openaiRequestBuilder.js.map +1 -1
- package/dist/cjs/services/providers/openrouter/OpenRouterChatService.d.ts +2 -1
- package/dist/cjs/services/providers/openrouter/OpenRouterChatService.d.ts.map +1 -1
- package/dist/cjs/services/providers/openrouter/OpenRouterChatService.js +41 -23
- package/dist/cjs/services/providers/openrouter/OpenRouterChatService.js.map +1 -1
- package/dist/cjs/services/providers/openrouter/OpenRouterChatServiceProvider.d.ts.map +1 -1
- package/dist/cjs/services/providers/openrouter/OpenRouterChatServiceProvider.js +16 -0
- package/dist/cjs/services/providers/openrouter/OpenRouterChatServiceProvider.js.map +1 -1
- package/dist/cjs/types/chat.d.ts +2 -0
- package/dist/cjs/types/chat.d.ts.map +1 -1
- package/dist/cjs/types/toolChat.d.ts +2 -3
- package/dist/cjs/types/toolChat.d.ts.map +1 -1
- package/dist/cjs/utils/openaiCompatibleSse.d.ts +1 -0
- package/dist/cjs/utils/openaiCompatibleSse.d.ts.map +1 -1
- package/dist/cjs/utils/openaiCompatibleSse.js +22 -0
- package/dist/cjs/utils/openaiCompatibleSse.js.map +1 -1
- package/dist/esm/constants/claude.d.ts +15 -0
- package/dist/esm/constants/claude.d.ts.map +1 -1
- package/dist/esm/constants/claude.js +56 -0
- package/dist/esm/constants/claude.js.map +1 -1
- package/dist/esm/constants/deepseek.d.ts +6 -0
- package/dist/esm/constants/deepseek.d.ts.map +1 -1
- package/dist/esm/constants/deepseek.js +43 -0
- package/dist/esm/constants/deepseek.js.map +1 -1
- package/dist/esm/constants/kimi.d.ts +5 -1
- package/dist/esm/constants/kimi.d.ts.map +1 -1
- package/dist/esm/constants/kimi.js +7 -1
- package/dist/esm/constants/kimi.js.map +1 -1
- package/dist/esm/constants/openrouter.d.ts +18 -0
- package/dist/esm/constants/openrouter.d.ts.map +1 -1
- package/dist/esm/constants/openrouter.js +83 -0
- package/dist/esm/constants/openrouter.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/ChatServiceFactory.d.ts.map +1 -1
- package/dist/esm/services/ChatServiceFactory.js +17 -2
- package/dist/esm/services/ChatServiceFactory.js.map +1 -1
- package/dist/esm/services/providers/ChatServiceProvider.d.ts +22 -5
- package/dist/esm/services/providers/ChatServiceProvider.d.ts.map +1 -1
- package/dist/esm/services/providers/claude/ClaudeChatService.d.ts +3 -1
- package/dist/esm/services/providers/claude/ClaudeChatService.d.ts.map +1 -1
- package/dist/esm/services/providers/claude/ClaudeChatService.js +52 -5
- package/dist/esm/services/providers/claude/ClaudeChatService.js.map +1 -1
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.d.ts.map +1 -1
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.js +14 -3
- package/dist/esm/services/providers/claude/ClaudeChatServiceProvider.js.map +1 -1
- package/dist/esm/services/providers/claude/claudeMessageConverter.d.ts.map +1 -1
- package/dist/esm/services/providers/claude/claudeMessageConverter.js +7 -1
- package/dist/esm/services/providers/claude/claudeMessageConverter.js.map +1 -1
- package/dist/esm/services/providers/deepseek/DeepSeekChatService.d.ts +2 -1
- package/dist/esm/services/providers/deepseek/DeepSeekChatService.d.ts.map +1 -1
- package/dist/esm/services/providers/deepseek/DeepSeekChatService.js +10 -3
- package/dist/esm/services/providers/deepseek/DeepSeekChatService.js.map +1 -1
- package/dist/esm/services/providers/deepseek/DeepSeekChatServiceProvider.d.ts.map +1 -1
- package/dist/esm/services/providers/deepseek/DeepSeekChatServiceProvider.js +1 -1
- package/dist/esm/services/providers/deepseek/DeepSeekChatServiceProvider.js.map +1 -1
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatService.d.ts +8 -3
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatService.d.ts.map +1 -1
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatService.js +86 -33
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatService.js.map +1 -1
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatServiceProvider.d.ts.map +1 -1
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatServiceProvider.js +1 -0
- package/dist/esm/services/providers/geminiNano/GeminiNanoChatServiceProvider.js.map +1 -1
- package/dist/esm/services/providers/kimi/KimiChatService.d.ts.map +1 -1
- package/dist/esm/services/providers/kimi/KimiChatService.js +4 -6
- package/dist/esm/services/providers/kimi/KimiChatService.js.map +1 -1
- package/dist/esm/services/providers/kimi/KimiChatServiceProvider.d.ts.map +1 -1
- package/dist/esm/services/providers/kimi/KimiChatServiceProvider.js +2 -2
- package/dist/esm/services/providers/kimi/KimiChatServiceProvider.js.map +1 -1
- package/dist/esm/services/providers/openai/openaiRequestBuilder.d.ts.map +1 -1
- package/dist/esm/services/providers/openai/openaiRequestBuilder.js +8 -0
- package/dist/esm/services/providers/openai/openaiRequestBuilder.js.map +1 -1
- package/dist/esm/services/providers/openrouter/OpenRouterChatService.d.ts +2 -1
- package/dist/esm/services/providers/openrouter/OpenRouterChatService.d.ts.map +1 -1
- package/dist/esm/services/providers/openrouter/OpenRouterChatService.js +42 -24
- package/dist/esm/services/providers/openrouter/OpenRouterChatService.js.map +1 -1
- package/dist/esm/services/providers/openrouter/OpenRouterChatServiceProvider.d.ts.map +1 -1
- package/dist/esm/services/providers/openrouter/OpenRouterChatServiceProvider.js +17 -1
- package/dist/esm/services/providers/openrouter/OpenRouterChatServiceProvider.js.map +1 -1
- package/dist/esm/types/chat.d.ts +2 -0
- package/dist/esm/types/chat.d.ts.map +1 -1
- package/dist/esm/types/toolChat.d.ts +2 -3
- package/dist/esm/types/toolChat.d.ts.map +1 -1
- package/dist/esm/utils/openaiCompatibleSse.d.ts +1 -0
- package/dist/esm/utils/openaiCompatibleSse.d.ts.map +1 -1
- package/dist/esm/utils/openaiCompatibleSse.js +22 -0
- package/dist/esm/utils/openaiCompatibleSse.js.map +1 -1
- package/dist/umd/aituber-onair-chat.js +444 -63
- package/dist/umd/aituber-onair-chat.min.js +9 -11
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -571,10 +571,27 @@ CI/ローカルで再現性を高める場合は
|
|
|
571
571
|
```typescript
|
|
572
572
|
const claudeService = ChatServiceFactory.createChatService('claude', {
|
|
573
573
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
574
|
-
model: 'claude-
|
|
574
|
+
model: 'claude-opus-5',
|
|
575
|
+
reasoning_effort: 'low'
|
|
575
576
|
});
|
|
576
577
|
```
|
|
577
578
|
|
|
579
|
+
`claude-opus-5` は高性能用途向けの明示的な選択肢として利用でき、パッケージの
|
|
580
|
+
既定値にはしていません。Claude Opus 5 は adaptive thinking が既定で有効です。
|
|
581
|
+
対応するClaudeモデルでは `reasoning_effort` を指定でき、Anthropic APIの
|
|
582
|
+
`output_config.effort` に変換されます。省略時のClaude API既定値は `high` です。
|
|
583
|
+
|
|
584
|
+
- Claude Opus 5、Sonnet 5、Opus 4.8、Opus 4.7:
|
|
585
|
+
`low`、`medium`、`high`、`xhigh`、`max`
|
|
586
|
+
- Claude Opus 4.6、Sonnet 4.6:
|
|
587
|
+
`low`、`medium`、`high`、`max`
|
|
588
|
+
- Claude Opus 4.5: `low`、`medium`、`high`
|
|
589
|
+
|
|
590
|
+
effortを下げるとレイテンシーとトークン効率を優先できますが、表示される回答の
|
|
591
|
+
短さは保証されません。短い回答が必要な場合は、回答長の指示も併用してください。
|
|
592
|
+
複数ターンのツール呼び出しでは provider 固有の thinking / tool-use ブロックを
|
|
593
|
+
保持するため、返された `completion.assistant_message` を会話履歴へ追加してください。
|
|
594
|
+
|
|
578
595
|
#### Google Gemini
|
|
579
596
|
|
|
580
597
|
```typescript
|
|
@@ -611,7 +628,8 @@ Gemini 3 モデルでは `reasoning_effort` を指定できます。この値は
|
|
|
611
628
|
```typescript
|
|
612
629
|
const openRouterService = ChatServiceFactory.createChatService('openrouter', {
|
|
613
630
|
apiKey: process.env.OPENROUTER_API_KEY,
|
|
614
|
-
model: '
|
|
631
|
+
model: 'deepseek/deepseek-v4-flash-0731',
|
|
632
|
+
reasoning_effort: 'none', // チャット向けの最速設定
|
|
615
633
|
// オプション: 分析用アプリ情報を追加
|
|
616
634
|
appName: 'あなたのアプリ名',
|
|
617
635
|
appUrl: 'https://your-app-url.com'
|
|
@@ -619,26 +637,41 @@ const openRouterService = ChatServiceFactory.createChatService('openrouter', {
|
|
|
619
637
|
```
|
|
620
638
|
|
|
621
639
|
**OpenRouterの重要な注意事項:**
|
|
622
|
-
- `
|
|
623
|
-
-
|
|
640
|
+
- `openrouter/auto` と `openrouter/auto-beta` では、ルーティング先のreasoningモデルが可視テキストの生成前に出力予算を使い切ることを避けるため、`responseLength` 由来のトークン制限を自動的に無効化します。明示的に指定した `maxTokens` はそのまま使用します。
|
|
641
|
+
- `gpt-oss-20b:free` と `z-ai/glm-5.2` では、すべてのトークン制限を引き続き無効化します。これらのモデルと動的Routerでは、応答の長さをプロンプトで指示してください(例:「40文字以内で回答してください」)。
|
|
624
642
|
- 無料階層にはレート制限があります(20リクエスト/分)
|
|
625
643
|
- 無料モデル判定はモデルID末尾の `:free` で行います(動的取得した `:free` も同様にレート制限対象)
|
|
644
|
+
- `openrouter/auto-beta` はタスクを判定するBetaルーターです。リクエストごとにモデルを選択し、そのモデルの料金が適用されます。選択結果はレスポンスの `model` またはOpenRouter Activityで確認できます。
|
|
626
645
|
- `openrouter/fusion` は複数モデルのパネルとジャッジモデルを実行します。単一モデルの固定単価ではなく、内部で使われた各モデル呼び出しと web search/fetch 利用分の合算で課金されます。
|
|
627
|
-
- `z-ai/glm-5.2` は OpenRouter reasoning
|
|
646
|
+
- `z-ai/glm-5.2` は OpenRouter reasoning も `none` にします。
|
|
647
|
+
- OpenRouterのreasoning無効化には `reasoning.effort: 'none'` を送ります。`exclude: true` はreasoning内容を返すかどうかだけを制御し、reasoning自体は無効化しません。
|
|
648
|
+
- DeepSeek V4 Flashのスナップショットは、再現可能なバージョンを選べるようOpenRouterのデフォルトではなく明示的なテキスト専用選択肢にしています。どちらも応答性重視で`none`がデフォルトです:
|
|
649
|
+
- `deepseek/deepseek-v4-flash-0731`: 現行の固定0731スナップショット。`none`, `low`, `high`, `max`に対応。
|
|
650
|
+
- `deepseek/deepseek-v4-flash`: 旧無印0423スナップショット。`none`, `high`, `xhigh`に対応。
|
|
651
|
+
- コーディング特化モデルはデフォルトではなく明示的な選択肢です。`kwaipilot/kat-coder-air-v2.5` と `kwaipilot/kat-coder-pro-v2.5` はテキスト専用です。
|
|
652
|
+
- `moonshotai/kimi-k3` の可用性は上流キャパシティに依存し、混雑時はOpenRouterから429レスポンスが返る場合があります。
|
|
653
|
+
- `x-ai/grok-4.5` には現在のEU制限を含む地域別の可用性制限があります。`~x-ai/grok-latest` がGrok 4.5へ解決される場合も同じ制限を受けます。
|
|
628
654
|
- サポート対象モデル(キュレーション済み):
|
|
629
|
-
- `openrouter/auto`
|
|
655
|
+
- `openrouter/auto`, `openrouter/auto-beta`
|
|
630
656
|
- `openrouter/fusion`
|
|
631
657
|
- `openai/gpt-oss-20b:free`
|
|
632
|
-
- `~openai/gpt-latest`, `~openai/gpt-mini-latest
|
|
658
|
+
- `~openai/gpt-latest`, `~openai/gpt-mini-latest`
|
|
659
|
+
- `openai/gpt-5.6-sol`, `openai/gpt-5.6-terra`, `openai/gpt-5.6-luna`
|
|
660
|
+
- `openai/gpt-5.5-pro`, `openai/gpt-5.5`
|
|
633
661
|
- `openai/gpt-5.1-chat`, `openai/gpt-5.1-codex`, `openai/gpt-5-mini`, `openai/gpt-5-nano`
|
|
634
662
|
- `openai/gpt-4o`, `openai/gpt-4.1-mini`, `openai/gpt-4.1-nano`
|
|
635
663
|
- `~anthropic/claude-sonnet-latest`, `~anthropic/claude-haiku-latest`
|
|
664
|
+
- `anthropic/claude-opus-5`
|
|
636
665
|
- `anthropic/claude-opus-4`, `anthropic/claude-sonnet-4`
|
|
637
666
|
- `anthropic/claude-3.7-sonnet`, `anthropic/claude-3.5-sonnet`, `anthropic/claude-haiku-4.5`
|
|
638
667
|
- `~google/gemini-pro-latest`, `~google/gemini-flash-latest`
|
|
668
|
+
- `google/gemini-3.6-flash`, `google/gemini-3.5-flash-lite`
|
|
639
669
|
- `google/gemini-2.5-pro`, `google/gemini-2.5-flash`, `google/gemini-2.5-flash-lite-preview-09-2025`
|
|
640
670
|
- `z-ai/glm-5.2`, `z-ai/glm-4.7-flash`, `z-ai/glm-4.5-air`, `z-ai/glm-4.5-air:free`
|
|
641
|
-
- `~
|
|
671
|
+
- `~x-ai/grok-latest`, `x-ai/grok-4.5`
|
|
672
|
+
- `deepseek/deepseek-v4-flash-0731`, `deepseek/deepseek-v4-flash`
|
|
673
|
+
- `~moonshotai/kimi-latest`, `moonshotai/kimi-k3`, `moonshotai/kimi-k2.7-code`, `moonshotai/kimi-k2.5`
|
|
674
|
+
- `kwaipilot/kat-coder-air-v2.5`, `kwaipilot/kat-coder-pro-v2.5`
|
|
642
675
|
|
|
643
676
|
**OpenRouter freeモデルの動的リフレッシュ**
|
|
644
677
|
|
|
@@ -711,7 +744,7 @@ const kimiService = ChatServiceFactory.createChatService('kimi', {
|
|
|
711
744
|
// Optional: エンドポイント/ベースURLの上書き
|
|
712
745
|
// endpoint: 'https://api.moonshot.ai/v1/chat/completions',
|
|
713
746
|
// baseUrl: 'https://api.moonshot.ai/v1',
|
|
714
|
-
reasoning_effort: '
|
|
747
|
+
reasoning_effort: 'low'
|
|
715
748
|
});
|
|
716
749
|
```
|
|
717
750
|
|
|
@@ -719,7 +752,7 @@ const kimiService = ChatServiceFactory.createChatService('kimi', {
|
|
|
719
752
|
- KimiはOpenAI互換のChat Completionsを利用します。
|
|
720
753
|
- 対応モデル: `kimi-k3`, `kimi-k2.7-code`, `kimi-k2.7-code-highspeed`, `kimi-k2.6`, `kimi-k2.5`
|
|
721
754
|
- チャット用途向けのデフォルトモデルは引き続き `kimi-k2.6` です。
|
|
722
|
-
- Kimi K3
|
|
755
|
+
- Kimi K3は明示的に選択するReasoningモデルです。`reasoning_effort: 'low' | 'high' | 'max'` に対応し、デフォルトは `max` です。Reasoning自体は無効化できず、K2系の `thinking` オプションも利用できません。`none`、`minimal`、`medium` は非対応です。
|
|
723
756
|
- Kimi K3の出力上限には `max_completion_tokens` を使用します。
|
|
724
757
|
- Kimi K3の複数ターン・ツール呼び出しでは、`reasoning_content` と `tool_calls` を保持するため、返された `completion.assistant_message` を会話履歴へ追加してください。
|
|
725
758
|
- Kimi K2.7 Code 系モデルはコーディング寄りで、thinking mode が必須のため、ツール使用時も `thinking` を有効のままにします。
|
|
@@ -745,6 +778,7 @@ const kimiService = ChatServiceFactory.createChatService('kimi', {
|
|
|
745
778
|
const deepSeekService = ChatServiceFactory.createChatService('deepseek', {
|
|
746
779
|
apiKey: process.env.DEEPSEEK_API_KEY,
|
|
747
780
|
model: 'deepseek-v4-flash',
|
|
781
|
+
reasoning_effort: 'none', // デフォルト: 応答性重視でthinkingを無効化
|
|
748
782
|
});
|
|
749
783
|
```
|
|
750
784
|
|
|
@@ -753,7 +787,9 @@ const deepSeekService = ChatServiceFactory.createChatService('deepseek', {
|
|
|
753
787
|
- 推奨モデルは`deepseek-v4-flash`(デフォルト)と`deepseek-v4-pro`です。
|
|
754
788
|
- legacy alias の`deepseek-chat`と`deepseek-reasoner`は互換用にexportしていますが、DeepSeek側で非推奨かつ2026-07-24廃止予定です。
|
|
755
789
|
- `openai-compatible`にendpoint/modelを直接指定して使うこともできますが、`deepseek` providerならendpointとデフォルトモデル指定が簡単です。
|
|
756
|
-
- DeepSeek
|
|
790
|
+
- `deepseek-v4-flash`は`reasoning_effort: 'none' | 'low' | 'high' | 'max'`に対応します。packageのデフォルトは応答性重視の`none`で、`thinking: { type: 'disabled' }`へ変換します。それ以外はthinkingを有効化してDeepSeekの`reasoning_effort`として送信します。
|
|
791
|
+
- `deepseek-v4-pro`では`none`, `high`, `max`を公開します。DeepSeek側で`low`が`high`へ変換されるため、packageでも明示的に正規化します。
|
|
792
|
+
- ThinkingとTool Callingの併用は、DeepSeekがtool turn間での`reasoning_content`再送を要求し、thinking時に通常の`tool_choice`形式を受け付けないため、現時点では明示的に拒否します。デフォルトの`none`ではTool Callingを利用できます。
|
|
757
793
|
|
|
758
794
|
#### Mistral
|
|
759
795
|
|
|
@@ -804,7 +840,7 @@ const sakanaService = ChatServiceFactory.createChatService('sakana', {
|
|
|
804
840
|
- 対応モデル: `fugu`(デフォルト), `fugu-ultra`, `fugu-ultra-20260615`
|
|
805
841
|
- Sakanaは新しいChat Completions連携では`max_completion_tokens`を推奨していますが、legacyな`max_tokens`も受け付けます。このproviderでは既存OpenAI互換providerの挙動に合わせて`max_tokens`を使います。
|
|
806
842
|
- Sakanaは最高性能にはResponses APIを推奨していますが、このproviderはpackageのOpenAI互換chat経路に合わせてChat Completionsを利用します。
|
|
807
|
-
- ブラウザから直接呼ぶ場合、Sakana側がoriginに対してCORSを許可していないと失敗します。ブラウザ単体ではなく、Node.js、backend/serverless proxy、または`examples/sakana-
|
|
843
|
+
- ブラウザから直接呼ぶ場合、Sakana側がoriginに対してCORSを許可していないと失敗します。ブラウザ単体ではなく、Node.js、backend/serverless proxy、または`examples/node-basic/sakana-example.js`を利用してください。
|
|
808
844
|
|
|
809
845
|
#### PLaMo
|
|
810
846
|
|
|
@@ -827,20 +863,88 @@ const plamoService = ChatServiceFactory.createChatService('plamo', {
|
|
|
827
863
|
|
|
828
864
|
```typescript
|
|
829
865
|
const geminiNanoService = ChatServiceFactory.createChatService('gemini-nano', {
|
|
830
|
-
responseLength: '
|
|
866
|
+
responseLength: 'short',
|
|
867
|
+
initialPrompts: [
|
|
868
|
+
{
|
|
869
|
+
role: 'system',
|
|
870
|
+
content: 'あなたは明るく自然な話し方をするキャラクターです。'
|
|
871
|
+
},
|
|
872
|
+
{ role: 'user', content: '今日はどんな気分?' },
|
|
873
|
+
{ role: 'assistant', content: '元気いっぱいで、お話しするのが楽しみだよ!' },
|
|
874
|
+
{ role: 'user', content: '準備できた?' },
|
|
875
|
+
{ role: 'assistant', content: 'うん、いつでも始められるよ!' }
|
|
876
|
+
]
|
|
831
877
|
});
|
|
832
878
|
```
|
|
833
879
|
|
|
834
880
|
注意:
|
|
835
881
|
- APIキー不要 — ChromeのLanguageModel API(Prompt API)を使用します。
|
|
836
|
-
-
|
|
837
|
-
|
|
838
|
-
|
|
882
|
+
- システム指示、設定した会話例、直近の会話履歴は、roleを維持した
|
|
883
|
+
`initialPrompts`として渡されます。
|
|
884
|
+
- 設定した`initialPrompts`にsystemメッセージがある場合は、必ず先頭へ
|
|
885
|
+
正規化されます。会話例はオンデバイスモデルのコンテキストを消費するため、
|
|
886
|
+
短い例を使用してください。
|
|
887
|
+
- Gemini Nanoでは、トークン数の目安に加えて、`veryShort`は最大1文、
|
|
888
|
+
`short`は最大2文、`medium`は最大3文、`long`は最大5文、
|
|
889
|
+
`veryLong`は最大10文となるよう具体的に指示します。`deep`は約5000
|
|
890
|
+
トークンの目安だけを残し、文数は制限しません。ただし、出力長は厳密保証
|
|
891
|
+
ではありません。
|
|
892
|
+
- 構造化された履歴として、直近20件までのuser/assistantメッセージを渡します。
|
|
893
|
+
- Webページでは、対応するデスクトップ端末上の**Chrome 148以降**が必要です。
|
|
894
|
+
Prompt APIは標準で有効なため、Chromeフラグの設定は不要です。
|
|
895
|
+
Chrome拡張ではChrome 138以降から利用できます。
|
|
839
896
|
- モデルはすべてデバイス上で実行され、推論時にネットワーク通信は発生しません。
|
|
840
897
|
- 非ストリーミングのみ — レスポンスは完全なテキストとして一括返却されます。
|
|
841
898
|
- ビジョン(画像入力)は非対応です。
|
|
899
|
+
- EN/JAの言語選択とフロントエンドだけでのモデル準備は、
|
|
900
|
+
[ブラウザ完結Gemini Nanoカスタマーサポート例](./examples/gemini-nano-customer-support-bot/)
|
|
901
|
+
を参照してください。
|
|
842
902
|
- 初回のモデルダウンロードにはユーザー操作が必要で、数分かかる場合があります。
|
|
843
903
|
|
|
904
|
+
##### Tips: 会話例で応答長の安定性を高める
|
|
905
|
+
|
|
906
|
+
`responseLength`を設定すると、Gemini Nano向けの文数、書式、トークン数の
|
|
907
|
+
目安が自動的に指示へ追加されます。さらに、短いuser/assistantの会話例を
|
|
908
|
+
2〜3組ほど`initialPrompts`で渡すと、指示をより強く補強できます。
|
|
909
|
+
|
|
910
|
+
```typescript
|
|
911
|
+
import {
|
|
912
|
+
ChatServiceFactory,
|
|
913
|
+
type GeminiNanoInitialPrompt
|
|
914
|
+
} from '@aituber-onair/chat';
|
|
915
|
+
|
|
916
|
+
const veryShortExamples: GeminiNanoInitialPrompt[] = [
|
|
917
|
+
{ role: 'user', content: '今日はどんな気分?' },
|
|
918
|
+
{ role: 'assistant', content: 'みんなと話せて元気いっぱいだよ!' },
|
|
919
|
+
{ role: 'user', content: '好きな食べ物は?' },
|
|
920
|
+
{ role: 'assistant', content: '特にサーモンのお寿司が好き!' }
|
|
921
|
+
];
|
|
922
|
+
|
|
923
|
+
const service = ChatServiceFactory.createChatService('gemini-nano', {
|
|
924
|
+
responseLength: 'veryShort',
|
|
925
|
+
initialPrompts: veryShortExamples
|
|
926
|
+
});
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
会話例は任意です。`initialPrompts`を省略しても、パッケージ側の応答長指示は
|
|
930
|
+
適用されます。会話例を加えることで、期待する文章量、口調、リアクション、
|
|
931
|
+
会話のテンポをオンデバイスモデルへ具体的に伝えられます。
|
|
932
|
+
|
|
933
|
+
- assistantの例文は選択したプリセットに合わせてください。`veryShort`なら
|
|
934
|
+
1文、`short`なら最大2文にします。
|
|
935
|
+
- 例文は対象キャラクターの口調で記述してください。汎用的な固定例文は
|
|
936
|
+
キャラクター性を変える可能性があるため、パッケージからは自動追加しません。
|
|
937
|
+
- 明確に長い回答が必要な`medium`以上へ1文の例を流用すると、短い回答へ
|
|
938
|
+
偏る可能性があります。
|
|
939
|
+
- 例文はシステムプロンプトや会話履歴と同じコンテキストを消費するため、
|
|
940
|
+
少数かつ短く保ってください。
|
|
941
|
+
- `responseLength`または`initialPrompts`を変更した場合は、チャットサービスを
|
|
942
|
+
作り直してください。React Basic Exampleではこれを自動的に行い、短い例文は
|
|
943
|
+
`veryShort`と`short`だけに適用しています。
|
|
944
|
+
- これは応答長の安定性を高める制御であり、厳密な出力上限ではありません。
|
|
945
|
+
ChromeのLanguageModel APIにはmax output tokens相当の設定がないため、
|
|
946
|
+
指定した文数を超える場合があります。
|
|
947
|
+
|
|
844
948
|
### ビジョンチャット
|
|
845
949
|
|
|
846
950
|
組み込み provider のうち、対応モデル一覧を持つものは vision 対応を
|
|
@@ -1150,16 +1254,16 @@ vision、JSON mode、reasoning 設定を使うべきかを provider 固有ロジ
|
|
|
1150
1254
|
- **OpenAI**: GPT-5.6(Sol/Terra/Luna)、GPT-5.5、GPT-5.4 Pro、GPT-5.4、GPT-5.4 Mini、GPT-5.4 Nano、GPT-5.1、GPT-5(Nano/Mini/Standard)、GPT-4.1(miniとnanoを含む), GPT-4, GPT-4o-mini, O3-mini, o1, o1-miniのモデルをサポート
|
|
1151
1255
|
- **OpenAI-Compatible**: OpenAI互換 endpoint 経由で任意のローカル/セルフホスト model ID を利用できます。vision 対応可否は endpoint ごとに差があるため、原則 `unknown` 扱いです
|
|
1152
1256
|
- **Gemini**: Gemini 3.6 Flash、Gemini 3.5 Flash、Gemini 3.5 Flash-Lite、Gemini 3.1 Flash-Lite、Gemini 3.1 Pro Preview、Gemini 3 Flash Preview、Gemini 2.5 Pro、Gemini 2.5 Flash、Gemini 2.5 Flash Lite、Gemma 4 31B IT、Gemma 4 26B A4B IT などの推奨モデルをサポート。チャット用途向けに Gemini 3 Flash は minimal thinking、Gemini 3 Pro は low thinking を既定値にします。Gemini 3.1 Flash-Lite Preview、Gemini 3 Pro Preview、Gemini 2.5 Flash Lite Preview などの lifecycle 上 deprecated なモデルは明示指定用に export を残しています
|
|
1153
|
-
- **Claude**: Claude Sonnet 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Opus 4.5, Claude Sonnet 4.6, Claude Sonnet 4.5, Claude Haiku 4.5 に加え、まだ利用可能だが非推奨の Claude 4 Opus, Claude 4 Sonnet, Claude 3 Haiku
|
|
1154
|
-
- **OpenRouter**: OpenRouterのキュレーション済みモデル一覧(OpenAI/Claude/Gemini/Z.ai/Kimi)をサポート。モデルIDはOpenRouter節を参照してください
|
|
1257
|
+
- **Claude**: Claude Opus 5, Claude Sonnet 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Opus 4.5, Claude Sonnet 4.6, Claude Sonnet 4.5, Claude Haiku 4.5 に加え、まだ利用可能だが非推奨の Claude 4 Opus, Claude 4 Sonnet, Claude 3 Haiku をサポート。調整可能な `reasoning_effort` は対応モデルに限り `output_config.effort` として送信します
|
|
1258
|
+
- **OpenRouter**: OpenRouterのキュレーション済みモデル一覧(OpenAI/Claude/Gemini/Z.ai/xAI/Kimi/DeepSeek/Kwaipilot)をサポート。モデルIDはOpenRouter節を参照してください
|
|
1155
1259
|
- **Z.ai**: GLM-5.2/GLM-5.1/GLM-5/GLM-5-Turbo(テキスト)、GLM-4.7/4.6(テキスト)、GLM-5V-Turbo/GLM-4.6V系(ビジョン)をサポート
|
|
1156
1260
|
- **xAI**: Grok 4.5 をチャット用途向けに `reasoning_effort: 'low'` デフォルトでサポート。加えて Grok 4.3、Grok 4.20 の Reasoning/Non-Reasoning、Grok 4-1 Fast の Reasoning/Non-Reasoning をサポートし、全モデルでビジョン対応
|
|
1157
|
-
- **Kimi**: Kimi K3(`kimi-k3
|
|
1158
|
-
- **DeepSeek**: DeepSeek V4 Flash(`deepseek-v4-flash`)と DeepSeek V4 Pro(`deepseek-v4-pro`)をOpenAI互換Chat Completions
|
|
1261
|
+
- **Kimi**: Kimi K3(`kimi-k3`、`low` / `high` / `max` reasoning、デフォルトは `max`)、Kimi K2.7 Code(`kimi-k2.7-code`)、Kimi K2.7 Code HighSpeed(`kimi-k2.7-code-highspeed`)、Kimi K2.6(`kimi-k2.6`、デフォルト)、Kimi K2.5(`kimi-k2.5`、いずれもビジョン対応)をサポート
|
|
1262
|
+
- **DeepSeek**: DeepSeek V4 Flash(`deepseek-v4-flash`)と DeepSeek V4 Pro(`deepseek-v4-pro`)をOpenAI互換Chat Completions経由でサポート。低遅延チャット向けにthinkingはデフォルト無効で、モデル別の`reasoning_effort`から有効化できます。legacy alias の`deepseek-chat`と`deepseek-reasoner`はDeepSeek側で非推奨です
|
|
1159
1263
|
- **Mistral**: Ministral 3系(`ministral-3b-2512`, `ministral-8b-2512`, `ministral-14b-2512`)と現行generalist modelをサポートし、streamingとvisionにも対応。adjustable `reasoning_effort`は対応モデルにだけ送信します
|
|
1160
1264
|
- **Sakana AI**: Fugu(`fugu`)と Fugu Ultra(`fugu-ultra`, `fugu-ultra-20260615`)をOpenAI互換Chat Completions経由でサポート
|
|
1161
1265
|
- **PLaMo**: PLaMo 3.0 Prime(`plamo-3.0-prime`, デフォルト)と PLaMo 2.2 Prime(`plamo-2.2-prime`)をOpenAI互換Chat Completions経由でサポート
|
|
1162
|
-
- **Gemini Nano**: Chromeブラウザ内蔵AI(LanguageModel API)。デバイス上で動作し、APIキー不要。Chrome
|
|
1266
|
+
- **Gemini Nano**: Chromeブラウザ内蔵AI(LanguageModel API)。デバイス上で動作し、APIキー不要。Webページでは対応するデスクトップ端末上のChrome 148以降が必要で、Chromeフラグの設定は不要。非ストリーミング、ビジョン非対応
|
|
1163
1267
|
|
|
1164
1268
|
## ライセンス
|
|
1165
1269
|
|
package/README.md
CHANGED
|
@@ -585,10 +585,29 @@ For CI/local deterministic runs, pair it with `examples/mock-openai-server`.
|
|
|
585
585
|
```typescript
|
|
586
586
|
const claudeService = ChatServiceFactory.createChatService('claude', {
|
|
587
587
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
588
|
-
model: 'claude-
|
|
588
|
+
model: 'claude-opus-5',
|
|
589
|
+
reasoning_effort: 'low'
|
|
589
590
|
});
|
|
590
591
|
```
|
|
591
592
|
|
|
593
|
+
`claude-opus-5` is available as an explicit high-capability option and is not
|
|
594
|
+
the package default. Claude Opus 5 has adaptive thinking enabled by default.
|
|
595
|
+
Supported Claude models accept `reasoning_effort`, which maps to Anthropic's
|
|
596
|
+
`output_config.effort`. The Claude API defaults to `high` when it is omitted:
|
|
597
|
+
|
|
598
|
+
- Claude Opus 5, Sonnet 5, Opus 4.8, and Opus 4.7:
|
|
599
|
+
`low`, `medium`, `high`, `xhigh`, or `max`.
|
|
600
|
+
- Claude Opus 4.6 and Sonnet 4.6:
|
|
601
|
+
`low`, `medium`, `high`, or `max`.
|
|
602
|
+
- Claude Opus 4.5: `low`, `medium`, or `high`.
|
|
603
|
+
|
|
604
|
+
Lower effort prioritizes latency and token efficiency, but does not guarantee
|
|
605
|
+
a shorter visible response. Use response-length prompting as well when concise
|
|
606
|
+
output is required.
|
|
607
|
+
For multi-turn tool calls, append the returned
|
|
608
|
+
`completion.assistant_message` to history so its provider-native thinking and
|
|
609
|
+
tool-use blocks are preserved.
|
|
610
|
+
|
|
592
611
|
#### Google Gemini
|
|
593
612
|
|
|
594
613
|
```typescript
|
|
@@ -627,7 +646,8 @@ those models.
|
|
|
627
646
|
```typescript
|
|
628
647
|
const openRouterService = ChatServiceFactory.createChatService('openrouter', {
|
|
629
648
|
apiKey: process.env.OPENROUTER_API_KEY,
|
|
630
|
-
model: '
|
|
649
|
+
model: 'deepseek/deepseek-v4-flash-0731',
|
|
650
|
+
reasoning_effort: 'none', // Fastest chat-oriented setting
|
|
631
651
|
// Optional: Add app information for analytics
|
|
632
652
|
appName: 'Your App Name',
|
|
633
653
|
appUrl: 'https://your-app-url.com'
|
|
@@ -635,26 +655,41 @@ const openRouterService = ChatServiceFactory.createChatService('openrouter', {
|
|
|
635
655
|
```
|
|
636
656
|
|
|
637
657
|
**Important Notes for OpenRouter:**
|
|
638
|
-
-
|
|
639
|
-
-
|
|
658
|
+
- Automatic token limits from `responseLength` are disabled for `openrouter/auto` and `openrouter/auto-beta` because a routed reasoning model can spend the entire output budget before emitting visible content. An explicitly supplied `maxTokens` is still honored.
|
|
659
|
+
- All token limits remain disabled for `gpt-oss-20b:free` and `z-ai/glm-5.2`. For these models and the dynamic routers, control response length with prompt instructions (e.g., "Please respond in 40 characters or less").
|
|
640
660
|
- Free tier has rate limits (20 requests/minute)
|
|
641
661
|
- Free tier detection is based on the model ID suffix `:free` (dynamic `:free` IDs are also rate-limited)
|
|
662
|
+
- `openrouter/auto-beta` is a Beta task-aware router. It chooses a model for each request and charges that routed model's rate; inspect the response `model` field or OpenRouter Activity to see the selection.
|
|
642
663
|
- `openrouter/fusion` runs a multi-model panel plus a judge model; OpenRouter bills the sum of the underlying model calls and any enabled web search/fetch usage, not a single fixed model rate.
|
|
643
|
-
- For `z-ai/glm-5.2`, OpenRouter reasoning defaults to `none
|
|
664
|
+
- For `z-ai/glm-5.2`, OpenRouter reasoning also defaults to `none`.
|
|
665
|
+
- OpenRouter reasoning uses `reasoning.effort: 'none'` to disable reasoning. `exclude: true` only controls whether reasoning content is returned; it does not disable reasoning by itself.
|
|
666
|
+
- DeepSeek V4 Flash snapshots are explicit text-only options rather than the OpenRouter default so applications can choose a reproducible version. Both default to `none` for responsive chat:
|
|
667
|
+
- `deepseek/deepseek-v4-flash-0731`: current fixed 0731 snapshot; supports `none`, `low`, `high`, and `max`.
|
|
668
|
+
- `deepseek/deepseek-v4-flash`: older unversioned 0423 snapshot; supports `none`, `high`, and `xhigh`.
|
|
669
|
+
- Specialized coding models are explicit options rather than defaults. This includes `kwaipilot/kat-coder-air-v2.5` and `kwaipilot/kat-coder-pro-v2.5`, which are text-only.
|
|
670
|
+
- `moonshotai/kimi-k3` availability depends on upstream capacity; OpenRouter may return 429 responses when capacity is constrained.
|
|
671
|
+
- `x-ai/grok-4.5` has region-specific availability, including a current EU limitation. `~x-ai/grok-latest` inherits those limits when it resolves to Grok 4.5.
|
|
644
672
|
- Supported models (curated list):
|
|
645
|
-
- `openrouter/auto`
|
|
673
|
+
- `openrouter/auto`, `openrouter/auto-beta`
|
|
646
674
|
- `openrouter/fusion`
|
|
647
675
|
- `openai/gpt-oss-20b:free`
|
|
648
|
-
- `~openai/gpt-latest`, `~openai/gpt-mini-latest
|
|
676
|
+
- `~openai/gpt-latest`, `~openai/gpt-mini-latest`
|
|
677
|
+
- `openai/gpt-5.6-sol`, `openai/gpt-5.6-terra`, `openai/gpt-5.6-luna`
|
|
678
|
+
- `openai/gpt-5.5-pro`, `openai/gpt-5.5`
|
|
649
679
|
- `openai/gpt-5.1-chat`, `openai/gpt-5.1-codex`, `openai/gpt-5-mini`, `openai/gpt-5-nano`
|
|
650
680
|
- `openai/gpt-4o`, `openai/gpt-4.1-mini`, `openai/gpt-4.1-nano`
|
|
651
681
|
- `~anthropic/claude-sonnet-latest`, `~anthropic/claude-haiku-latest`
|
|
682
|
+
- `anthropic/claude-opus-5`
|
|
652
683
|
- `anthropic/claude-opus-4`, `anthropic/claude-sonnet-4`
|
|
653
684
|
- `anthropic/claude-3.7-sonnet`, `anthropic/claude-3.5-sonnet`, `anthropic/claude-haiku-4.5`
|
|
654
685
|
- `~google/gemini-pro-latest`, `~google/gemini-flash-latest`
|
|
686
|
+
- `google/gemini-3.6-flash`, `google/gemini-3.5-flash-lite`
|
|
655
687
|
- `google/gemini-2.5-pro`, `google/gemini-2.5-flash`, `google/gemini-2.5-flash-lite-preview-09-2025`
|
|
656
688
|
- `z-ai/glm-5.2`, `z-ai/glm-4.7-flash`, `z-ai/glm-4.5-air`, `z-ai/glm-4.5-air:free`
|
|
657
|
-
- `~
|
|
689
|
+
- `~x-ai/grok-latest`, `x-ai/grok-4.5`
|
|
690
|
+
- `deepseek/deepseek-v4-flash-0731`, `deepseek/deepseek-v4-flash`
|
|
691
|
+
- `~moonshotai/kimi-latest`, `moonshotai/kimi-k3`, `moonshotai/kimi-k2.7-code`, `moonshotai/kimi-k2.5`
|
|
692
|
+
- `kwaipilot/kat-coder-air-v2.5`, `kwaipilot/kat-coder-pro-v2.5`
|
|
658
693
|
|
|
659
694
|
**Dynamic OpenRouter free model refresh**
|
|
660
695
|
|
|
@@ -726,7 +761,7 @@ const kimiService = ChatServiceFactory.createChatService('kimi', {
|
|
|
726
761
|
// Optional: override endpoint or baseUrl
|
|
727
762
|
// endpoint: 'https://api.moonshot.ai/v1/chat/completions',
|
|
728
763
|
// baseUrl: 'https://api.moonshot.ai/v1',
|
|
729
|
-
reasoning_effort: '
|
|
764
|
+
reasoning_effort: 'low'
|
|
730
765
|
});
|
|
731
766
|
```
|
|
732
767
|
|
|
@@ -734,7 +769,7 @@ Notes:
|
|
|
734
769
|
- Kimi uses OpenAI-compatible Chat Completions.
|
|
735
770
|
- Supported models: `kimi-k3`, `kimi-k2.7-code`, `kimi-k2.7-code-highspeed`, `kimi-k2.6`, `kimi-k2.5`
|
|
736
771
|
- `kimi-k2.6` remains the default model for chat-oriented usage.
|
|
737
|
-
- Kimi K3 is an explicit
|
|
772
|
+
- Kimi K3 is an explicit reasoning model. It accepts `reasoning_effort: 'low' | 'high' | 'max'`, defaults to `max`, always reasons, and does not accept the K2.x `thinking` option. `none`, `minimal`, and `medium` are not supported.
|
|
738
773
|
- Kimi K3 uses `max_completion_tokens` for configured response limits.
|
|
739
774
|
- For Kimi K3 multi-turn and tool-call flows, append the returned `completion.assistant_message` to history so `reasoning_content` and `tool_calls` are preserved.
|
|
740
775
|
- Kimi K2.7 Code models are coding-oriented and require thinking mode, so they keep `thinking` enabled even when tools are used.
|
|
@@ -760,6 +795,7 @@ Notes for self-hosted:
|
|
|
760
795
|
const deepSeekService = ChatServiceFactory.createChatService('deepseek', {
|
|
761
796
|
apiKey: process.env.DEEPSEEK_API_KEY,
|
|
762
797
|
model: 'deepseek-v4-flash',
|
|
798
|
+
reasoning_effort: 'none', // Default: disable thinking for responsive chat
|
|
763
799
|
});
|
|
764
800
|
```
|
|
765
801
|
|
|
@@ -768,7 +804,9 @@ Notes:
|
|
|
768
804
|
- Recommended models: `deepseek-v4-flash` (default) and `deepseek-v4-pro`.
|
|
769
805
|
- Legacy aliases `deepseek-chat` and `deepseek-reasoner` remain exported for explicit compatibility, but DeepSeek marks them deprecated and scheduled for removal on 2026-07-24.
|
|
770
806
|
- You can still use DeepSeek through `openai-compatible` by providing the full endpoint and model manually, but the first-class `deepseek` provider supplies the endpoint and default model for you.
|
|
771
|
-
-
|
|
807
|
+
- `deepseek-v4-flash` accepts `reasoning_effort: 'none' | 'low' | 'high' | 'max'`. The package defaults to `none`, mapped to `thinking: { type: 'disabled' }`, for responsive chat. Other levels enable thinking and are sent as DeepSeek `reasoning_effort`.
|
|
808
|
+
- `deepseek-v4-pro` exposes `none`, `high`, and `max`. DeepSeek currently maps a requested `low` to `high`, so the package normalizes it explicitly.
|
|
809
|
+
- Thinking with tool calling is intentionally rejected for now because DeepSeek requires `reasoning_content` replay across tool turns and does not accept the normal `tool_choice` request shape in thinking mode. Tool calling works with the default `none` setting.
|
|
772
810
|
|
|
773
811
|
#### Mistral
|
|
774
812
|
|
|
@@ -819,7 +857,7 @@ Notes:
|
|
|
819
857
|
- Supported models: `fugu` (default), `fugu-ultra`, and `fugu-ultra-20260615`.
|
|
820
858
|
- Sakana recommends `max_completion_tokens` for new Chat Completions integrations, but also accepts legacy `max_tokens`. This provider keeps `max_tokens` to match existing OpenAI-compatible provider behavior.
|
|
821
859
|
- Sakana recommends the Responses API for best performance, but this provider uses Chat Completions because it matches the package's OpenAI-compatible chat path.
|
|
822
|
-
- Direct browser usage may fail with CORS unless Sakana enables CORS for your origin. Use Node.js, a backend/serverless proxy, or `examples/sakana-
|
|
860
|
+
- Direct browser usage may fail with CORS unless Sakana enables CORS for your origin. Use Node.js, a backend/serverless proxy, or `examples/node-basic/sakana-example.js` instead of calling Sakana directly from browser-only apps.
|
|
823
861
|
|
|
824
862
|
#### PLaMo
|
|
825
863
|
|
|
@@ -844,20 +882,93 @@ Notes:
|
|
|
844
882
|
|
|
845
883
|
```typescript
|
|
846
884
|
const geminiNanoService = ChatServiceFactory.createChatService('gemini-nano', {
|
|
847
|
-
responseLength: '
|
|
885
|
+
responseLength: 'short',
|
|
886
|
+
initialPrompts: [
|
|
887
|
+
{
|
|
888
|
+
role: 'system',
|
|
889
|
+
content: 'You are a cheerful character who speaks naturally.'
|
|
890
|
+
},
|
|
891
|
+
{ role: 'user', content: 'How are you feeling today?' },
|
|
892
|
+
{ role: 'assistant', content: 'I feel great and ready to chat!' },
|
|
893
|
+
{ role: 'user', content: 'Are you ready?' },
|
|
894
|
+
{ role: 'assistant', content: 'Yes, we can start anytime!' }
|
|
895
|
+
]
|
|
848
896
|
});
|
|
849
897
|
```
|
|
850
898
|
|
|
851
899
|
Notes:
|
|
852
900
|
- No API key required — uses Chrome's built-in LanguageModel API (Prompt API).
|
|
853
|
-
-
|
|
854
|
-
|
|
855
|
-
|
|
901
|
+
- System instructions, configured examples, and the most recent conversation
|
|
902
|
+
history are passed through `initialPrompts` with their roles preserved.
|
|
903
|
+
- If configured `initialPrompts` contain a system message, it is normalized to
|
|
904
|
+
the first entry. Keep few-shot examples short because they consume the
|
|
905
|
+
on-device model's context window.
|
|
906
|
+
- Gemini Nano uses concrete sentence-count guidance in addition to the soft
|
|
907
|
+
token budget: `veryShort` up to 1 sentence, `short` up to 2, `medium` up to
|
|
908
|
+
3, `long` up to 5, and `veryLong` up to 10. `deep` keeps its approximately
|
|
909
|
+
5000-token guidance without a sentence-count limit. Output length is still
|
|
910
|
+
best effort.
|
|
911
|
+
- Up to the most recent 20 user/assistant messages are included as structured
|
|
912
|
+
history.
|
|
913
|
+
- Web pages require **Chrome 148+** on a supported desktop device. The Prompt
|
|
914
|
+
API is enabled by default, so no Chrome flags are required. Chrome extensions
|
|
915
|
+
have supported the Prompt API since Chrome 138.
|
|
856
916
|
- The model runs entirely on-device; no network requests are made for inference.
|
|
857
917
|
- Non-streaming only — responses are returned as a single complete text.
|
|
858
918
|
- Vision is not supported.
|
|
919
|
+
- See the
|
|
920
|
+
[browser-only Gemini Nano customer-support example](./examples/gemini-nano-customer-support-bot/)
|
|
921
|
+
for EN/JA language selection and frontend-only model preparation.
|
|
859
922
|
- The initial model download requires a user action and may take a few minutes.
|
|
860
923
|
|
|
924
|
+
##### Tip: improve response-length consistency with examples
|
|
925
|
+
|
|
926
|
+
Setting `responseLength` automatically adds Gemini Nano-specific sentence-count,
|
|
927
|
+
formatting, and soft token-budget instructions. You can reinforce those
|
|
928
|
+
instructions by also passing two or three short user/assistant examples through
|
|
929
|
+
`initialPrompts`:
|
|
930
|
+
|
|
931
|
+
```typescript
|
|
932
|
+
import {
|
|
933
|
+
ChatServiceFactory,
|
|
934
|
+
type GeminiNanoInitialPrompt
|
|
935
|
+
} from '@aituber-onair/chat';
|
|
936
|
+
|
|
937
|
+
const veryShortExamples: GeminiNanoInitialPrompt[] = [
|
|
938
|
+
{ role: 'user', content: 'How are you feeling today?' },
|
|
939
|
+
{ role: 'assistant', content: 'I feel great and ready to chat!' },
|
|
940
|
+
{ role: 'user', content: 'What food do you like?' },
|
|
941
|
+
{ role: 'assistant', content: 'Salmon sushi is my favorite!' }
|
|
942
|
+
];
|
|
943
|
+
|
|
944
|
+
const service = ChatServiceFactory.createChatService('gemini-nano', {
|
|
945
|
+
responseLength: 'veryShort',
|
|
946
|
+
initialPrompts: veryShortExamples
|
|
947
|
+
});
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
The examples are optional; the package applies the length instruction even
|
|
951
|
+
when `initialPrompts` is omitted. Examples help the on-device model learn the
|
|
952
|
+
desired response size, speaking style, reaction level, and tempo more
|
|
953
|
+
consistently.
|
|
954
|
+
|
|
955
|
+
- Match every assistant example to the selected preset. For `veryShort`, use
|
|
956
|
+
one sentence; for `short`, use no more than two.
|
|
957
|
+
- Write examples in the target character's voice. Hardcoded generic examples
|
|
958
|
+
are not added by the package because they could change the character's
|
|
959
|
+
personality.
|
|
960
|
+
- Do not reuse one-sentence examples for `medium` or longer responses when you
|
|
961
|
+
want visibly longer answers; those examples can bias the model toward short
|
|
962
|
+
output.
|
|
963
|
+
- Keep the set small because examples share the on-device context window with
|
|
964
|
+
the system prompt and conversation history.
|
|
965
|
+
- Recreate the chat service when `responseLength` or `initialPrompts` changes.
|
|
966
|
+
The React basic example does this automatically and applies its short
|
|
967
|
+
examples only to `veryShort` and `short`.
|
|
968
|
+
- These controls improve consistency but do not provide a strict output limit.
|
|
969
|
+
Chrome's LanguageModel API currently has no max-output-token option, so
|
|
970
|
+
Gemini Nano may occasionally exceed the requested sentence count.
|
|
971
|
+
|
|
861
972
|
### Vision Chat
|
|
862
973
|
|
|
863
974
|
For built-in providers with curated model lists, the library pre-validates
|
|
@@ -1168,16 +1279,16 @@ Currently, the following AI providers are built-in:
|
|
|
1168
1279
|
- **OpenAI**: Supports models like GPT-5.6 (Sol/Terra/Luna), GPT-5.5, GPT-5.4 Pro, GPT-5.4, GPT-5.4 Mini, GPT-5.4 Nano, GPT-5.1, GPT-5 (Nano/Mini/Standard), GPT-4.1 (including mini and nano), GPT-4, GPT-4o-mini, O3-mini, o1, o1-mini
|
|
1169
1280
|
- **OpenAI-Compatible**: Supports arbitrary local/self-hosted model IDs via OpenAI-compatible endpoints. Vision capability is treated as `unknown` unless your app knows the endpoint-specific model catalog.
|
|
1170
1281
|
- **Gemini**: Supports recommended models like Gemini 3.6 Flash, Gemini 3.5 Flash, Gemini 3.5 Flash-Lite, Gemini 3.1 Flash-Lite, Gemini 3.1 Pro Preview, Gemini 3 Flash Preview, Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.5 Flash Lite, Gemma 4 31B IT, and Gemma 4 26B A4B IT. Gemini 3 Flash models default to minimal thinking for chat-style responses, while Gemini 3 Pro models default to low. Deprecated lifecycle models such as Gemini 3.1 Flash-Lite Preview, Gemini 3 Pro Preview, and Gemini 2.5 Flash Lite Preview remain exported for explicit use.
|
|
1171
|
-
- **Claude**: Supports current Claude API model IDs including Claude Sonnet 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Opus 4.5, Claude Sonnet 4.6, Claude Sonnet 4.5, Claude Haiku 4.5, plus deprecated-but-still-available Claude 4 Opus, Claude 4 Sonnet, and Claude 3 Haiku
|
|
1172
|
-
- **OpenRouter**: Supports a curated OpenRouter model list (OpenAI/Claude/Gemini/Z.ai/Kimi). See the OpenRouter section for model IDs.
|
|
1282
|
+
- **Claude**: Supports current Claude API model IDs including Claude Opus 5, Claude Sonnet 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Opus 4.5, Claude Sonnet 4.6, Claude Sonnet 4.5, Claude Haiku 4.5, plus deprecated-but-still-available Claude 4 Opus, Claude 4 Sonnet, and Claude 3 Haiku. Adjustable `reasoning_effort` is sent as `output_config.effort` only for models that support it
|
|
1283
|
+
- **OpenRouter**: Supports a curated OpenRouter model list (OpenAI/Claude/Gemini/Z.ai/xAI/Kimi/DeepSeek/Kwaipilot). See the OpenRouter section for model IDs.
|
|
1173
1284
|
- **Z.ai**: Supports GLM-5.2/GLM-5.1/GLM-5/GLM-5-Turbo (text), GLM-4.7/4.6 (text), and GLM-5V-Turbo/GLM-4.6V family (vision)
|
|
1174
1285
|
- **xAI**: Supports Grok 4.5 with `reasoning_effort: 'low'` by default for chat-style responses, plus Grok 4.3, Grok 4.20 Reasoning/Non-Reasoning, and Grok 4-1 Fast Reasoning/Non-Reasoning, all with vision support.
|
|
1175
|
-
- **Kimi**: Supports Kimi K3 (`kimi-k3`, max reasoning
|
|
1176
|
-
- **DeepSeek**: Supports DeepSeek V4 Flash (`deepseek-v4-flash`) and DeepSeek V4 Pro (`deepseek-v4-pro`) via OpenAI-compatible Chat Completions. Legacy aliases `deepseek-chat` and `deepseek-reasoner` are deprecated by DeepSeek.
|
|
1286
|
+
- **Kimi**: Supports Kimi K3 (`kimi-k3`, `low` / `high` / `max` reasoning with `max` as the default), Kimi K2.7 Code (`kimi-k2.7-code`), Kimi K2.7 Code HighSpeed (`kimi-k2.7-code-highspeed`), Kimi K2.6 (`kimi-k2.6`, default), and Kimi K2.5 (`kimi-k2.5`) with vision support
|
|
1287
|
+
- **DeepSeek**: Supports DeepSeek V4 Flash (`deepseek-v4-flash`) and DeepSeek V4 Pro (`deepseek-v4-pro`) via OpenAI-compatible Chat Completions. Thinking defaults to disabled for low-latency chat and can be enabled with model-aware `reasoning_effort`. Legacy aliases `deepseek-chat` and `deepseek-reasoner` are deprecated by DeepSeek.
|
|
1177
1288
|
- **Mistral**: Supports the Ministral 3 family (`ministral-3b-2512`, `ministral-8b-2512`, `ministral-14b-2512`) and current Mistral generalist models, with streaming and vision support. Adjustable `reasoning_effort` is only sent for supported models.
|
|
1178
1289
|
- **Sakana AI**: Supports Fugu (`fugu`) and Fugu Ultra (`fugu-ultra`, `fugu-ultra-20260615`) via OpenAI-compatible Chat Completions.
|
|
1179
1290
|
- **PLaMo**: Supports PLaMo 3.0 Prime (`plamo-3.0-prime`, default) and PLaMo 2.2 Prime (`plamo-2.2-prime`) via OpenAI-compatible Chat Completions.
|
|
1180
|
-
- **Gemini Nano**: Chrome built-in AI (LanguageModel API). Runs on-device with no API key required. Chrome
|
|
1291
|
+
- **Gemini Nano**: Chrome built-in AI (LanguageModel API). Runs on-device with no API key required. Web pages require Chrome 148+ on a supported desktop device; no Chrome flags are required. Non-streaming, no vision support.
|
|
1181
1292
|
|
|
1182
1293
|
## License
|
|
1183
1294
|
|
|
@@ -13,5 +13,20 @@ export declare const MODEL_CLAUDE_4_6_OPUS = "claude-opus-4-6";
|
|
|
13
13
|
export declare const MODEL_CLAUDE_4_7_OPUS = "claude-opus-4-7";
|
|
14
14
|
export declare const MODEL_CLAUDE_4_8_OPUS = "claude-opus-4-8";
|
|
15
15
|
export declare const MODEL_CLAUDE_5_SONNET = "claude-sonnet-5";
|
|
16
|
+
export declare const MODEL_CLAUDE_5_OPUS = "claude-opus-5";
|
|
17
|
+
export type ClaudeReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
16
18
|
export declare const CLAUDE_VISION_SUPPORTED_MODELS: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Return the effort values supported by a Claude model.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getClaudeSupportedReasoningEfforts(model: string): readonly ClaudeReasoningEffort[];
|
|
23
|
+
export declare function isClaudeReasoningEffortModel(model: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Claude API defaults to high effort when output_config.effort is omitted.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDefaultClaudeReasoningEffort(model: string): ClaudeReasoningEffort | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Normalize UI state when switching between Claude models.
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeClaudeReasoningEffort(model: string, effort?: ClaudeReasoningEffort): ClaudeReasoningEffort | undefined;
|
|
17
32
|
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/constants/claude.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,0CAA0C,CAAC;AAG3E,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/constants/claude.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,0CAA0C,CAAC;AAG3E,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAgChF,eAAO,MAAM,8BAA8B,UAa1C,CAAC;AAEF;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,GACZ,SAAS,qBAAqB,EAAE,CAElC;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,GACZ,qBAAqB,GAAG,SAAS,CAEnC;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,qBAAqB,GAC7B,qBAAqB,GAAG,SAAS,CAenC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLAUDE_VISION_SUPPORTED_MODELS = exports.MODEL_CLAUDE_5_SONNET = exports.MODEL_CLAUDE_4_8_OPUS = exports.MODEL_CLAUDE_4_7_OPUS = exports.MODEL_CLAUDE_4_6_OPUS = exports.MODEL_CLAUDE_4_6_SONNET = exports.MODEL_CLAUDE_4_5_OPUS = exports.MODEL_CLAUDE_4_5_HAIKU = exports.MODEL_CLAUDE_4_5_SONNET = exports.MODEL_CLAUDE_4_OPUS = exports.MODEL_CLAUDE_4_SONNET = exports.MODEL_CLAUDE_3_7_SONNET = exports.MODEL_CLAUDE_3_5_SONNET = exports.MODEL_CLAUDE_3_5_HAIKU = exports.MODEL_CLAUDE_3_HAIKU = exports.ENDPOINT_CLAUDE_API = void 0;
|
|
3
|
+
exports.CLAUDE_VISION_SUPPORTED_MODELS = exports.MODEL_CLAUDE_5_OPUS = exports.MODEL_CLAUDE_5_SONNET = exports.MODEL_CLAUDE_4_8_OPUS = exports.MODEL_CLAUDE_4_7_OPUS = exports.MODEL_CLAUDE_4_6_OPUS = exports.MODEL_CLAUDE_4_6_SONNET = exports.MODEL_CLAUDE_4_5_OPUS = exports.MODEL_CLAUDE_4_5_HAIKU = exports.MODEL_CLAUDE_4_5_SONNET = exports.MODEL_CLAUDE_4_OPUS = exports.MODEL_CLAUDE_4_SONNET = exports.MODEL_CLAUDE_3_7_SONNET = exports.MODEL_CLAUDE_3_5_SONNET = exports.MODEL_CLAUDE_3_5_HAIKU = exports.MODEL_CLAUDE_3_HAIKU = exports.ENDPOINT_CLAUDE_API = void 0;
|
|
4
|
+
exports.getClaudeSupportedReasoningEfforts = getClaudeSupportedReasoningEfforts;
|
|
5
|
+
exports.isClaudeReasoningEffortModel = isClaudeReasoningEffortModel;
|
|
6
|
+
exports.getDefaultClaudeReasoningEffort = getDefaultClaudeReasoningEffort;
|
|
7
|
+
exports.normalizeClaudeReasoningEffort = normalizeClaudeReasoningEffort;
|
|
4
8
|
exports.ENDPOINT_CLAUDE_API = 'https://api.anthropic.com/v1/messages';
|
|
5
9
|
// claude model
|
|
6
10
|
exports.MODEL_CLAUDE_3_HAIKU = 'claude-3-haiku-20240307';
|
|
@@ -17,6 +21,30 @@ exports.MODEL_CLAUDE_4_6_OPUS = 'claude-opus-4-6';
|
|
|
17
21
|
exports.MODEL_CLAUDE_4_7_OPUS = 'claude-opus-4-7';
|
|
18
22
|
exports.MODEL_CLAUDE_4_8_OPUS = 'claude-opus-4-8';
|
|
19
23
|
exports.MODEL_CLAUDE_5_SONNET = 'claude-sonnet-5';
|
|
24
|
+
exports.MODEL_CLAUDE_5_OPUS = 'claude-opus-5';
|
|
25
|
+
const CLAUDE_STANDARD_REASONING_EFFORTS = [
|
|
26
|
+
'low',
|
|
27
|
+
'medium',
|
|
28
|
+
'high',
|
|
29
|
+
];
|
|
30
|
+
const CLAUDE_MAX_REASONING_EFFORTS = [
|
|
31
|
+
...CLAUDE_STANDARD_REASONING_EFFORTS,
|
|
32
|
+
'max',
|
|
33
|
+
];
|
|
34
|
+
const CLAUDE_XHIGH_REASONING_EFFORTS = [
|
|
35
|
+
...CLAUDE_STANDARD_REASONING_EFFORTS,
|
|
36
|
+
'xhigh',
|
|
37
|
+
'max',
|
|
38
|
+
];
|
|
39
|
+
const CLAUDE_REASONING_EFFORTS_BY_MODEL = {
|
|
40
|
+
[exports.MODEL_CLAUDE_4_5_OPUS]: CLAUDE_STANDARD_REASONING_EFFORTS,
|
|
41
|
+
[exports.MODEL_CLAUDE_4_6_SONNET]: CLAUDE_MAX_REASONING_EFFORTS,
|
|
42
|
+
[exports.MODEL_CLAUDE_4_6_OPUS]: CLAUDE_MAX_REASONING_EFFORTS,
|
|
43
|
+
[exports.MODEL_CLAUDE_4_7_OPUS]: CLAUDE_XHIGH_REASONING_EFFORTS,
|
|
44
|
+
[exports.MODEL_CLAUDE_4_8_OPUS]: CLAUDE_XHIGH_REASONING_EFFORTS,
|
|
45
|
+
[exports.MODEL_CLAUDE_5_SONNET]: CLAUDE_XHIGH_REASONING_EFFORTS,
|
|
46
|
+
[exports.MODEL_CLAUDE_5_OPUS]: CLAUDE_XHIGH_REASONING_EFFORTS,
|
|
47
|
+
};
|
|
20
48
|
exports.CLAUDE_VISION_SUPPORTED_MODELS = [
|
|
21
49
|
exports.MODEL_CLAUDE_3_HAIKU,
|
|
22
50
|
exports.MODEL_CLAUDE_4_SONNET,
|
|
@@ -29,5 +57,37 @@ exports.CLAUDE_VISION_SUPPORTED_MODELS = [
|
|
|
29
57
|
exports.MODEL_CLAUDE_4_7_OPUS,
|
|
30
58
|
exports.MODEL_CLAUDE_4_8_OPUS,
|
|
31
59
|
exports.MODEL_CLAUDE_5_SONNET,
|
|
60
|
+
exports.MODEL_CLAUDE_5_OPUS,
|
|
32
61
|
];
|
|
62
|
+
/**
|
|
63
|
+
* Return the effort values supported by a Claude model.
|
|
64
|
+
*/
|
|
65
|
+
function getClaudeSupportedReasoningEfforts(model) {
|
|
66
|
+
return CLAUDE_REASONING_EFFORTS_BY_MODEL[model] ?? [];
|
|
67
|
+
}
|
|
68
|
+
function isClaudeReasoningEffortModel(model) {
|
|
69
|
+
return getClaudeSupportedReasoningEfforts(model).length > 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Claude API defaults to high effort when output_config.effort is omitted.
|
|
73
|
+
*/
|
|
74
|
+
function getDefaultClaudeReasoningEffort(model) {
|
|
75
|
+
return isClaudeReasoningEffortModel(model) ? 'high' : undefined;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Normalize UI state when switching between Claude models.
|
|
79
|
+
*/
|
|
80
|
+
function normalizeClaudeReasoningEffort(model, effort) {
|
|
81
|
+
const supported = getClaudeSupportedReasoningEfforts(model);
|
|
82
|
+
if (supported.length === 0) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
if (!effort) {
|
|
86
|
+
return getDefaultClaudeReasoningEffort(model);
|
|
87
|
+
}
|
|
88
|
+
if (supported.includes(effort)) {
|
|
89
|
+
return effort;
|
|
90
|
+
}
|
|
91
|
+
return 'high';
|
|
92
|
+
}
|
|
33
93
|
//# sourceMappingURL=claude.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/constants/claude.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/constants/claude.ts"],"names":[],"mappings":";;;AAqEA,gFAIC;AAED,oEAEC;AAKD,0EAIC;AAKD,wEAkBC;AA7GY,QAAA,mBAAmB,GAAG,uCAAuC,CAAC;AAE3E,eAAe;AACF,QAAA,oBAAoB,GAAG,yBAAyB,CAAC;AACjD,QAAA,sBAAsB,GAAG,2BAA2B,CAAC;AACrD,QAAA,uBAAuB,GAAG,4BAA4B,CAAC;AACvD,QAAA,uBAAuB,GAAG,4BAA4B,CAAC;AACvD,QAAA,qBAAqB,GAAG,0BAA0B,CAAC;AACnD,QAAA,mBAAmB,GAAG,wBAAwB,CAAC;AAC/C,QAAA,uBAAuB,GAAG,4BAA4B,CAAC;AACvD,QAAA,sBAAsB,GAAG,2BAA2B,CAAC;AACrD,QAAA,qBAAqB,GAAG,0BAA0B,CAAC;AACnD,QAAA,uBAAuB,GAAG,mBAAmB,CAAC;AAC9C,QAAA,qBAAqB,GAAG,iBAAiB,CAAC;AAC1C,QAAA,qBAAqB,GAAG,iBAAiB,CAAC;AAC1C,QAAA,qBAAqB,GAAG,iBAAiB,CAAC;AAC1C,QAAA,qBAAqB,GAAG,iBAAiB,CAAC;AAC1C,QAAA,mBAAmB,GAAG,eAAe,CAAC;AAInD,MAAM,iCAAiC,GAAqC;IAC1E,KAAK;IACL,QAAQ;IACR,MAAM;CACP,CAAC;AAEF,MAAM,4BAA4B,GAAqC;IACrE,GAAG,iCAAiC;IACpC,KAAK;CACN,CAAC;AAEF,MAAM,8BAA8B,GAAqC;IACvE,GAAG,iCAAiC;IACpC,OAAO;IACP,KAAK;CACN,CAAC;AAEF,MAAM,iCAAiC,GAGnC;IACF,CAAC,6BAAqB,CAAC,EAAE,iCAAiC;IAC1D,CAAC,+BAAuB,CAAC,EAAE,4BAA4B;IACvD,CAAC,6BAAqB,CAAC,EAAE,4BAA4B;IACrD,CAAC,6BAAqB,CAAC,EAAE,8BAA8B;IACvD,CAAC,6BAAqB,CAAC,EAAE,8BAA8B;IACvD,CAAC,6BAAqB,CAAC,EAAE,8BAA8B;IACvD,CAAC,2BAAmB,CAAC,EAAE,8BAA8B;CACtD,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,4BAAoB;IACpB,6BAAqB;IACrB,2BAAmB;IACnB,+BAAuB;IACvB,8BAAsB;IACtB,6BAAqB;IACrB,+BAAuB;IACvB,6BAAqB;IACrB,6BAAqB;IACrB,6BAAqB;IACrB,6BAAqB;IACrB,2BAAmB;CACpB,CAAC;AAEF;;GAEG;AACH,SAAgB,kCAAkC,CAChD,KAAa;IAEb,OAAO,iCAAiC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED,SAAgB,4BAA4B,CAAC,KAAa;IACxD,OAAO,kCAAkC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAgB,+BAA+B,CAC7C,KAAa;IAEb,OAAO,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAED;;GAEG;AACH,SAAgB,8BAA8B,CAC5C,KAAa,EACb,MAA8B;IAE9B,MAAM,SAAS,GAAG,kCAAkC,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|