GuidesOneMux

Hy4 Flash API costs for structured extraction: a reproducible estimate

Estimate Hy4 Flash extraction costs using explicit token assumptions, JSON schema validation, retry allowances, and clearly separated price sources.

AI

Summary · TL;DR

A worked Hy4 Flash extraction estimate, with separate Tencent-source and OneMux catalogue prices, a retry allowance, and practical guidance for measuring valid outputs.

Key Takeaways

  • Estimate cost per accepted extraction, not per question or API call; include validation failures and retries.
  • Under the illustrative workload, the Tencent-source rates produce a base estimate of ¥192 per 100,000 documents, or ¥201.60 with the assumed retries.
  • The supplied OneMux catalogue snapshot does not state the token billing unit, so its dollar values require unit confirmation before use in a comparable calculation.
  • JSON schema validation checks structure and constraints, not whether extracted values are correct.
On this page (8)

The short answer

For structured extraction, budget Hy4 Flash by documents processed, tokens billed, and accepted results—not by chat turns. In the illustrative workload below, 100,000 documents cost ¥192 before retries at the rates reported by a Tencent Cloud community article. A 5% full-size retry allowance raises that estimate to ¥201.60, or ¥2.016 per 1,000 accepted documents, assuming every document is eventually accepted.

This is a cost guide published by OneMux, which also offers access to Hy4 Flash. It is not a quality benchmark or a quote. The estimate uses hypothetical token counts and cache usage; measure both on your own documents before committing a budget.

Prices and units: keep the sources separate

The Tencent Cloud community article reports Hy4 Flash prices of ¥0.5 per million input tokens, ¥2 per million output tokens, and ¥0.02 per million cache-hit tokens. These are the rates used in the worked calculation, not verified current prices. Confirm the applicable provider, region, billing terms, and rates before purchasing.

The following is the supplied OneMux catalogue snapshot, captured 2026-11-28 at 08:20 UTC. Its dollar values are reproduced as published in the supplied snapshot, but the billing unit is not specified in that snapshot. Do not assume the values are per million tokens or directly compare them with the yuan rates until the unit and conditions are confirmed on the Hy4 Flash model page.

ModelOfficial inputOfficial outputOneMux inputOneMux outputPublished price ratio
Hy4 Flash$0.035$0.145$0.013195$0.0546650.37700000000000006

The same snapshot lists official cache read at $0.0015 and OneMux cache read at $0.0005655, again without an explicit billing unit in the supplied data. The ratio shown is the published price ratio, not a measured workload saving. Cache eligibility, write charges, other fees, and any tier conditions are not established by the supplied snapshot. Check current OneMux pricing and the applicable terms; unknown charges should not be treated as zero.

OneMux provides access through an OpenAI-compatible API, but endpoint and parameter compatibility for a particular integration should be checked against current documentation. Alternatively, use the provider's applicable direct API pricing. Do not mix the two price schedules or convert currencies without an explicit exchange-rate assumption.

Worked example: extract fields from 100,000 documents

Assume a monthly batch that extracts a small set of invoice fields and validates each response against a JSON schema. These are illustrative assumptions, not measurements of Hy4 Flash:

AssumptionValue
Documents submitted100,000
Total input per initial call, including cached content4,000 tokens
Of that input, billed as cache hits1,000 tokens
Remaining input billed at the regular input rate3,000 tokens
Output per initial call200 tokens
Additional full-size calls due to retries5% of initial calls

The 4,000-token input includes instructions, schema or format guidance, and document content. The 1,000 cached tokens are part of, not additional to, that input. The retry assumption means 5,000 additional calls with the same input, output, and cache mix as the initial calls. It does not imply a measured 5% failure rate.

Calculate the base cost

At the community article's reported per-million-token rates:

ChargeMonthly volumeArithmeticCost
Regular input300 million tokens300 × ¥0.5¥150
Cache-hit input100 million tokens100 × ¥0.02¥2
Output20 million tokens20 × ¥2¥40
Base total¥150 + ¥2 + ¥40¥192

Five percent more calls at the same cost add ¥9.60, for ¥201.60 total. If all 100,000 documents are ultimately accepted, that is ¥201.60 ÷ 100,000 = ¥0.002016 per accepted document.

For a planning ceiling, adding a separate 25% allowance to that retry-inclusive estimate gives ¥252. This is a budget buffer, not an expected charge. If some documents remain invalid or are rejected for incorrect values, divide actual spend by the smaller number of accepted documents instead. For example, ¥201.60 divided by 98,000 accepted documents is approximately ¥2.057 per 1,000 accepted documents.

Make JSON validation part of the workload

Define acceptance before measuring cost. For an invoice, a minimal schema might require an invoice number, a three-letter currency code, and a nonnegative total. The example below uses Python's jsonschema package for local validation; it does not call an API or claim that the model enforces the schema natively.

import json
from jsonschema import validate

schema = {
    "type": "object",
    "properties": {
        "invoice_number": {"type": "string", "minLength": 1},
        "currency": {"type": "string", "pattern": "^[A-Z]{3}$"},
        "total": {"type": "number", "minimum": 0}
    },
    "required": ["invoice_number", "currency", "total"],
    "additionalProperties": False
}

def validate_extraction(model_text):
    result = json.loads(model_text)
    validate(instance=result, schema=schema)
    return result

Install jsonschema in your application environment and pass the model's response text to the function. Invalid JSON raises a parsing error; structurally invalid JSON raises a validation error. Handle both explicitly and record whether a retry, manual review, or rejection follows. In production, also define how to handle missing source fields and monetary precision.

A schema-valid result can still contain the wrong invoice number or total. Sample documents against a trusted reference, track field-level errors separately, and include review or correction costs if they matter to the decision. Native JSON-schema response controls, if desired, require separate confirmation for the chosen endpoint; local validation remains useful even when such controls are available.

Measure the numbers that change the estimate

  1. Select a representative sample. Include short and long documents, missing fields, and difficult layouts in proportions resembling production. Record whether preprocessing, such as OCR, is a separate cost; it is excluded from the example.
  2. Log usage per call. Capture input, output, and cache-hit tokens where the endpoint reports them. Confirm whether reported input includes cached tokens before subtracting cache hits. If cache usage is unavailable, estimate conservatively with regular input rates rather than assuming hits.
  3. Record outcomes per document. Count calls, validation failures, retries, accepted outputs, and unresolved documents. A retry with a larger prompt or a longer output should use its actual usage, not the worked example's identical-call assumption.
  4. Test caching rather than assuming it. Stable instructions and schemas are candidates for a reusable prefix, but eligibility, minimum lengths, expiration, and billing depend on the service. Dynamic content in the prefix can prevent reuse.
  5. Recalculate by document class. Multiply each class's measured token volumes by the matching prices, add retry and other known charges, then divide by accepted documents. Check long-document and peak-volume cases separately.

The useful decision is whether the measured cost per accepted extraction fits the budget at an acceptable error rate—not whether a single call looks inexpensive. Revisit the estimate whenever the schema, document mix, cache behavior, model, or pricing changes.

Sources

Published price snapshot

Captured 2026-11-28T08:20:07.031Z from the OneMux published catalogue. Prices retain website billing units; this is not a live benchmark. Tiered, cached or time-based billing may differ. Unknown values are not zero.

ModelOfficial inputOfficial outputOneMux inputOneMux outputPublished price ratio
Hy4 Flash$0.035$0.145$0.013195$0.0546650.37700000000000006

Current OneMux prices. Compare workload costs only when input/output and billing units match; see each model page for tier conditions.

FAQ

How much does Hy4 Flash cost for 100,000 structured extractions?

In the illustrative workload, the Tencent Cloud community article's reported rates yield ¥192 before retries and ¥201.60 with 5% additional full-size calls. Actual cost depends on token usage, cache billing, retries, and the applicable price schedule.

Does JSON schema validation guarantee extraction accuracy?

No. It can check structure, required fields, and declared constraints, but a correctly formatted value can still be wrong. Measure field accuracy against trusted examples separately.

Can I calculate token costs directly from the supplied OneMux dollar prices?

Not reliably from the supplied snapshot alone: it does not specify the billing unit for those values. Confirm the unit and applicable cache and tier conditions before calculating or comparing workload costs.

Related articles