calesthio/OpenMontage · error · ValueError

pricing is unknown for a custom Ark Endpoint/Model; set cust

Error message

pricing is unknown for a custom Ark Endpoint/Model; set custom_price_cny_per_million_tokens before a paid create

What it means

Raised by `_get_custom_price(inputs, required=True)`: the request targets a custom Ark Endpoint/Model (an endpoint ID or model outside the tool's built-in pricing table), and no `custom_price_cny_per_million_tokens` was supplied in inputs. Because a paid generation POST is about to happen, the tool refuses to create a task whose cost cannot be computed — this protects the cost-tracking/budget-governance contract, and per the code comment in `execute()`, all cost parsing happens BEFORE the paid POST so a pricing gap never leaves an untracked task behind.

Source

Thrown at tools/video/seedance_ark.py:429

            rate = self.PRICE_CNY_PER_MILLION[variant][condition][resolution]
        except KeyError:
            # A custom Endpoint/Model may have different pricing.  Returning
            # zero is safer than presenting a fabricated official estimate.
            return 0.0
        return round(self.estimate_token_usage(inputs) * rate / 1_000_000, 4)

    def estimate_cost(self, inputs: dict[str, Any]) -> float:
        cny_per_usd = self._get_cny_per_usd()
        return round(self.estimate_cost_cny(inputs) / cny_per_usd, 4)

    @staticmethod
    def _get_custom_price(inputs: dict[str, Any], *, required: bool) -> float:
        try:
            raw = inputs["custom_price_cny_per_million_tokens"]
        except KeyError as exc:
            if not required:
                return 0.0
            raise ValueError(
                "pricing is unknown for a custom Ark Endpoint/Model; "
                "set custom_price_cny_per_million_tokens before a paid create"
            ) from exc
        try:
            value = float(raw)
        except (TypeError, ValueError) as exc:
            raise ValueError(
                "custom_price_cny_per_million_tokens must be a finite "
                "number greater than 0"
            ) from exc
        if not math.isfinite(value) or value <= 0:
            raise ValueError(
                "custom_price_cny_per_million_tokens must be a finite "
                "number greater than 0"
            )
        return value

    @staticmethod

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Look up the endpoint's price on the Volcengine Ark console (CNY per million tokens) and pass it: `custom_price_cny_per_million_tokens: <value>`
  2. Or switch `model` back to a built-in Seedance variant whose pricing the tool knows
  3. Confirm the value is per million tokens in CNY — a per-call or USD figure will silently mis-estimate cost

Example fix

# before
inputs = {"model": "ep-20240903144xxx", "prompt": "...", "task_action": "generate"}
# after
inputs = {
    "model": "ep-20240903144xxx",
    "prompt": "...",
    "task_action": "generate",
    "custom_price_cny_per_million_tokens": 15.0,
}
Defensive patterns

Strategy: validation

Validate before calling

if using_custom_model(inputs) and "custom_price_cny_per_million_tokens" not in inputs:
    raise ValueError(
        "custom endpoint detected: set custom_price_cny_per_million_tokens "
        "(CNY per million tokens from the Ark console) before generate/create"
    )

Try / catch

try:
    result = ark.execute(inputs)
except ValueError as e:
    if "custom_price_cny_per_million_tokens" in str(e):
        # fetch price from your billing config, add to inputs, retry once
        inputs["custom_price_cny_per_million_tokens"] = PRICES[inputs["model"]]
        result = ark.execute(inputs)
    else:
        raise

Prevention

When it happens

Trigger: Calling seedance_ark with `model` or an Ark Endpoint ID not in the pricing table, `task_action` generate/create (dry_run/estimate paths pass `required=False`), and omitting `custom_price_cny_per_million_tokens`.

Common situations: Users switching from the known Seedance models to a newly released or fine-tuned endpoint; using a dedicated endpoint ID (ep-xxxx) for reserved capacity where per-token pricing is account-specific; dry-run succeeding (price not required there) followed by a real execute that fails.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/85a9bebd92d81a52. Report an issue: GitHub.