Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:666ghj BettaFish SiliconFlow API

From Leeroopedia
Knowledge Sources
Domains NLP, LLMs, API_Integration
Last Updated 2026-10-08 21:30 GMT

Overview

SiliconFlow cloud API access for Qwen3 models used by the Forum Host moderator and SQL Keyword Optimizer.

Description

This environment provides access to the SiliconFlow inference platform, which hosts Qwen3 series models. BettaFish uses SiliconFlow for two components: the Forum Host (Qwen3-235B-A22B-Instruct-2507 for debate moderation) and the SQL Keyword Optimizer (Qwen3-30B-A3B-Instruct-2507 for search query optimization). The API is OpenAI-compatible and accessed via the `openai` Python SDK with a custom `base_url`.

Usage

Use this environment when running forum debate coordination or SQL keyword optimization tasks. It is required by ForumHost and KeywordOptimizer implementations.

System Requirements

Category Requirement Notes
OS Any API calls are remote
Hardware CPU sufficient No GPU required
Network Outbound HTTPS Must reach `api.siliconflow.cn`

Dependencies

System Packages

  • None beyond Python runtime

Python Packages

  • `openai` >= 1.3.0

Credentials

The following environment variables must be set in `.env`:

  • `FORUM_HOST_API_KEY`: SiliconFlow API key for Forum Host
  • `FORUM_HOST_BASE_URL`: Base URL (default: `https://api.siliconflow.cn/v1`)
  • `FORUM_HOST_MODEL_NAME`: Model name (recommended: `Qwen/Qwen3-235B-A22B-Instruct-2507`)
  • `KEYWORD_OPTIMIZER_API_KEY`: SiliconFlow API key for Keyword Optimizer
  • `KEYWORD_OPTIMIZER_BASE_URL`: Base URL (default: `https://api.siliconflow.cn/v1`)
  • `KEYWORD_OPTIMIZER_MODEL_NAME`: Model name (recommended: `Qwen/Qwen3-30B-A3B-Instruct-2507`)

Quick Install

pip install openai>=1.3.0

Code Evidence

Forum Host initialization from `ForumEngine/llm_host.py:33-52`:

class ForumHost:
    def __init__(self, api_key: str = None, base_url: Optional[str] = None, model_name: Optional[str] = None):
        self.api_key = api_key or settings.FORUM_HOST_API_KEY
        if not self.api_key:
            raise ValueError("未找到论坛主持人API密钥,请在环境变量文件中设置FORUM_HOST_API_KEY")
        self.base_url = base_url or settings.FORUM_HOST_BASE_URL
        self.client = OpenAI(api_key=self.api_key, base_url=self.base_url)
        self.model = model_name or settings.FORUM_HOST_MODEL_NAME

Configuration from `config.py:70-77`:

FORUM_HOST_API_KEY: Optional[str] = Field(None, description="Forum Host API 密钥")
FORUM_HOST_BASE_URL: Optional[str] = Field(None)
FORUM_HOST_MODEL_NAME: Optional[str] = Field(None)

KEYWORD_OPTIMIZER_API_KEY: Optional[str] = Field(None)
KEYWORD_OPTIMIZER_BASE_URL: Optional[str] = Field(None)
KEYWORD_OPTIMIZER_MODEL_NAME: Optional[str] = Field(None)

Common Errors

Error Message Cause Solution
`ValueError: 未找到论坛主持人API密钥` `FORUM_HOST_API_KEY` not set Apply at https://cloud.siliconflow.cn/ and set in `.env`
`openai.RateLimitError` SiliconFlow rate limit reached Wait and retry, or upgrade plan
`Model not found` Incorrect model name Use exact name: `Qwen/Qwen3-235B-A22B-Instruct-2507`

Compatibility Notes

  • SiliconFlow: Apply for API key at https://cloud.siliconflow.cn/
  • Aliyun Bailian: Also supported as an alternative for Qwen models. Set `FORUM_HOST_BASE_URL` to the Bailian endpoint.
  • Model naming: SiliconFlow requires the full `Qwen/` prefix (e.g., `Qwen/Qwen3-235B-A22B-Instruct-2507`).

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment