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.
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.
| Model | Official input | Official output | OneMux input | OneMux output | Published price ratio |
|---|---|---|---|---|---|
| Hy4 Flash | $0.035 | $0.145 | $0.013195 | $0.054665 | 0.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:
| Assumption | Value |
|---|---|
| Documents submitted | 100,000 |
| Total input per initial call, including cached content | 4,000 tokens |
| Of that input, billed as cache hits | 1,000 tokens |
| Remaining input billed at the regular input rate | 3,000 tokens |
| Output per initial call | 200 tokens |
| Additional full-size calls due to retries | 5% 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:
| Charge | Monthly volume | Arithmetic | Cost |
|---|---|---|---|
| Regular input | 300 million tokens | 300 × ¥0.5 | ¥150 |
| Cache-hit input | 100 million tokens | 100 × ¥0.02 | ¥2 |
| Output | 20 million tokens | 20 × ¥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
- 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.
- 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.
- 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.
- 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.
- 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
- Tencent Cloud developer community: Hy4 Flash usage and pricing discussion — source for the reported yuan token rates and the distinction between tasks and chat turns.
- OneMux Hy4 Flash model page and OneMux pricing — relevant catalogue and current-price references; the table above preserves the supplied dated snapshot.
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.
| Model | Official input | Official output | OneMux input | OneMux output | Published price ratio |
|---|---|---|---|---|---|
| Hy4 Flash | $0.035 | $0.145 | $0.013195 | $0.054665 | 0.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
Guides
Grok Imagine Image 2.0 API costs: estimating an image workload and a separate JSON extraction step
Estimate image-generation costs using a published per-image rate, then budget separately for structured extraction and JSON schema validation.
Guides
Gemini 4 Neon API Costs for Structured JSON Extraction
Estimate Gemini 4 Neon extraction costs using explicit token, cache, validation, and retry assumptions, with a reproducible Google and OneMux price comparison.
Guides
Gemini 3.1 Flash Image API costs for structured extraction
Estimate the token cost of extracting structured data from images, including validation failures and retries, with reproducible assumptions.
Guides
Qwen4 Max API Cost Guide for JSON Schema Extraction
Estimate Qwen4 Max extraction costs per document and per 100,000 documents, including retries, cache assumptions, and JSON schema validation.