跳至主要內容
所有用戶端
Autonomous SWE Agent · Docker & CLI1M Context · ZDR

OpenHands

開源自主軟體工程智能體,支援沙盒終端、瀏覽器與 GitHub Issue 全自動處理。

基礎網址
https://api.bf16.ai/v1
協定
openai-completions

適用對象
希望將長週期自主 SWE 任務成本壓低 80%+ 的工程團隊。

架構原理與接入優勢

OpenHands Docker and CLI autonomous SWE agent calling https://api.bf16.ai/v1 with 1M context and cached prefixes
OpenHands uses LiteLLM under the hood — prefix bf16 model IDs with openai/ and set LLM_BASE_URL=https://api.bf16.ai/v1.

OpenHands executes dozens to hundreds of sandboxed shell commands, test suites, and browser inspections per GitHub issue. Because each step resends the full trajectory, token bills on commercial flagship APIs quickly exceed $5–$20 per task.

Pairing OpenHands with DeepSeek V4.1 Flash Uncensored ($0.26 in / $0.045 cached / $1.00 out) cuts autonomous SWE run costs by 80–90% while maintaining 1M-token context and zero refusal interruptions during security or low-level systems debugging.

指令預設顯示 $BF16_API_KEY。登入並建立金鑰後會自動填入你的真實金鑰。

一鍵快速配置

One-Command OpenHands Headless Config

Exports the exact OpenHands LLM environment variables for headless CLI or Docker runs.

export BF16_API_KEY="sk-bf16-v1-..."
export LLM_API_KEY="$BF16_API_KEY"
export LLM_BASE_URL="https://api.bf16.ai/v1"
export LLM_MODEL="openai/deepseek/deepseek-v4.1-flash-uncensored-fast"
curl https://api.bf16.ai/v1/models -H "Authorization: Bearer $BF16_API_KEY"
  1. 1

    設定你的 bf16.ai API 金鑰

    Open OpenHands Settings → LLM → toggle Advanced, or pass environment variables into your Docker container.

  2. 2

    填入 bf16.ai 端點與 1M 免審查模型

    使用頁面提供的 Base URL 與 API 金鑰,即可立即存取全系 1M 上下文免審查模型(含零留存政策)。

    LLM_MODEL=openai/deepseek/deepseek-v4.1-flash-uncensored-fast
    LLM_BASE_URL=https://api.bf16.ai/v1
    LLM_API_KEY=$BF16_API_KEY
OpenHands — Settings → LLM (Advanced / Custom Model)
介面與設定檔欄位對照
Settings / LLM / Custom Model (OpenAI-Compatible)

關鍵參數核對清單

Custom Model
openai/deepseek/deepseek-v4.1-flash-uncensored-fast

Leading openai/ tells OpenHands’ LiteLLM router to use OpenAI-compatible wire format

Base URL
https://api.bf16.ai/v1
API Key
sk-bf16-v1-••••••••••••
Prompt Caching
Automatic ($0.045–$0.055/1M read)
Works identically in OpenHands Web UI, Docker compose, and headless CLI evaluations.

推薦模型分層配置

架構規劃使用旗艦模型,高頻子任務與螢幕截圖使用 Flash 模型以節省開銷。

工作流角色模型 ID選型說明USD / 1M Tokens
Autonomous Issue Solving & CI Loopsdeepseek/deepseek-v4.1-flash-uncensored$0.045/1M cached input reads make 80-step OpenHands trajectories remarkably economical.$0.26 in / $0.045 cached / $1.00 out
High-Speed Interactive Sandboxesdeepseek/deepseek-v4.1-flash-uncensored-fastCuts wall-clock latency across iterative build-test-fix loops.$0.28 in / $0.055 cached / $1.12 out

如何確認設定成功

  • 發送測試訊息後,可在 bf16.ai 控制台請求紀錄中即時查看計費與狀態。
  • curl https://api.bf16.ai/v1/models -H "Authorization: Bearer $BF16_API_KEY"

生產環境護欄與預算隔離

  • Always set max_iterations and a per-key daily USD cap in /dashboard/keys for unattended OpenHands batch jobs.

常見錯誤

現象
連線測試出現 404 或驗證失敗。
原因
端點網址多加或漏寫了 /v1 後綴。
解法
請嚴格對照本頁顯示的 Base URL 複製貼上。