diff --git a/.env.example b/.env.example index 66539b6340..06d43070c1 100644 --- a/.env.example +++ b/.env.example @@ -5,6 +5,7 @@ # ANTHROPIC_API_KEY=sk-ant-xxx # OPENAI_API_KEY=sk-xxx # GEMINI_API_KEY=xxx +# CEREBRAS_API_KEY=xxx # ── Chat Channel ────────────────────────── # TELEGRAM_BOT_TOKEN=123456:ABC... diff --git a/README.ja.md b/README.ja.md index e33b312f93..355eef7de3 100644 --- a/README.ja.md +++ b/README.ja.md @@ -618,6 +618,22 @@ HEARTBEAT_OK 応答 ユーザーが直接結果を受け取る - `PICOCLAW_HEARTBEAT_ENABLED=false` で無効化 - `PICOCLAW_HEARTBEAT_INTERVAL=60` で間隔変更 +### プロバイダー + +> [!NOTE] +> Groq は Whisper による無料の音声文字起こしを提供しています。設定すると、Telegram の音声メッセージが自動的に文字起こしされます。 + +| プロバイダー | 用途 | API キー取得先 | +| --- | --- | --- | +| `gemini` | LLM(Gemini 直接) | [aistudio.google.com](https://aistudio.google.com) | +| `zhipu` | LLM(Zhipu 直接) | [bigmodel.cn](https://bigmodel.cn) | +| `openrouter`(要テスト) | LLM(推奨、全モデルにアクセス可能) | [openrouter.ai](https://openrouter.ai) | +| `anthropic`(要テスト) | LLM(Claude 直接) | [console.anthropic.com](https://console.anthropic.com) | +| `openai`(要テスト) | LLM(GPT 直接) | [platform.openai.com](https://platform.openai.com) | +| `deepseek`(要テスト) | LLM(DeepSeek 直接) | [platform.deepseek.com](https://platform.deepseek.com) | +| `groq` | LLM + **音声文字起こし**(Whisper) | [console.groq.com](https://console.groq.com) | +| `cerebras` | LLM(Cerebras 直接) | [cerebras.ai](https://cerebras.ai) | + ### 基本設定 1. **設定ファイルの作成:** @@ -767,3 +783,4 @@ Web 検索を有効にするには: | **Zhipu** | 月 200K トークン | 中国ユーザー向け最適 | | **Brave Search** | 月 2000 クエリ | Web 検索機能 | | **Groq** | 無料枠あり | 高速推論(Llama, Mixtral) | +| **Cerebras** | 無料枠あり | 高速推論(Llama, Qwen など) | diff --git a/README.md b/README.md index 0a9dacce60..d46b626412 100644 --- a/README.md +++ b/README.md @@ -664,6 +664,7 @@ The subagent has access to tools (message, web_search, etc.) and can communicate | `openai(To be tested)` | LLM (GPT direct) | [platform.openai.com](https://platform.openai.com) | | `deepseek(To be tested)` | LLM (DeepSeek direct) | [platform.deepseek.com](https://platform.deepseek.com) | | `groq` | LLM + **Voice transcription** (Whisper) | [console.groq.com](https://console.groq.com) | +| `cerebras` | LLM (Cerebras direct) | [cerebras.ai](https://cerebras.ai) |
Zhipu @@ -856,3 +857,4 @@ This happens when another instance of the bot is running. Make sure only one `pi | **Zhipu** | 200K tokens/month | Best for Chinese users | | **Brave Search** | 2000 queries/month | Web search functionality | | **Groq** | Free tier available | Fast inference (Llama, Mixtral) | +| **Cerebras** | Free tier available | Fast inference (Llama, Qwen, etc.) | diff --git a/README.zh.md b/README.zh.md index 2ca2987bbe..7f6ea8eeb3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -535,6 +535,7 @@ Agent 读取 HEARTBEAT.md | `openai(待测试)` | LLM (GPT 直连) | [platform.openai.com](https://platform.openai.com) | | `deepseek(待测试)` | LLM (DeepSeek 直连) | [platform.deepseek.com](https://platform.deepseek.com) | | `groq` | LLM + **语音转录** (Whisper) | [console.groq.com](https://console.groq.com) | +| `cerebras` | LLM (Cerebras 直连) | [cerebras.ai](https://cerebras.ai) |
智谱 (Zhipu) 配置示例 @@ -718,4 +719,5 @@ Discord: [https://discord.gg/V4sAZ9XWpN](https://discord.gg/V4sAZ9XWpN) | **OpenRouter** | 200K tokens/月 | 多模型聚合 (Claude, GPT-4 等) | | **智谱 (Zhipu)** | 200K tokens/月 | 最适合中国用户 | | **Brave Search** | 2000 次查询/月 | 网络搜索功能 | -| **Groq** | 提供免费层级 | 极速推理 (Llama, Mixtral) | \ No newline at end of file +| **Groq** | 提供免费层级 | 极速推理 (Llama, Mixtral) | +| **Cerebras** | 提供免费层级 | 极速推理 (Llama, Qwen 等) | \ No newline at end of file diff --git a/config/config.example.json b/config/config.example.json index 3c9158e9c7..96a31bbd2b 100644 --- a/config/config.example.json +++ b/config/config.example.json @@ -111,6 +111,10 @@ "ollama": { "api_key": "", "api_base": "http://localhost:11434/v1" + }, + "cerebras": { + "api_key": "", + "api_base": "" } }, "tools": { diff --git a/pkg/config/config.go b/pkg/config/config.go index d189ff00bf..cfc40e6e37 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -179,6 +179,7 @@ type ProvidersConfig struct { Moonshot ProviderConfig `json:"moonshot"` ShengSuanYun ProviderConfig `json:"shengsuanyun"` DeepSeek ProviderConfig `json:"deepseek"` + Cerebras ProviderConfig `json:"cerebras"` GitHubCopilot ProviderConfig `json:"github_copilot"` } @@ -305,6 +306,7 @@ func DefaultConfig() *Config { Nvidia: ProviderConfig{}, Moonshot: ProviderConfig{}, ShengSuanYun: ProviderConfig{}, + Cerebras: ProviderConfig{}, }, Gateway: GatewayConfig{ Host: "0.0.0.0", @@ -406,6 +408,9 @@ func (c *Config) GetAPIKey() string { if c.Providers.ShengSuanYun.APIKey != "" { return c.Providers.ShengSuanYun.APIKey } + if c.Providers.Cerebras.APIKey != "" { + return c.Providers.Cerebras.APIKey + } return "" } diff --git a/pkg/providers/http_provider.go b/pkg/providers/http_provider.go index 4cf2c6db25..00d4d6fa7e 100644 --- a/pkg/providers/http_provider.go +++ b/pkg/providers/http_provider.go @@ -56,7 +56,7 @@ func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []Too // Strip provider prefix from model name (e.g., moonshot/kimi-k2.5 -> kimi-k2.5, groq/openai/gpt-oss-120b -> openai/gpt-oss-120b, ollama/qwen2.5:14b -> qwen2.5:14b) if idx := strings.Index(model, "/"); idx != -1 { prefix := model[:idx] - if prefix == "moonshot" || prefix == "nvidia" || prefix == "groq" || prefix == "ollama" { + if prefix == "moonshot" || prefix == "nvidia" || prefix == "groq" || prefix == "ollama" || prefix == "cerebras" { model = model[idx+1:] } } @@ -313,6 +313,14 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) { workspace = "." } return NewCodexCliProvider(workspace), nil + case "cerebras": + if cfg.Providers.Cerebras.APIKey != "" { + apiKey = cfg.Providers.Cerebras.APIKey + apiBase = cfg.Providers.Cerebras.APIBase + if apiBase == "" { + apiBase = "https://api.cerebras.ai/v1" + } + } case "deepseek": if cfg.Providers.DeepSeek.APIKey != "" { apiKey = cfg.Providers.DeepSeek.APIKey @@ -409,6 +417,14 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) { if apiBase == "" { apiBase = "https://integrate.api.nvidia.com/v1" } + case (strings.Contains(lowerModel, "cerebras") || strings.HasPrefix(model, "cerebras/")) && cfg.Providers.Cerebras.APIKey != "": + apiKey = cfg.Providers.Cerebras.APIKey + apiBase = cfg.Providers.Cerebras.APIBase + proxy = cfg.Providers.Cerebras.Proxy + if apiBase == "" { + apiBase = "https://api.cerebras.ai/v1" + } + case (strings.Contains(lowerModel, "ollama") || strings.HasPrefix(model, "ollama/")) && cfg.Providers.Ollama.APIKey != "": fmt.Println("Ollama provider selected based on model name prefix") apiKey = cfg.Providers.Ollama.APIKey