Skip to content

feat(llm): add iFlytek Spark (Astron MaaS) provider - #1531

Merged
harry0703 merged 1 commit into
harry0703:mainfrom
FenjuFu:feat/iflytek-astron-provider
Oct 3, 2026
Merged

harry0703 merged 1 commit into
harry0703:mainfrom
FenjuFu:feat/iflytek-astron-provider

Conversation

@FenjuFu

@FenjuFu FenjuFu commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What

Adds iflytek to LLM_PROVIDER_REGISTRY: iFlytek Spark served by iFlytek's Astron MaaS platform, which exposes OpenAI-compatible Chat Completions. Registry metadata only, adapter stays openai_compatible, no new request path. It sits in the 主流模型原厂与云厂商 group right after Xiaomi MiMo, next to the other first-party Chinese model vendors.

file change
app/models/llm_provider.py 11 lines after mimo: default model spark-x2.5, default base URL https://maas-api.cn-huabei-1.xf-yun.com/v2
config.example.toml iflytek_api_key / iflytek_base_url / iflytek_model_name
webui/i18n/en.json, webui/i18n/zh.json tips, using only the existing {api_key_url} / {default_base_url} / {default_model} / {model_docs_url} placeholders; the label comes from the registry like mimo and minimax
test/services/test_llm.py registry assertions, "iflytek" in the group-order test, and a client test for the default and a saved Token Plan base URL

Two endpoints, one provider

Astron MaaS has a pay-as-you-go endpoint (maas-api…/v2, the default here) and a Token Plan endpoint (maas-token-api…/v2). Keys are tied to one of them, so a Token Plan key sent to the default endpoint gets iFlytek's 403 11200 no valid authorization. Rather than add a second provider id, the tips and the config example tell Token Plan users to put the Token Plan URL in Base Url; the existing override handling keeps it as-is, which the new test covers.

Spark X2.5 is a reasoning model. Its reasoning comes back in reasoning_content, separate from content, so the existing _extract_chat_completion_text path already returns only the answer.

Checked today (2026-10-03) with a real Token Plan key

  • llm.generate_script(video_subject="why the sky is blue", paragraph_number=1) through _generate_response with iflytek_base_url set to the Token Plan URL: a clean one-paragraph script in about 45 s.
  • llm.generate_terms(...) on that script: ['Why sky blue', 'Blue sky cause', 'Sky blue scattering', 'Blue sky rayleigh', 'Blue sky atmosphere'].
  • The same key on the default pay-as-you-go endpoint returns the 403 above, which is the behaviour the tips describe. I don't have a pay-as-you-go key with an active order, so the default endpoint was not exercised end to end.

Locally (uv sync --frozen --python 3.11, Windows): test/services/test_llm.py and test/services/test_webui_i18n.py pass (131 passed, 1 skipped), ruff check app cli.py main.py webui test docs/skill is clean. In the full suite 8 tests in the cache-manager, material, ElevenLabs music and Sonilo modules fail, and they fail the same way on main without this change.

Disclosure: I'm a member of the iFlytek Astron open-source community. No pricing or referral links are in the diff.

Add `iflytek` to the LLM provider registry. iFlytek's Astron MaaS
serves Spark X2.5 over OpenAI-compatible Chat Completions, so this is
registry metadata only and reuses the `openai_compatible` adapter.

The default base URL is the pay-as-you-go endpoint. Token Plan keys only
work on the maas-token-api host, so the config example and the tips
point Token Plan users at that base URL.

Signed-off-by: FenjuFu <fufenjupku@gmail.com>
@harry0703
harry0703 merged commit 6702bc1 into harry0703:main Oct 3, 2026
3 checks passed
@harry0703

Copy link
Copy Markdown
Owner

Thanks for adding iFlytek Spark support and the clear configuration instructions! Merged — appreciate your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants