Nodes/ComfyUI_MieNodes/Set iFLYTEK Spark LLM Service Connector ๐Ÿ‘
ComfyUI Node

Set iFLYTEK Spark LLM Service Connector ๐Ÿ‘

Two dropdown entries and a URL that picks the model for you

By MieMieeeeeยทCreated 2 years agoยทUpdated 3 days agoยท 273
Set iFLYTEK Spark LLM Service Connector ๐Ÿ‘
    • llm_service_connector
    โ—„api_tokenโ–บ
    โ—„model_selectspark-xโ–บ
    โ—„custom_modelโ–บ
    โ—„config_filemie_llm_keys.jsonโ–บ
    โ—„config_keysparkโ–บ
    โ—„prefer_local_configtrueโ–บ

    What it is

    The thinnest connector in the pack, and the one that looks strangest the first time you open it: the model dropdown has two entries, spark-x and Custom, and neither of them is really the thing selecting the model. This connects iFLYTEK's Spark (่ฎฏ้ฃžๆ˜Ÿ็ซ) to your graph - useful if you already have a Spark account, or if you're building for a Chinese-language pipeline where it's cheap and available.

    Like every sibling here, its only job is to hand you an llm_service_connector socket.

    Why the weird dropdown? Spark X2's HTTP protocol selects the generation by URL path, not by model name. The docs' model value for that endpoint is literally spark-x; the path is what says "X2". X1.5 lives under /v2/, and the retired lite/generalv3 classics under /v1/. This connector points at /x2/, so spark-x is not a placeholder - it's the correct string, and typing something else into custom_model won't move you to a different generation. If you specifically need a legacy Spark model, the pack's SetGeneralLLMServiceConnector with the /v1/ base URL is the route.

    How it works

    The request goes to https://spark-api-open.xf-yun.com/x2/chat/completions with your console-issued APIPassword as a Bearer token. The payload is deliberately slim - model, messages, stream: false, max_tokens - because Spark's documented HTTP surface for this generation is messages/stream/temperature-shaped and the sampling extras aren't guaranteed. If you're used to tuning top_k or penalties on other connectors, you won't here; that's intentional, not missing.

    Retries, timeout and reasoning-block stripping come from the shared base class: three attempts five seconds apart on timeouts/connection errors/5xx, a 30-second per-request timeout, and <think> blocks removed from replies.

    Inputs and output

    api_token - the APIPassword from the iFLYTEK console, not the AppID or the APIKey. Those three fields sit next to each other in the console and this is the single most common reason the node returns a 401.

    model_select - spark-x (default) or Custom.

    custom_model - only meaningful with Custom; remember that the generation is chosen by path here, so this is not a "switch to a bigger model" lever.

    config_file, config_key (default spark), prefer_local_config. Output: llm_service_connector, into CallLLMService, Translator, PromptGenerator, or CheckLLMServiceConnectivity for a one-request check.

    Installing and keying it

    cd ComfyUI/custom_nodes
    git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
    cd ComfyUI-MieNodes && python -m pip install -r requirements.txt
    

    Restart. ComfyUI Manager: search ComfyUI_MieNodes (publisher mie). No weights, no GPU work - this is an HTTP client with a UI.

    cp mie_llm_keys.json.example mie_llm_keys.json
    # "spark": "<APIPassword>"
    

    prefer_local_config defaults to True, so the file's spark entry overrides the api_token box on the node. Put the APIPassword in the file and start from there when debugging auth.

    Common issues

    401 that no key seems to fix. Check that you've copied APIPassword and not APIKey/AppID, and that you're reading the Spark X2 credentials rather than an older service's.

    "Why can't I pick a bigger model?" Because on X2 the path decides, and this node is pinned to X2. Use the general OpenAI-compatible connector with a different Spark base URL if you need an older generation.

    Timeouts on long rewrites. 30 seconds per attempt, three attempts. A long output can still blow the budget; keep prompt-writing jobs short and structured rather than asking for a page of prose.

    Category๐Ÿ‘ MieNodes/๐Ÿ‘ LLM Service Config

    Inputs (6)

    NameTypeDefaultDescription
    api_tokenSTRINGโ€”
    model_selectCOMBOspark-x2 options: spark-x, Custom
    custom_modeloptSTRINGโ€”
    config_fileoptSTRINGmie_llm_keys.jsonโ€”
    config_keyoptSTRINGsparkโ€”
    prefer_local_configoptBOOLEANtrueโ€”

    Outputs (1)

    NameTypeDescription
    llm_service_connectorLLMServiceConnectorโ€”