LiteLLMModels

Hy4 Preview vs Kimi K2.7 Code

As of October 27, 2026, Kimi K2.7 Code costs 14% more per input token than Hy4 Preview ($0.95 vs $0.834 per 1M) and has a 256K-token context window versus 1M.

Prices from LiteLLM's price fileChecked

Hy4 Preview vs Kimi K2.7 Code side by side

Headline prices in US dollars per 1M tokens: each model's own lab where it sells it, otherwise its cheapest provider. Source: LiteLLM model price file, as of October 27, 2026.
Hy4 PreviewKimi K2.7 Code
Input, per 1M tokens$0.834$0.95
Output, per 1M tokens$2.501$4.00
Cache read, per 1M tokens$0.042$0.19
Cache write, per 1M tokens––
Context window1,024,000 tokens262,144 tokens
Max output64,000 tokens262,144 tokens
Image inputNoYes
Tool callingYesYes
Structured output (JSON)YesYes
Prompt cachingYesYes
ReasoningYesYes
Providers on LiteLLM217
Price shown is fromOpencode GOMoonshot AI
Added to LiteLLMSeptember 16, 2026June 2026

Cheapest provider for each

When to pick which

Pick Hy4 Preview for

  • Costs 12% less per input token: $0.834 vs $0.95 per 1M.
  • Larger context window: 1,024,000 vs 262,144 tokens.

Pick Kimi K2.7 Code for

  • Supports image input, which Hy4 Preview doesn't list.
  • Returns up to 262,144 tokens per response, vs 64,000.

From differences in the data above only; where the data is equal, no reason is given.

Call Hy4 Preview or Kimi K2.7 Code with LiteLLM

Both use the OpenAI format through LiteLLM, so switching is a model name change. Set each provider's API key in the environment first.

Python SDK
from litellm import completion

messages = [{"role": "user", "content": "Hello!"}]

# Hy4 Preview
response = completion(model="opencode_go/hy4-preview", messages=messages)

# Kimi K2.7 Code
response = completion(model="moonshot/kimi-k2.7-code", messages=messages)

# Hy4 Preview, falling back to Kimi K2.7 Code if the call fails
response = completion(model="opencode_go/hy4-preview", messages=messages, fallbacks=["moonshot/kimi-k2.7-code"])

FAQ

Which is cheaper, Hy4 Preview or Kimi K2.7 Code?

Hy4 Preview is cheaper at 3 input tokens per output token: $1.251 per 1M tokens blended ($0.834 input, $2.501 output), versus $1.712 ($0.95 and $4.00) for Kimi K2.7 Code, as of October 27, 2026.

Which has the larger context window, Hy4 Preview or Kimi K2.7 Code?

Hy4 Preview has the larger context window: 1,024,000 tokens, versus 262,144 for Kimi K2.7 Code.

Can I switch from Hy4 Preview to Kimi K2.7 Code without changing my code?

Yes. Through LiteLLM both use the OpenAI format, so switching means changing the model name from "opencode_go/hy4-preview" to "moonshot/kimi-k2.7-code", or pointing a LiteLLM gateway model alias at the other model. You can also use one as a fallback for the other.