Feature: Add support for custom OpenAI-compatible API

This update enables users to configure any OpenAI-compatible API endpoint,
allowing the use of:
- OpenAI official API (GPT-4, GPT-4o, etc.)
- OpenRouter (access to multiple models)
- Local deployed models (Ollama, LM Studio, etc.)
- Other OpenAI-format compatible API services

Changes:
- config: Add custom_api_url, custom_api_key, custom_model_name fields
- mcp: Add SetCustomAPI function and ProviderCustom constant
- trader: Update AI initialization logic to support custom API
- manager: Pass custom API config to trader instances
- Add CUSTOM_API.md documentation with usage examples
- Update config.json.example with custom API sample

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
btcman
2025-10-29 22:48:28 +08:00
parent 3aca733490
commit 27ba298eed
6 changed files with 241 additions and 3 deletions

View File

@@ -21,6 +21,19 @@
"qwen_key": "your_qwen_api_key",
"initial_balance": 1000,
"scan_interval_minutes": 3
},
{
"id": "binance_custom",
"name": "Binance Custom API Trader",
"ai_model": "custom",
"exchange": "binance",
"binance_api_key": "your_binance_api_key",
"binance_secret_key": "your_binance_secret_key",
"custom_api_url": "https://api.openai.com/v1",
"custom_api_key": "sk-your-api-key",
"custom_model_name": "gpt-4o",
"initial_balance": 1000,
"scan_interval_minutes": 3
}
],
"leverage": {