How do I configure the custom model?
I want to use the Tencent HunYuan model via the API. I configured the API key and the base url and it looked like this:
But the model provider is hardcoded, so I can't call the HunYuan model.
provider_keywords = { "openai": ["gpt", "openai"], "anthropic": ["claude", "anthropic"], "google": ["gemini", "google"], "azure": ["azure"], "ollama": ["ollama", "localhost"], "deepseek": ["deepseek"], "dashscope": ["qwen", "tongyi", "dashscope", "qwq"], "moonshot": ["kimi", "moonshot"], "groq": ["groq", "llama", "mixtral"], }
Do you have any plans to address the issue?
Hi @xt765! I hit the same problem and investigated the code — here's the root cause and a complete fix.
Root cause
The model → provider detection is hardcoded in provider_keywords in three places:
src/finchbot/cli/chat_session.py→_get_llm_config()src/finchbot/cli/providers.py→PROVIDER_KEYWORDS/_get_llm_config()src/finchbot/providers/factory.py→_detect_provider()
When the model name is e.g. hunyuan-turbos-latest, none of the keywords match, so detection falls back to "openai" and only OPENAI_API_KEY / providers.openai are consulted — the API key and base URL you configured for HunYuan are silently ignored.
Fix
1. Tencent HunYuan as a first-class provider (its API is OpenAI-compatible)
provider_keywords/PROVIDER_KEYWORDSnow includehunyuan(keywords:hunyuan,tencent)PRESET_PROVIDERSgains ahunyuanentry with default basehttps://api.hunyuan.cloud.tencent.com/v1and modelshunyuan-turbos-latest,hunyuan-turbo-latest,hunyuan-liteconfig/utils.py+config/loader.pynow supportHUNYUAN_API_KEY/HUNYUAN_API_BASEenv varsProvidersConfigschema has a newhunyuanfield (also listed inget_configured_providers())_create_model()routeshunyuanthroughChatOpenAI(OpenAI-compatible endpoint)
2. Custom providers are matched by name (removes the hardcoded-list limitation entirely)
In both _get_llm_config() implementations, a custom provider configured via providers.custom (or finchbot config → Add custom provider) is now used whenever its name appears in the model name, with explicit user config taking priority over the preset keywords. Example:
finchbot config → Add custom provider
name: hunyuan
API key: <your key>
Base URL: https://api.hunyuan.cloud.tencent.com/v1
default_model: hunyuan-turbos-latest
This works for any new model/provider — no code change needed.
3. Bonus fix
agent() in src/finchbot/agent/core.py (the LangGraph CLI entry) previously hardcoded OPENAI_API_KEY; it now reuses create_chat_model() so all providers work there too.
Usage
# Option A — built-in provider (env vars)
export HUNYUAN_API_KEY=...
export HUNYUAN_API_BASE=https://api.hunyuan.cloud.tencent.com/v1
# default_model = hunyuan-turbos-latest
# Option B — custom provider (config UI), auto-matched by name
finchbot config → Add custom provider → name: hunyuan
Verification
Added tests/test_providers.py (12 test cases: hunyuan detection, preset config, custom-name matching, aliased names, short-name filtering, env loading, non-matching models). All pass; the rest of the suite shows no regressions.
Happy to open a PR with these changes if you'd like!
Update: implemented and submitted as a pull request — https://github.com/xt765/FinchBot/pull/9
What's in the PR:
- Tencent HunYuan as a first-class provider:
hunyuankeywords, preset with default basehttps://api.hunyuan.cloud.tencent.com/v1,HUNYUAN_API_KEY/HUNYUAN_API_BASEenv vars,providers.hunyuanconfig field, routed throughChatOpenAI(OpenAI-compatible). - Custom providers are now matched by name: a custom provider configured via
providers.custom(orfinchbot config→ Add custom provider) is used whenever its name appears in the model name — explicit user config wins over the preset keyword list, so any new model works without code changes. - Also fixed
agent()inagent/core.py(LangGraph CLI entry) to reusecreate_chat_modelinstead of hardcodingOPENAI_API_KEY.
Usage: name your custom provider hunyuan, set default_model: hunyuan-turbos-latest, and your configured key/base will be used automatically (or just set HUNYUAN_API_KEY / HUNYUAN_API_BASE env vars).
Tests: 12 new cases in tests/test_providers.py, full suite green (no regressions).