Model comparison

HY4 vs DeepSeek V4.1 Flash 1017: the cost of an edit–test loop

DeepSeek V4.1 Flash 1017 has the lower current Novita rates across input, output and cache reads: $0.3, $1.2 and $0.006 per 1M tokens, versus HY4's $0.417, $1.2505 and $0.021. It also lists a larger output limit: 393,216 tokens versus 64,000. For a coding agent, these are concrete billing and capacity advantages; neither establishes which model will produce a passing patch.

Updated · 8 sources · Methodology and sources

Published costs and endpoint differences123
DimensionWinnerMarginEvidence
100,000 uncached input + 10,000 output tokensDeepSeek V4.1 Flash 1017$0.012205HY4: $0.054205; DeepSeek V4.1 Flash 1017: $0.04212
20,000 uncached input + 80,000 cache-read input + 10,000 output tokensDeepSeek V4.1 Flash 1017$0.004045HY4: $0.022525; DeepSeek V4.1 Flash 1017: $0.0184812
Maximum output (tokens)DeepSeek V4.1 Flash 1017329,216HY4: 64,000; DeepSeek V4.1 Flash 1017: 393,2163

DeepSeek leads these rate-and-capacity comparisons. A passing patch still depends on the generated change and the test run.

Evidence and task fit

Shared tool support, lower DeepSeek token rates

Both endpoints list text and image input, function calling, structured output and reasoning. Either route can therefore supply tool-call instructions and structured responses. The published differences here are the token rates and output ceiling.

Sources: 123

The price difference applies to different stages of a coding job: sending new repository material, reusing qualifying cached context and generating the next proposed change. A passing test is a separate outcome from any of those billed steps.

Sources: 4

Where the coding loop spends tokens

Opening a new issue

An initial request may include the issue, source files and failure logs as new input. DeepSeek's lower uncached-input rate applies to that material without assuming a cache hit. The generated explanation or patch is billed at the output rate.

Returning with test feedback

Later turns may carry repository context again alongside new errors and tool results. DeepSeek also has the lower cache-read rate, but only qualifying cached tokens receive that rate. Repeating a file or prompt does not itself prove a cache hit.

Producing a larger change

DeepSeek's larger output ceiling leaves more room for a long response or diff. It does not show that a larger patch is correct, or that the entire repository can be returned as output. Input and generation still share the context window.

Sources: 1234

Response time in your workflow

The test run can outlast the model response

A coding job includes commands, file operations and tests as well as generation. A fast reply can still be followed by a failed test and another model turn. Lower token pricing does not shorten the project's test commands or remove those additional steps.

Rates and workload costs

Rates and workload costs

The rate table uses USD per 1M tokens. Workload totals are USD for the stated quantities.

Published token rates on Novita AI
DimensionHY4DeepSeek V4.1 Flash 1017
Uncached input$0.417$0.3
Output$1.2505$1.2
Cache read$0.021$0.006

Sources: 12

The HY4 examples use the reduced rates currently displayed by Novita AI. Its listed original prices are $0.834 for input, $2.501 for output and $0.042 for cache reads per 1M tokens. Budget from the current model listing when prices change.

Sources: 13

Illustrative model-token charges
DimensionHY4DeepSeek V4.1 Flash 1017
100,000 uncached input + 10,000 output tokens$0.054205$0.042
20,000 uncached input + 80,000 cache-read input + 10,000 output tokens$0.022525$0.01848
400,000 uncached input + 20,000 output tokens$0.19181$0.144

The uncached example represents fresh billable input and generated output. The warm-cache example assumes some repository context already qualifies for cache reads. Neither includes the cost of executing tests or predicts how many repair turns an issue will need.

100,000 uncached input + 10,000 output tokens
HY4$0.054205
DeepSeek V4.1 Flash 1017$0.042

Sources: 12

Endpoint capabilities and exact token limits
DimensionHY4DeepSeek V4.1 Flash 1017
Context window (tokens)1,000,0001,048,576
Maximum output (tokens)64,000393,216
Input typesText, imageText, image
Function callingSupportedSupported
Structured outputSupportedSupported
ReasoningSupportedSupported

Input and output share the context window; their maximum values cannot be added together.

Sources: 1234

Choosing by task

A new coding route or an established HY4 integration

HY4

  • HY4 may suit an existing integration whose prompts, tool arguments and patch workflow already meet the application's needs. The effort of changing that integration is separate from its token bill.

DeepSeek V4.1 Flash 1017

  • DeepSeek is the price-led option for a new edit–test loop: it has lower rates for new input, qualifying cached input and generated output, together with the larger listed output limit.

A coding budget accumulates across model turns, unsuccessful patches and commands that keep the runtime occupied. The useful outcome is the finished change; the cost tables isolate the model-token portion of that process.

Chat API reference for tool calls

Agent Sandbox

A separate runtime for applying changes and running tests

Novita Agent Sandbox can provide the isolated runtime for this loop: apply a proposed patch, run the project's test command and return the logs to the coding agent. Either model can supply the proposed actions; application code authorizes the commands and passes back the results.

Budget model tokens and Sandbox resources separately, including failed attempts. Long-running commands can keep the execution bill growing even while the model is idle. End the runtime when the coding job no longer needs it; calling a model does not automatically create a Sandbox.

Explore Novita Agent Sandbox · Create an execution environment

Sources: 56

Repair a CSV amount parser and run its tests

This example gives HY4 and DeepSeek the same amount-parsing bug and test cases. Each model returns a replacement function; a fresh Sandbox runs the tests for that candidate.

Model proposes a fix → Sandbox runs fixed tests → application reads the result

Install the Python packages below and set NOVITA_API_KEY in your local environment. Save the script as compare_repair.py, then run it with Python.

python -m pip install openai novita-sandbox==2.1.3
python compare_repair.py
Show the runnable Python example
import ast
import os
import re
from openai import OpenAI
from novita_sandbox import Novita, CommandExitException

TESTS = '''import unittest
from decimal import Decimal
from candidate import parse_amount

class AmountTests(unittest.TestCase):
    def test_valid_amounts(self):
        cases = {"1,234.50": "1234.50", " ( 2,345.67 ) ": "-2345.67",
                 " 12.30 ": "12.30", "-1,234.50": "-1234.50", "0": "0", "0.10": "0.10"}
        for text, expected in cases.items():
            with self.subTest(text=text):
                value = parse_amount(text)
                self.assertIsInstance(value, Decimal)
                self.assertEqual(value, Decimal(expected))

    def test_reject_invalid_amounts(self):
        for text in ("", "  ", "not an amount", "NaN", "Infinity"):
            with self.subTest(text=text), self.assertRaises(ValueError):
                parse_amount(text)
'''

PROMPT = (
    "Repair parse_amount(text) for CSV amount fields. Return Decimal values, trim whitespace, "
    "accept comma-grouped amounts and parenthesized negatives, and reject blank, invalid, "
    "or non-finite values with ValueError. Return only the complete Python module: imports "
    "and parse_amount, without Markdown, tests, or commands.\n"
    "Broken module:\nfrom decimal import Decimal\ndef parse_amount(text):\n    return Decimal(text)\n"
    "Fixed acceptance tests:\n" + TESTS
)

client = OpenAI(
    api_key=os.environ["NOVITA_API_KEY"],
    base_url="https://api.novita.ai/openai/v1",
    timeout=120.0,
    max_retries=0,
)
novita = Novita()
models = ("tencent/hy4", "deepseek/deepseek-v4.1-flash-1017")

for model in models:
    reply = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": PROMPT}],
        max_tokens=8192,
        extra_body={"separate_reasoning": True},
    )
    print("Model:", model)
    print("Usage:", reply.usage.model_dump_json() if reply.usage else "Not returned")
    if not reply.choices:
        print("No choice returned; nothing executed.")
        continue
    choice = reply.choices[0]
    candidate = choice.message.content or ""
    fenced = re.fullmatch(r"\s*```(?:python)?[ \t]*\n(.*?)\n?```\s*", candidate, re.S)
    if fenced:
        candidate = fenced.group(1)
    print("Finish reason:", choice.finish_reason)
    if choice.finish_reason != "stop" or not candidate.strip() or len(candidate) > 20000:
        print("Incomplete or oversized source; nothing executed.")
        continue
    try:
        ast.parse(candidate)
    except SyntaxError:
        print("Invalid Python source; nothing executed.")
        continue

    sandbox = novita.code_interpreter.create(timeout=300)
    try:
        sandbox.files.write("/tmp/candidate.py", candidate)
        sandbox.files.write("/tmp/test_candidate.py", TESTS)
        try:
            result = sandbox.commands.run(
                "python3 -m unittest discover -s /tmp -p test_candidate.py -v",
                cwd="/tmp", timeout=30,
            )
        except CommandExitException as error:
            result = error
        print("Test exit code:", result.exit_code)
        print(result.stdout)
        print(result.stderr)
    finally:
        sandbox.kill()

Read the test result and token usage

For each model, inspect the test output and exit code alongside the returned token usage. Passing these tests only establishes behavior on the listed inputs. The script makes one repair attempt per model and stops each Sandbox after testing.

Running the script uses billed model calls and Sandbox resources. Returned token usage is not the complete bill; Sandbox execution is charged separately.

Sources: 4678

Practical questions

Practical questions

Is repeated repository context automatically charged at the cache-read rate?

No. The lower read rate applies only to input that qualifies as cached usage. The fixed warm-cache example assumes that condition is already met; it does not promise that every repeated file, system prompt or tool result will be cached.

Can a larger output limit replace the edit–test loop?

It can accommodate a larger response, but running the code and receiving test feedback remain separate steps. More output room cannot establish whether an unexecuted patch passes the project's tests.

What the numbers cover

Methodology and sources

Data as of 2026-11-11. Prices and endpoint specifications are from the cited Novita model pages and public catalog.

Model-token cost = (uncached input × input rate + cache-read input × cache-read rate + billable output × output rate) / 1,000,000. The warm-cache example assumes the cache already exists and the stated tokens qualify as cache reads.

Fixed-token examples compare rates, not the total cost of an identical completed task. Input categories are counted separately. Billable output includes any reasoning charged as output; do not add it twice. The warm-cache case assumes an existing qualifying cache. Cache creation, execution, storage and paid tools are excluded unless stated. Actual usage and retries can change the bill.

Sources: 124

This table uses exact token limits from Novita's public model catalog. For HY4, the catalog lists 1,000,000 context tokens and 64,000 output tokens; the model detail pages display 977K and 63K. Input and requested output share the context budget; the two maximum values are not additive.

Sources: 134

  1. Novita AI · HY4novita.ai
  2. Novita AI · DeepSeek V4.1 Flash 1017novita.ai
  3. Novita AI · Public model catalogapi.novita.ai
  4. Novita AI · Chat Completions APIdocs.novita.ai
  5. Novita Agent Sandbox · Productnovita.ai
  6. Novita Agent Sandbox · First sandboxdocs.novita.ai
  7. Novita Agent Sandbox · Run commandsdocs.novita.ai
  8. Novita Agent Sandbox · Read and write filesdocs.novita.ai

See both model routes for your coding agent

Compare model-token prices separately from the runtime used to apply patches and run tests.