Nodes/ComfyUI-Kling-Direct/Kling Region Selector
ComfyUI Node

Kling Region Selector

The one node that fixes 'why does my Kling API call 401'

By IxMxAMAR·Created 5 months ago·Updated 2 months ago· 4
Kling Region Selector
  • auth
  • auth
regionsingapore
custom_base_url

Every other node in this pack fails the same way when you get it wrong: your auth checks out, the workflow looks right, and the API call still dies with an authentication or endpoint error. Most of the time the culprit isn't your key - it's your region. Kling runs separate API gateways for different account types, and KlingDirect_RegionSelector is the pack's way to pick the right one.

It's a pass-through node with a single trick: it takes an auth object in, overrides the API base URL, and hands back a new auth object. Nothing else changes - you still wire the same auth into your generation nodes, but it now points at the gateway you selected. Because it returns KLING_AUTH, you can drop it between your Kling AI Authentication node and the rest of your workflow, and every downstream node picks up the corrected endpoint.

The options

  • singapore - https://api-singapore.klingai.com. The default, and the right choice for global accounts. If you signed up at the .com site, this is you.
  • china - https://api.klingai.com. For accounts registered in mainland China.
  • us - https://api-us.klingai.com. US-region accounts.
  • custom_base_url (optional) - paste any base URL to point the whole workflow at a proxy or self-hosted gateway. This is the escape hatch the pack's README explicitly supports, and it's how you'd route through a regional reseller or an internal relay.

Why you'll actually use it

The default is Singapore, which works for the majority of users. You reach for this node in exactly two situations:

  1. Your account isn't a global one. China and US accounts get their own gateways, and calling the wrong one fails even with perfect credentials. If a Kling workflow 401s while your keys are definitely right, add this node and switch regions.
  2. You're using a proxy. Whether it's a self-hosted gateway for compliance, caching, or regional access, custom_base_url is where that goes.

It has exactly one output - auth - so it's trivially easy to swap in and out of an existing graph while debugging.

Install

Part of ComfyUI-Kling-Direct: ComfyUI Manager → search "Kling Direct" → install, or git clone https://github.com/IxMxAMAR/ComfyUI-Kling-Direct into ComfyUI/custom_nodes, then restart. No model downloads, no separate dependencies beyond what ComfyUI ships, no credits consumed by this node itself - it's pure config.

The gotcha

The region you pick must match the account that issued your keys. There's no autodetection, and Kling won't silently redirect you. The quickest way to confirm you've fixed it: run the pack's API Health Check node after the Region Selector - it does a cheap connectivity call and returns a clean is_healthy boolean plus a status string, so you'll know in one click whether your region fix actually worked instead of guessing on the next paid generation.

CategoryKling AI/Config

Inputs (3)

NameTypeDefaultDescription
authKLING_AUTH
regionCOMBOsingaporeKling API region.
custom_base_urloptSTRINGOptional custom base URL override (e.g. self-hosted proxy).

Outputs (1)

NameTypeDescription
authKLING_AUTH