docs: update provider information in all README files

- Updated provider sections in all language versions (English, Chinese, Japanese, Portuguese, Vietnamese)
- Added detailed provider tables with configuration keys, API key formats, and default API bases
- Included configuration examples for all supported providers
- Added provider architecture explanation and model compatibility information
- Updated API key acquisition links and free tier information
- Removed outdated '待测试' (pending testing) labels from Chinese docs
This commit is contained in:
nzlov 2026-02-18 16:39:52 +00:00
parent b1e3b11a5d
commit 521b13b91c
5 changed files with 514 additions and 117 deletions

View file

@ -621,98 +621,115 @@ HEARTBEAT_OK 応答 ユーザーが直接結果を受け取る
- `PICOCLAW_HEARTBEAT_ENABLED=false` で無効化 - `PICOCLAW_HEARTBEAT_ENABLED=false` で無効化
- `PICOCLAW_HEARTBEAT_INTERVAL=60` で間隔変更 - `PICOCLAW_HEARTBEAT_INTERVAL=60` で間隔変更
### 基本設定 ### プロバイダー (Providers)
1. **設定ファイルの作成:** PicoClaw は統一された設定インターフェースを通じて複数の AI モデルプロバイダーをサポートします。すべてのプロバイダーは `config.json``providers` セクションで設定されます。
```bash > [!NOTE]
cp config.example.json config/config.json > Groq は Whisper を通じて無料の音声文字起こしを提供します。設定されている場合、Telegram の音声メッセージは自動的に文字起こしされます。
```
2. **設定の編集:** #### サポートされているプロバイダー
```json 設定ファイルに基づき、PicoClaw は現在以下のプロバイダーをサポートしています:
{
"providers": {
"openrouter": {
"api_key": "sk-or-v1-..."
}
},
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_DISCORD_BOT_TOKEN"
}
}
}
```
3. **実行** | プロバイダー | 設定キー | API キー形式 | デフォルト API Base | 備考 |
|-------------|----------|--------------|---------------------|------|
| **Anthropic** | `anthropic` | Anthropic API キー | `https://api.anthropic.com` | Claude モデル (Claude 3.5 Sonnet, Claude 3 Opus など) |
| **OpenAI** | `openai` | OpenAI API キー | `https://api.openai.com/v1` | GPT-4, GPT-3.5 など。有効時は Web 検索をサポート |
| **OpenRouter** | `openrouter` | `sk-or-v1-xxx` | `https://openrouter.ai/api/v1` | 複数プロバイダーからのモデルへのアクセス |
| **Groq** | `groq` | `gsk_xxx` | `https://api.groq.com/openai/v1` | Llama、Mixtral モデルでの高速推論 + Whisper 音声文字起こし |
| **智譜 (Zhipu)** | `zhipu` | 智譜 API キー | `https://open.bigmodel.cn/api/paas/v4` | GLM モデル (GLM-4, GLM-4V など) |
| **Gemini** | `gemini` | Google AI Studio API キー | `https://generativelanguage.googleapis.com/v1beta` | Gemini モデル (Gemini Pro, Gemini Flash など) |
| **vLLM** | `vllm` | (オプション) | `http://localhost:8000/v1` | セルフホストモデル用のローカル vLLM サーバー |
| **NVIDIA** | `nvidia` | `nvapi-xxx` | `https://integrate.api.nvidia.com/v1` | NVIDIA NIM モデル、プロキシ設定をサポート |
| **Moonshot** | `moonshot` | `sk-xxx` | `https://api.moonshot.cn/v1` | Moonshot AI モデル (Kimi など) |
| **Ollama** | `ollama` | (オプション) | `http://localhost:11434/v1` | ローカルモデル実行用のローカル Ollama サーバー |
```bash #### 設定例
picoclaw agent -m "Hello"
```
</details>
<details>
<summary><b>完全な設定例</b></summary>
```json ```json
{ {
"agents": {
"defaults": {
"model": "anthropic/claude-opus-4-5"
}
},
"providers": { "providers": {
"anthropic": {
"api_key": "your-anthropic-api-key",
"api_base": "https://api.anthropic.com"
},
"openai": {
"api_key": "your-openai-api-key",
"api_base": "https://api.openai.com/v1",
"web_search": true
},
"openrouter": { "openrouter": {
"apiKey": "sk-or-v1-xxx" "api_key": "sk-or-v1-your-openrouter-key",
"api_base": "https://openrouter.ai/api/v1"
}, },
"groq": { "groq": {
"apiKey": "gsk_xxx" "api_key": "gsk_your-groq-key",
"api_base": "https://api.groq.com/openai/v1"
},
"zhipu": {
"api_key": "your-zhipu-api-key",
"api_base": "https://open.bigmodel.cn/api/paas/v4"
},
"gemini": {
"api_key": "your-google-ai-studio-key",
"api_base": "https://generativelanguage.googleapis.com/v1beta"
},
"vllm": {
"api_key": "",
"api_base": "http://localhost:8000/v1"
},
"nvidia": {
"api_key": "nvapi-your-nvidia-key",
"api_base": "https://integrate.api.nvidia.com/v1",
"proxy": "http://127.0.0.1:7890"
},
"moonshot": {
"api_key": "sk-your-moonshot-key",
"api_base": "https://api.moonshot.cn/v1"
},
"ollama": {
"api_key": "",
"api_base": "http://localhost:11434/v1"
} }
},
"channels": {
"telegram": {
"enabled": true,
"token": "123456:ABC...",
"allow_from": ["123456789"]
},
"discord": {
"enabled": true,
"token": "",
"allow_from": [""]
},
"whatsapp": {
"enabled": false
},
"feishu": {
"enabled": false,
"appId": "cli_xxx",
"appSecret": "xxx",
"encryptKey": "",
"verificationToken": "",
"allow_from": []
}
},
"tools": {
"web": {
"search": {
"apiKey": "BSA..."
}
},
"cron": {
"exec_timeout_minutes": 5
}
},
"heartbeat": {
"enabled": true,
"interval": 30
} }
} }
``` ```
</details> #### プロバイダーアーキテクチャ
PicoClaw はプロトコルファミリーごとにプロバイダーをルーティングします:
- **OpenAI 互換プロトコル**: OpenRouter, OpenAI, Groq, Zhipu, vLLM, NVIDIA, Moonshot, Ollama エンドポイント。
- **Anthropic プロトコル**: Claude ネイティブ API 動作。
- **Gemini プロトコル**: Google の Gemini API。
これによりランタイムを軽量に保ちながら、新しい OpenAI 互換バックエンドはほとんど設定操作 (`api_base` + `api_key`) のみで済みます。
#### API キーの取得
| プロバイダー | API キー取得先 | 無料枠 |
|-------------|----------------|--------|
| **Anthropic** | [console.anthropic.com](https://console.anthropic.com) | 限定無料クレジット |
| **OpenAI** | [platform.openai.com](https://platform.openai.com) | 新規ユーザー $5 無料クレジット |
| **OpenRouter** | [openrouter.ai/keys](https://openrouter.ai/keys) | 月 200K トークン無料 |
| **Groq** | [console.groq.com](https://console.groq.com) | 無料枠あり |
| **智譜 (Zhipu)** | [bigmodel.cn](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) | 月 200K トークン無料 |
| **Gemini** | [aistudio.google.com](https://aistudio.google.com) | 制限付き無料枠 |
| **NVIDIA** | [build.nvidia.com](https://build.nvidia.com) | 無料クレジットあり |
| **Moonshot** | [platform.moonshot.cn](https://platform.moonshot.cn) | 無料枠あり |
| **Ollama** | [ollama.com](https://ollama.com) | 無料 (セルフホスト) |
#### モデル互換性
ほとんどのプロバイダーは標準の OpenAI API 形式をサポートしており、切り替えが容易です。例えば:
- OpenAI には `model: "gpt-4"` を使用
- Anthropic には `model: "claude-3-5-sonnet-20241022"` を使用
- Zhipu には `model: "glm-4"` を使用
- Gemini には `model: "gemini-1.5-pro"` を使用
- Groq には `model: "llama-3.1-70b"` を使用
- OpenRouter には `model: "qwen-2.5-32b"` を使用
## CLI リファレンス ## CLI リファレンス

125
README.md
View file

@ -239,10 +239,20 @@ picoclaw onboard
**3. Get API Keys** **3. Get API Keys**
* **LLM Provider**: [OpenRouter](https://openrouter.ai/keys) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) · [Anthropic](https://console.anthropic.com) · [OpenAI](https://platform.openai.com) · [Gemini](https://aistudio.google.com/api-keys) * **LLM Providers**:
- [OpenRouter](https://openrouter.ai/keys) (recommended, access to multiple models)
- [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) (GLM models)
- [Anthropic](https://console.anthropic.com) (Claude models)
- [OpenAI](https://platform.openai.com) (GPT models)
- [Gemini](https://aistudio.google.com/api-keys) (Google AI models)
- [Groq](https://console.groq.com) (fast inference + Whisper voice transcription)
- [Moonshot](https://platform.moonshot.cn) (Kimi models)
- [NVIDIA](https://build.nvidia.com) (NIM models)
- [vLLM](https://vllm.readthedocs.io) (self-hosted models)
- [Ollama](https://ollama.com) (local models)
* **Web Search** (optional): [Brave Search](https://brave.com/search/api) - Free tier available (2000 requests/month) * **Web Search** (optional): [Brave Search](https://brave.com/search/api) - Free tier available (2000 requests/month)
> **Note**: See `config.example.json` for a complete configuration template. > **Note**: See `config.example.json` for a complete configuration template with all supported providers.
**4. Chat** **4. Chat**
@ -666,29 +676,114 @@ The subagent has access to tools (message, web_search, etc.) and can communicate
### Providers ### Providers
PicoClaw supports multiple AI model providers through a unified configuration interface. All providers are configured in the `providers` section of `config.json`.
> [!NOTE] > [!NOTE]
> Groq provides free voice transcription via Whisper. If configured, Telegram voice messages will be automatically transcribed. > Groq provides free voice transcription via Whisper. If configured, Telegram voice messages will be automatically transcribed.
| Provider | Purpose | Get API Key | #### Supported Providers
| -------------------------- | --------------------------------------- | ------------------------------------------------------ |
| `gemini` | LLM (Gemini direct) | [aistudio.google.com](https://aistudio.google.com) |
| `zhipu` | LLM (Zhipu direct) | [bigmodel.cn](bigmodel.cn) |
| `openrouter(To be tested)` | LLM (recommended, access to all models) | [openrouter.ai](https://openrouter.ai) |
| `anthropic(To be tested)` | LLM (Claude direct) | [console.anthropic.com](https://console.anthropic.com) |
| `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) |
### Provider Architecture Based on the configuration file, PicoClaw currently supports the following providers:
| Provider | Configuration Key | API Key Format | Default API Base | Notes |
|----------|-------------------|----------------|------------------|-------|
| **Anthropic** | `anthropic` | Your Anthropic API key | `https://api.anthropic.com` | Claude models (Claude 3.5 Sonnet, Claude 3 Opus, etc.) |
| **OpenAI** | `openai` | Your OpenAI API key | `https://api.openai.com/v1` | GPT-4, GPT-3.5, etc. Supports web search when enabled |
| **OpenRouter** | `openrouter` | `sk-or-v1-xxx` | `https://openrouter.ai/api/v1` | Access to multiple models from different providers |
| **Groq** | `groq` | `gsk_xxx` | `https://api.groq.com/openai/v1` | Fast inference with Llama, Mixtral models + Whisper voice transcription |
| **Zhipu** | `zhipu` | Your Zhipu API key | `https://open.bigmodel.cn/api/paas/v4` | GLM models (GLM-4, GLM-4V, etc.) |
| **Gemini** | `gemini` | Your Google AI Studio API key | `https://generativelanguage.googleapis.com/v1beta` | Gemini models (Gemini Pro, Gemini Flash, etc.) |
| **vLLM** | `vllm` | (Optional) | `http://localhost:8000/v1` | Local vLLM server for self-hosted models |
| **NVIDIA** | `nvidia` | `nvapi-xxx` | `https://integrate.api.nvidia.com/v1` | NVIDIA NIM models, supports proxy configuration |
| **Moonshot** | `moonshot` | `sk-xxx` | `https://api.moonshot.cn/v1` | Moonshot AI models (Kimi, etc.) |
| **Ollama** | `ollama` | (Optional) | `http://localhost:11434/v1` | Local Ollama server for running models locally |
#### Configuration Example
```json
{
"providers": {
"anthropic": {
"api_key": "your-anthropic-api-key",
"api_base": "https://api.anthropic.com"
},
"openai": {
"api_key": "your-openai-api-key",
"api_base": "https://api.openai.com/v1",
"web_search": true
},
"openrouter": {
"api_key": "sk-or-v1-your-openrouter-key",
"api_base": "https://openrouter.ai/api/v1"
},
"groq": {
"api_key": "gsk_your-groq-key",
"api_base": "https://api.groq.com/openai/v1"
},
"zhipu": {
"api_key": "your-zhipu-api-key",
"api_base": "https://open.bigmodel.cn/api/paas/v4"
},
"gemini": {
"api_key": "your-google-ai-studio-key",
"api_base": "https://generativelanguage.googleapis.com/v1beta"
},
"vllm": {
"api_key": "",
"api_base": "http://localhost:8000/v1"
},
"nvidia": {
"api_key": "nvapi-your-nvidia-key",
"api_base": "https://integrate.api.nvidia.com/v1",
"proxy": "http://127.0.0.1:7890"
},
"moonshot": {
"api_key": "sk-your-moonshot-key",
"api_base": "https://api.moonshot.cn/v1"
},
"ollama": {
"api_key": "",
"api_base": "http://localhost:11434/v1"
}
}
}
```
#### Provider Architecture
PicoClaw routes providers by protocol family: PicoClaw routes providers by protocol family:
- OpenAI-compatible protocol: OpenRouter, OpenAI-compatible gateways, Groq, Zhipu, and vLLM-style endpoints. - **OpenAI-compatible protocol**: OpenRouter, OpenAI, Groq, Zhipu, vLLM, NVIDIA, Moonshot, and Ollama endpoints.
- Anthropic protocol: Claude-native API behavior. - **Anthropic protocol**: Claude-native API behavior.
- Codex/OAuth path: OpenAI OAuth/token authentication route. - **Gemini protocol**: Google's Gemini API.
This keeps the runtime lightweight while making new OpenAI-compatible backends mostly a config operation (`api_base` + `api_key`). This keeps the runtime lightweight while making new OpenAI-compatible backends mostly a config operation (`api_base` + `api_key`).
#### Getting API Keys
| Provider | Where to Get API Key | Free Tier |
|----------|----------------------|-----------|
| **Anthropic** | [console.anthropic.com](https://console.anthropic.com) | Limited free credits |
| **OpenAI** | [platform.openai.com](https://platform.openai.com) | $5 free credit for new users |
| **OpenRouter** | [openrouter.ai/keys](https://openrouter.ai/keys) | 200K tokens/month free |
| **Groq** | [console.groq.com](https://console.groq.com) | Free tier available |
| **Zhipu** | [bigmodel.cn](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) | 200K tokens/month free |
| **Gemini** | [aistudio.google.com](https://aistudio.google.com) | Free tier with limits |
| **NVIDIA** | [build.nvidia.com](https://build.nvidia.com) | Free credits available |
| **Moonshot** | [platform.moonshot.cn](https://platform.moonshot.cn) | Free tier available |
| **Ollama** | [ollama.com](https://ollama.com) | Free (self-hosted) |
#### Model Compatibility
Most providers support the standard OpenAI API format, making it easy to switch between them. For example:
- Use `model: "gpt-4"` for OpenAI
- Use `model: "claude-3-5-sonnet-20241022"` for Anthropic
- Use `model: "glm-4"` for Zhipu
- Use `model: "gemini-1.5-pro"` for Gemini
- Use `model: "llama-3.1-70b"` for Groq
- Use `model: "qwen-2.5-32b"` for OpenRouter
<details> <details>
<summary><b>Zhipu</b></summary> <summary><b>Zhipu</b></summary>

View file

@ -671,20 +671,115 @@ O subagente tem acesso às ferramentas (message, web_search, etc.) e pode se com
* `PICOCLAW_HEARTBEAT_ENABLED=false` para desabilitar * `PICOCLAW_HEARTBEAT_ENABLED=false` para desabilitar
* `PICOCLAW_HEARTBEAT_INTERVAL=60` para alterar o intervalo * `PICOCLAW_HEARTBEAT_INTERVAL=60` para alterar o intervalo
### Provedores ### Provedores (Providers)
O PicoClaw suporta múltiplos provedores de modelos de IA através de uma interface de configuração unificada. Todos os provedores são configurados na seção `providers` do `config.json`.
> [!NOTE] > [!NOTE]
> O Groq fornece transcrição de voz gratuita via Whisper. Se configurado, mensagens de voz do Telegram serão automaticamente transcritas. > O Groq fornece transcrição de voz gratuita via Whisper. Se configurado, mensagens de voz do Telegram serão automaticamente transcritas.
| Provedor | Finalidade | Obter API Key | #### Provedores Suportados
| --- | --- | --- |
| `gemini` | LLM (Gemini direto) | [aistudio.google.com](https://aistudio.google.com) | Com base no arquivo de configuração, o PicoClaw atualmente suporta os seguintes provedores:
| `zhipu` | LLM (Zhipu direto) | [bigmodel.cn](bigmodel.cn) |
| `openrouter` (Em teste) | LLM (recomendado, acesso a todos os modelos) | [openrouter.ai](https://openrouter.ai) | | Provedor | Chave de Configuração | Formato da API Key | API Base Padrão | Notas |
| `anthropic` (Em teste) | LLM (Claude direto) | [console.anthropic.com](https://console.anthropic.com) | |----------|----------------------|-------------------|-----------------|-------|
| `openai` (Em teste) | LLM (GPT direto) | [platform.openai.com](https://platform.openai.com) | | **Anthropic** | `anthropic` | Sua API key do Anthropic | `https://api.anthropic.com` | Modelos Claude (Claude 3.5 Sonnet, Claude 3 Opus, etc.) |
| `deepseek` (Em teste) | LLM (DeepSeek direto) | [platform.deepseek.com](https://platform.deepseek.com) | | **OpenAI** | `openai` | Sua API key do OpenAI | `https://api.openai.com/v1` | GPT-4, GPT-3.5, etc. Suporta busca web quando habilitado |
| `groq` | LLM + **Transcrição de voz** (Whisper) | [console.groq.com](https://console.groq.com) | | **OpenRouter** | `openrouter` | `sk-or-v1-xxx` | `https://openrouter.ai/api/v1` | Acesso a múltiplos modelos de diferentes provedores |
| **Groq** | `groq` | `gsk_xxx` | `https://api.groq.com/openai/v1` | Inferência rápida com modelos Llama, Mixtral + transcrição de voz Whisper |
| **Zhipu** | `zhipu` | Sua API key do Zhipu | `https://open.bigmodel.cn/api/paas/v4` | Modelos GLM (GLM-4, GLM-4V, etc.) |
| **Gemini** | `gemini` | Sua API key do Google AI Studio | `https://generativelanguage.googleapis.com/v1beta` | Modelos Gemini (Gemini Pro, Gemini Flash, etc.) |
| **vLLM** | `vllm` | (Opcional) | `http://localhost:8000/v1` | Servidor vLLM local para modelos auto-hospedados |
| **NVIDIA** | `nvidia` | `nvapi-xxx` | `https://integrate.api.nvidia.com/v1` | Modelos NVIDIA NIM, suporta configuração de proxy |
| **Moonshot** | `moonshot` | `sk-xxx` | `https://api.moonshot.cn/v1` | Modelos Moonshot AI (Kimi, etc.) |
| **Ollama** | `ollama` | (Opcional) | `http://localhost:11434/v1` | Servidor Ollama local para executar modelos localmente |
#### Exemplo de Configuração
```json
{
"providers": {
"anthropic": {
"api_key": "sua-chave-api-anthropic",
"api_base": "https://api.anthropic.com"
},
"openai": {
"api_key": "sua-chave-api-openai",
"api_base": "https://api.openai.com/v1",
"web_search": true
},
"openrouter": {
"api_key": "sk-or-v1-sua-chave-openrouter",
"api_base": "https://openrouter.ai/api/v1"
},
"groq": {
"api_key": "gsk_sua-chave-groq",
"api_base": "https://api.groq.com/openai/v1"
},
"zhipu": {
"api_key": "sua-chave-api-zhipu",
"api_base": "https://open.bigmodel.cn/api/paas/v4"
},
"gemini": {
"api_key": "sua-chave-google-ai-studio",
"api_base": "https://generativelanguage.googleapis.com/v1beta"
},
"vllm": {
"api_key": "",
"api_base": "http://localhost:8000/v1"
},
"nvidia": {
"api_key": "nvapi-sua-chave-nvidia",
"api_base": "https://integrate.api.nvidia.com/v1",
"proxy": "http://127.0.0.1:7890"
},
"moonshot": {
"api_key": "sk-sua-chave-moonshot",
"api_base": "https://api.moonshot.cn/v1"
},
"ollama": {
"api_key": "",
"api_base": "http://localhost:11434/v1"
}
}
}
```
#### Arquitetura dos Provedores
O PicoClaw roteia provedores por família de protocolo:
- **Protocolo compatível com OpenAI**: Endpoints OpenRouter, OpenAI, Groq, Zhipu, vLLM, NVIDIA, Moonshot e Ollama.
- **Protocolo Anthropic**: Comportamento de API nativa do Claude.
- **Protocolo Gemini**: API Gemini do Google.
Isso mantém o runtime leve enquanto novos backends compatíveis com OpenAI são principalmente uma operação de configuração (`api_base` + `api_key`).
#### Obtendo API Keys
| Provedor | Onde Obter API Key | Plano Gratuito |
|----------|-------------------|----------------|
| **Anthropic** | [console.anthropic.com](https://console.anthropic.com) | Créditos gratuitos limitados |
| **OpenAI** | [platform.openai.com](https://platform.openai.com) | $5 de crédito gratuito para novos usuários |
| **OpenRouter** | [openrouter.ai/keys](https://openrouter.ai/keys) | 200K tokens/mês gratuitos |
| **Groq** | [console.groq.com](https://console.groq.com) | Plano gratuito disponível |
| **Zhipu** | [bigmodel.cn](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) | 200K tokens/mês gratuitos |
| **Gemini** | [aistudio.google.com](https://aistudio.google.com) | Plano gratuito com limites |
| **NVIDIA** | [build.nvidia.com](https://build.nvidia.com) | Créditos gratuitos disponíveis |
| **Moonshot** | [platform.moonshot.cn](https://platform.moonshot.cn) | Plano gratuito disponível |
| **Ollama** | [ollama.com](https://ollama.com) | Gratuito (auto-hospedado) |
#### Compatibilidade de Modelos
A maioria dos provedores suporta o formato padrão da API OpenAI, facilitando a troca entre eles. Por exemplo:
- Use `model: "gpt-4"` para OpenAI
- Use `model: "claude-3-5-sonnet-20241022"` para Anthropic
- Use `model: "glm-4"` para Zhipu
- Use `model: "gemini-1.5-pro"` para Gemini
- Use `model: "llama-3.1-70b"` para Groq
- Use `model: "qwen-2.5-32b"` para OpenRouter
<details> <details>
<summary><b>Configuração Zhipu</b></summary> <summary><b>Configuração Zhipu</b></summary>

View file

@ -653,18 +653,113 @@ Subagent có quyền truy cập các công cụ (message, web_search, v.v.) và
### Nhà cung cấp (Providers) ### Nhà cung cấp (Providers)
PicoClaw hỗ trợ nhiều nhà cung cấp mô hình AI thông qua giao diện cấu hình thống nhất. Tất cả nhà cung cấp được cấu hình trong phần `providers` của `config.json`.
> [!NOTE] > [!NOTE]
> Groq cung cấp dịch vụ chuyển giọng nói thành văn bản miễn phí qua Whisper. Nếu đã cấu hình Groq, tin nhắn thoại trên Telegram sẽ được tự động chuyển thành văn bản. > Groq cung cấp dịch vụ chuyển giọng nói thành văn bản miễn phí qua Whisper. Nếu đã cấu hình Groq, tin nhắn thoại trên Telegram sẽ được tự động chuyển thành văn bản.
| Nhà cung cấp | Mục đích | Lấy API Key | #### Nhà cung cấp được hỗ trợ
| --- | --- | --- |
| `gemini` | LLM (Gemini trực tiếp) | [aistudio.google.com](https://aistudio.google.com) | Dựa trên file cấu hình, PicoClaw hiện hỗ trợ các nhà cung cấp sau:
| `zhipu` | LLM (Zhipu trực tiếp) | [bigmodel.cn](bigmodel.cn) |
| `openrouter` (Đang thử nghiệm) | LLM (khuyên dùng, truy cập mọi model) | [openrouter.ai](https://openrouter.ai) | | Nhà cung cấp | Khóa cấu hình | Định dạng API Key | API Base mặc định | Ghi chú |
| `anthropic` (Đang thử nghiệm) | LLM (Claude trực tiếp) | [console.anthropic.com](https://console.anthropic.com) | |-------------|---------------|-------------------|-------------------|---------|
| `openai` (Đang thử nghiệm) | LLM (GPT trực tiếp) | [platform.openai.com](https://platform.openai.com) | | **Anthropic** | `anthropic` | API key Anthropic của bạn | `https://api.anthropic.com` | Mô hình Claude (Claude 3.5 Sonnet, Claude 3 Opus, v.v.) |
| `deepseek` (Đang thử nghiệm) | LLM (DeepSeek trực tiếp) | [platform.deepseek.com](https://platform.deepseek.com) | | **OpenAI** | `openai` | API key OpenAI của bạn | `https://api.openai.com/v1` | GPT-4, GPT-3.5, v.v. Hỗ trợ tìm kiếm web khi bật |
| `groq` | LLM + **Chuyển giọng nói** (Whisper) | [console.groq.com](https://console.groq.com) | | **OpenRouter** | `openrouter` | `sk-or-v1-xxx` | `https://openrouter.ai/api/v1` | Truy cập nhiều mô hình từ các nhà cung cấp khác nhau |
| **Groq** | `groq` | `gsk_xxx` | `https://api.groq.com/openai/v1` | Suy luận nhanh với mô hình Llama, Mixtral + chuyển giọng nói Whisper |
| **智谱 (Zhipu)** | `zhipu` | API key Zhipu của bạn | `https://open.bigmodel.cn/api/paas/v4` | Mô hình GLM (GLM-4, GLM-4V, v.v.) |
| **Gemini** | `gemini` | API key Google AI Studio của bạn | `https://generativelanguage.googleapis.com/v1beta` | Mô hình Gemini (Gemini Pro, Gemini Flash, v.v.) |
| **vLLM** | `vllm` | (Tùy chọn) | `http://localhost:8000/v1` | Máy chủ vLLM cục bộ cho mô hình tự lưu trữ |
| **NVIDIA** | `nvidia` | `nvapi-xxx` | `https://integrate.api.nvidia.com/v1` | Mô hình NVIDIA NIM, hỗ trợ cấu hình proxy |
| **Moonshot** | `moonshot` | `sk-xxx` | `https://api.moonshot.cn/v1` | Mô hình Moonshot AI (Kimi, v.v.) |
| **Ollama** | `ollama` | (Tùy chọn) | `http://localhost:11434/v1` | Máy chủ Ollama cục bộ để chạy mô hình tại chỗ |
#### Ví dụ cấu hình
```json
{
"providers": {
"anthropic": {
"api_key": "your-anthropic-api-key",
"api_base": "https://api.anthropic.com"
},
"openai": {
"api_key": "your-openai-api-key",
"api_base": "https://api.openai.com/v1",
"web_search": true
},
"openrouter": {
"api_key": "sk-or-v1-your-openrouter-key",
"api_base": "https://openrouter.ai/api/v1"
},
"groq": {
"api_key": "gsk_your-groq-key",
"api_base": "https://api.groq.com/openai/v1"
},
"zhipu": {
"api_key": "your-zhipu-api-key",
"api_base": "https://open.bigmodel.cn/api/paas/v4"
},
"gemini": {
"api_key": "your-google-ai-studio-key",
"api_base": "https://generativelanguage.googleapis.com/v1beta"
},
"vllm": {
"api_key": "",
"api_base": "http://localhost:8000/v1"
},
"nvidia": {
"api_key": "nvapi-your-nvidia-key",
"api_base": "https://integrate.api.nvidia.com/v1",
"proxy": "http://127.0.0.1:7890"
},
"moonshot": {
"api_key": "sk-your-moonshot-key",
"api_base": "https://api.moonshot.cn/v1"
},
"ollama": {
"api_key": "",
"api_base": "http://localhost:11434/v1"
}
}
}
```
#### Kiến trúc nhà cung cấp
PicoClaw định tuyến nhà cung cấp theo họ giao thức:
- **Giao thức tương thích OpenAI**: Các endpoint OpenRouter, OpenAI, Groq, Zhipu, vLLM, NVIDIA, Moonshot và Ollama.
- **Giao thức Anthropic**: Hành vi API gốc của Claude.
- **Giao thức Gemini**: API Gemini của Google.
Điều này giữ cho runtime nhẹ trong khi các backend tương thích OpenAI mới chủ yếu chỉ là thao tác cấu hình (`api_base` + `api_key`).
#### Lấy API Key
| Nhà cung cấp | Nơi lấy API Key | Gói miễn phí |
|-------------|-----------------|-------------|
| **Anthropic** | [console.anthropic.com](https://console.anthropic.com) | Tín dụng miễn phí giới hạn |
| **OpenAI** | [platform.openai.com](https://platform.openai.com) | $5 tín dụng miễn phí cho người dùng mới |
| **OpenRouter** | [openrouter.ai/keys](https://openrouter.ai/keys) | 200K tokens/tháng miễn phí |
| **Groq** | [console.groq.com](https://console.groq.com) | Có gói miễn phí |
| **智谱 (Zhipu)** | [bigmodel.cn](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) | 200K tokens/tháng miễn phí |
| **Gemini** | [aistudio.google.com](https://aistudio.google.com) | Gói miễn phí có giới hạn |
| **NVIDIA** | [build.nvidia.com](https://build.nvidia.com) | Có tín dụng miễn phí |
| **Moonshot** | [platform.moonshot.cn](https://platform.moonshot.cn) | Có gói miễn phí |
| **Ollama** | [ollama.com](https://ollama.com) | Miễn phí (tự lưu trữ) |
#### Tương thích mô hình
Hầu hết các nhà cung cấp hỗ trợ định dạng API OpenAI tiêu chuẩn, giúp việc chuyển đổi giữa chúng dễ dàng. Ví dụ:
- Dùng `model: "gpt-4"` cho OpenAI
- Dùng `model: "claude-3-5-sonnet-20241022"` cho Anthropic
- Dùng `model: "glm-4"` cho Zhipu
- Dùng `model: "gemini-1.5-pro"` cho Gemini
- Dùng `model: "llama-3.1-70b"` cho Groq
- Dùng `model: "qwen-2.5-32b"` cho OpenRouter
<details> <details>
<summary><b>Cấu hình Zhipu</b></summary> <summary><b>Cấu hình Zhipu</b></summary>

View file

@ -543,18 +543,113 @@ Agent 读取 HEARTBEAT.md
### 提供商 (Providers) ### 提供商 (Providers)
PicoClaw 通过统一的配置接口支持多个 AI 模型提供商。所有提供商都在 `config.json``providers` 部分进行配置。
> [!NOTE] > [!NOTE]
> Groq 通过 Whisper 提供免费的语音转录。如果配置了 GroqTelegram 语音消息将被自动转录为文字。 > Groq 通过 Whisper 提供免费的语音转录。如果配置了 GroqTelegram 语音消息将被自动转录为文字。
| 提供商 | 用途 | 获取 API Key | #### 支持的提供商
| --- | --- | --- |
| `gemini` | LLM (Gemini 直连) | [aistudio.google.com](https://aistudio.google.com) | 根据配置文件PicoClaw 目前支持以下提供商:
| `zhipu` | LLM (智谱直连) | [bigmodel.cn](bigmodel.cn) |
| `openrouter(待测试)` | LLM (推荐,可访问所有模型) | [openrouter.ai](https://openrouter.ai) | | 提供商 | 配置键 | API Key 格式 | 默认 API Base | 备注 |
| `anthropic(待测试)` | LLM (Claude 直连) | [console.anthropic.com](https://console.anthropic.com) | |--------|--------|--------------|---------------|------|
| `openai(待测试)` | LLM (GPT 直连) | [platform.openai.com](https://platform.openai.com) | | **Anthropic** | `anthropic` | 您的 Anthropic API key | `https://api.anthropic.com` | Claude 模型 (Claude 3.5 Sonnet, Claude 3 Opus 等) |
| `deepseek(待测试)` | LLM (DeepSeek 直连) | [platform.deepseek.com](https://platform.deepseek.com) | | **OpenAI** | `openai` | 您的 OpenAI API key | `https://api.openai.com/v1` | GPT-4, GPT-3.5 等。启用时支持网络搜索 |
| `groq` | LLM + **语音转录** (Whisper) | [console.groq.com](https://console.groq.com) | | **OpenRouter** | `openrouter` | `sk-or-v1-xxx` | `https://openrouter.ai/api/v1` | 访问来自不同提供商的多模型 |
| **Groq** | `groq` | `gsk_xxx` | `https://api.groq.com/openai/v1` | 使用 Llama、Mixtral 模型的快速推理 + Whisper 语音转录 |
| **智谱 (Zhipu)** | `zhipu` | 您的智谱 API key | `https://open.bigmodel.cn/api/paas/v4` | GLM 模型 (GLM-4, GLM-4V 等) |
| **Gemini** | `gemini` | 您的 Google AI Studio API key | `https://generativelanguage.googleapis.com/v1beta` | Gemini 模型 (Gemini Pro, Gemini Flash 等) |
| **vLLM** | `vllm` | (可选) | `http://localhost:8000/v1` | 本地 vLLM 服务器,用于自托管模型 |
| **NVIDIA** | `nvidia` | `nvapi-xxx` | `https://integrate.api.nvidia.com/v1` | NVIDIA NIM 模型,支持代理配置 |
| **Moonshot** | `moonshot` | `sk-xxx` | `https://api.moonshot.cn/v1` | Moonshot AI 模型 (Kimi 等) |
| **Ollama** | `ollama` | (可选) | `http://localhost:11434/v1` | 本地 Ollama 服务器,用于本地运行模型 |
#### 配置示例
```json
{
"providers": {
"anthropic": {
"api_key": "your-anthropic-api-key",
"api_base": "https://api.anthropic.com"
},
"openai": {
"api_key": "your-openai-api-key",
"api_base": "https://api.openai.com/v1",
"web_search": true
},
"openrouter": {
"api_key": "sk-or-v1-your-openrouter-key",
"api_base": "https://openrouter.ai/api/v1"
},
"groq": {
"api_key": "gsk_your-groq-key",
"api_base": "https://api.groq.com/openai/v1"
},
"zhipu": {
"api_key": "your-zhipu-api-key",
"api_base": "https://open.bigmodel.cn/api/paas/v4"
},
"gemini": {
"api_key": "your-google-ai-studio-key",
"api_base": "https://generativelanguage.googleapis.com/v1beta"
},
"vllm": {
"api_key": "",
"api_base": "http://localhost:8000/v1"
},
"nvidia": {
"api_key": "nvapi-your-nvidia-key",
"api_base": "https://integrate.api.nvidia.com/v1",
"proxy": "http://127.0.0.1:7890"
},
"moonshot": {
"api_key": "sk-your-moonshot-key",
"api_base": "https://api.moonshot.cn/v1"
},
"ollama": {
"api_key": "",
"api_base": "http://localhost:11434/v1"
}
}
}
```
#### 提供商架构
PicoClaw 按协议族路由提供商:
- **OpenAI 兼容协议**: OpenRouter, OpenAI, Groq, Zhipu, vLLM, NVIDIA, Moonshot 和 Ollama 端点。
- **Anthropic 协议**: Claude 原生 API 行为。
- **Gemini 协议**: Google 的 Gemini API。
这使得运行时保持轻量,同时新的 OpenAI 兼容后端大多只需配置操作 (`api_base` + `api_key`)。
#### 获取 API Key
| 提供商 | 获取 API Key 地址 | 免费层级 |
|--------|-------------------|----------|
| **Anthropic** | [console.anthropic.com](https://console.anthropic.com) | 有限免费额度 |
| **OpenAI** | [platform.openai.com](https://platform.openai.com) | 新用户 $5 免费额度 |
| **OpenRouter** | [openrouter.ai/keys](https://openrouter.ai/keys) | 200K tokens/月免费 |
| **Groq** | [console.groq.com](https://console.groq.com) | 提供免费层级 |
| **智谱 (Zhipu)** | [bigmodel.cn](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) | 200K tokens/月免费 |
| **Gemini** | [aistudio.google.com](https://aistudio.google.com) | 有限免费层级 |
| **NVIDIA** | [build.nvidia.com](https://build.nvidia.com) | 提供免费额度 |
| **Moonshot** | [platform.moonshot.cn](https://platform.moonshot.cn) | 提供免费层级 |
| **Ollama** | [ollama.com](https://ollama.com) | 免费 (自托管) |
#### 模型兼容性
大多数提供商支持标准的 OpenAI API 格式,使得在它们之间切换变得容易。例如:
- 使用 `model: "gpt-4"` 对应 OpenAI
- 使用 `model: "claude-3-5-sonnet-20241022"` 对应 Anthropic
- 使用 `model: "glm-4"` 对应智谱
- 使用 `model: "gemini-1.5-pro"` 对应 Gemini
- 使用 `model: "llama-3.1-70b"` 对应 Groq
- 使用 `model: "qwen-2.5-32b"` 对应 OpenRouter
<details> <details>
<summary><b>智谱 (Zhipu) 配置示例</b></summary> <summary><b>智谱 (Zhipu) 配置示例</b></summary>