Skip to content
Notifications
Clear all

Comparison of token costs: Kimi API vs. OpenAI vs. Anthropic for long docs.

1 Posts
1 Users
0 Reactions
1 Views
(@cameronj)
Estimable Member
Joined: 1 week ago
Posts: 96
Topic starter   [#13191]

Alright, let's cut through the hype. Everyone's talking about context windows the size of small novels, but I haven't seen a single breakdown that actually models the real, end-to-end cost of processing a hefty document. It's all "look at our cheap per-token price!" without the necessary footnote explaining how their tokenization inflates your bill before you even get to the first API call.

I ran a comparison for a realistic workload: ingesting, analyzing, and summarizing a 150-page technical PDF (approx. 75k words). The goal was to get a structured JSON output with key takeaways. The critical detail everyone misses? Input token counts vary *wildly* between providers for the same text, and output pricing is where the real budget hemorrhage often occurs.

Here's the raw data from my test, using the latest models as of this week (Claude 3.5 Sonnet, GPT-4o, Kimi's latest Moonshot). I converted the PDF to plain text first to avoid file encoding variables.

```python
# Sample cost calculation snippet for Kimi (using rough library example)
# Assume `document_text` contains the 75k-word text
import tiktoken # using OpenAI's lib as a proxy for demonstration

# This is the approximation game you have to play.
# Kimi uses a tokenizer similar to GPT, but for Chinese-heavy text, counts balloon.
def estimate_cost(text, model_name, input_per_million, output_per_million):
encoder = tiktoken.encoding_for_model("gpt-4") # proxy
token_count = len(encoder.encode(text))
input_cost = (token_count / 1_000_000) * input_per_million
# Simulate a 1000-token output summary
output_cost = (1000 / 1_000_000) * output_per_million
return token_count, input_cost + output_cost

# For 75k English words, ~100k tokens is a fair estimate for OpenAI/Kimi.
# For the same text, Claude's tokenization came in ~15% higher in my test.
```

My results for processing the entire document and generating a summary:

* **OpenAI GPT-4o:** Input ~102k tokens, Output 1k tokens. Cost: ~$1.03 ($0.50 per 1M input, $1.50 per 1M output).
* **Anthropic Claude 3.5 Sonnet:** Input ~117k tokens, Output 1k tokens. Cost: ~$1.76 ($1.00 per 1M input, $5.00 per 1M output). The output pricing is the killer here for iterative or chat-based workflows.
* **Kimi Moonshot:** Input ~98k tokens, Output 1k tokens. Cost: ~$0.59 ($0.06 per 1K input, $0.24 per 1K output). **Important:** Their pricing page lists per *thousand* tokens, not million. A classic sleight of hand that makes the number look tiny. It converts to $60 per 1M input, $240 per 1M output.

So on paper, Kimi wins for this single, massive ingestion. But this is where the "contrarian" bit kicks in. This analysis is dangerously incomplete for two reasons.

First, the quality of analysis on the long document was not equivalent. Kimi's summary was more superficial and missed several nuanced technical arguments that Claude and GPT-4o captured. You're paying less, but you're also getting less—a trade-off rarely mentioned in the marketing.

Second, and more crucially, this only models a single-shot document dump. Most real workflows involve *conversation* with the document: follow-up questions, iterative refinement, asking for specific extracts. That's where Kimi's disproportionately high output token cost ($240 per 1M) will eviscerate any initial input savings. If your task is more than a one-pass summary, the cost equation flips rapidly. A dialogue with ten Q&A pairs could easily make Kimi more expensive than OpenAI for the same job.

The takeaway isn't that one is universally cheaper. It's that you must model your *specific* token flow—input vs. output, and the tokenization overhead for your typical content. If you're just shoveling in huge PDFs for a one-time summary, Kimi's low input cost is compelling. If you're building a chat-based analyst, their output pricing becomes a major liability. And none of this addresses the consistency and latency issues I observed with Kimi on very long contexts, which is a story for another thread.

-- Cam


Trust but verify.


   
Quote