LLM Selection After API Price Increases: A Trading Simulator Case Study
Building a financial trading simulator offers a practical way to evaluate large language models beyond benchmark scores. This article examines a two-stage development task, differences in reasoning and code-generation reliability, and the impact of context caching and rework on API costs. It outlines how to choose models based on engineering requirements, prompt quality, and total development cost.
As large language models move into more demanding applications, benchmark scores alone are no longer enough to guide model selection. API price increases by some major providers have also pushed businesses and independent developers to reassess value for money.
The practical question is straightforward: with a limited budget, how do you choose a model that can reason through difficult requirements and produce reliable code for a complex engineering task?
This article explores that question through a concrete development exercise: building an interactive financial trading simulation game.
1. Designing the Evaluation: Why a Trading Simulator?
To test models’ understanding of complex business logic and their ability to generate application code, we used a challenging task: developing an interactive stock-market simulation game.
The player acts as the sole market operator, trading against retail-investor bots whose behavior draws on classical market microstructure theory, including information-asymmetry trading models. The bots need different trading parameters, while some act as purely random, white-noise traders.
This scenario is useful for model evaluation for three reasons:
- Cross-domain knowledge: The model must understand both financial concepts—such as volume-weighted average price (VWAP), price impact, and trading near the market close—and software architecture.
- Code complexity: The application requires an interactive frontend, backend state management, and a real-time order-matching engine.
- Detailed instruction following: Producing runnable code is not enough. The implementation must also follow specific business rules and game objectives.
2. Breaking Down the Task and Designing Prompts
The evaluation split development into two stages: building the basic framework and adding more complex business logic.
To minimize the influence of IDEs and AI coding tools on the results, testing primarily used direct prompts to the models. Each model was asked to produce a complete code framework in a single response before receiving additional requirements.
Stage 1: Core Architecture and Trader Roles
The initial prompt established the game setting:
Design an interactive stock-market simulation game in which I act as the market controller. Include retail-investor bots that follow classical market microstructure trading models with different parameters, as well as purely white-noise traders.
This stage tested whether the model could translate the scenario into a coherent application structure and implement distinct trader behaviors.
Stage 2: Complex Trading Objectives
To turn the sandbox into a strategy game, the next stage introduced three challenging objectives associated with institutional trading scenarios:
- Late-session price lift: Raise the simulated price above a specified strike price before the market closes.
- Low-cost accumulation: Discreetly accumulate 5,000 shares below VWAP.
- Large-position distribution: Sell a large position without sharply depressing the market price.
This multi-turn prompt design tested the model’s ability to retain earlier requirements, reason through complex logic such as order slicing for discreet accumulation, and integrate new behavior into an existing framework. It also revealed whether overly defensive safety policies would block otherwise legitimate financial simulation code because the prompt contained terms associated with market manipulation.
3. Key Evaluation Dimensions and Differences Between Models
Testing several mainstream LLMs with different strengths revealed important differences in reasoning quality and development reliability.
Reasoning Depth and Code Quality
Some models offered both a standard mode and a deeper reasoning mode.
In standard mode, models tended to generate a basic frontend and simple trading logic quickly. However, when asked to distribute a large position without disrupting prices, they often implemented little more than splitting market orders into smaller pieces. The resulting code lacked calculations that accounted for order-book depth.
With deeper reasoning enabled, the models spent more time working through the requirements before producing code. Their matching engines better represented how limit orders and market orders interact with available liquidity, substantially improving the usefulness of the generated implementation.
For this task, reasoning depth mattered most when a requirement depended on market mechanics rather than basic UI or application structure.
Single-Pass Generation Versus Multi-Turn Reliability
Some general-purpose models from international providers performed well across multiple iterations. They understood the more complex second-stage requirements and integrated them smoothly into the initial framework.
However, some models later refused to continue generating simulation code involving “market manipulation” terminology after updates tightened their safety controls. This introduced a separate reliability issue: a model that initially supported the workflow might no longer support the same task after an update.
Some general-purpose models developed in China, by contrast, performed particularly well when asked to generate the entire application in one pass. Given a sufficiently detailed prompt, they produced complete frontend and backend code, reducing debugging effort and making them useful for rapid prototyping.
These observations highlight two distinct capabilities: generating a complete initial implementation and reliably extending it over multiple turns.
4. Understanding Cost and Value for Money
After API price increases, token consumption becomes a major factor in model selection. In the reported test case, one complete, in-depth development interaction consumed approximately six million tokens.
For workflows involving millions of tokens across extensive context and repeated interactions, comparing input and output token prices alone does not capture the full cost. Two additional factors are especially important.
Context Cache Hit Rate
Long code-generation workflows repeatedly send much of the same context, including system prompts and previously generated code blocks. Context caching can reduce the cost of processing that repeated material.
In the reported test, a favorable cache hit rate brought the generation cost of a complex simulation game down to approximately $0.08. That figure reflects the particular test conditions rather than a general price guarantee.
For developers building on infrastructure platforms such as Baidu AI Cloud, making effective use of available caching mechanisms and inference acceleration options can be important for controlling API spending.
The practical lesson is that cache utilization can matter as much as the headline token rate in workflows with substantial repeated context.
The Share of Wasted Tokens
If generated code does not run or contains significant logic errors, developers must ask the model to correct or regenerate it. Those additional responses consume tokens without necessarily moving the project forward.
A model that produces a usable implementation on the first attempt may therefore offer better overall value than a cheaper model that requires repeated corrections, even if its per-token price is higher.
The relevant measure is not simply the cost of generating code, but the cost of reaching a working implementation.
5. Conclusions and Engineering Recommendations
The trading simulator exercise suggests three practical principles for selecting and using LLMs.
Prioritize Task Fit Over Benchmark Rankings
No model is equally strong at every task.
For rapid prototyping, a model with strong single-pass generation and complete code structure may be the most economical choice. For applications with demanding business logic, deeper reasoning may justify higher token consumption.
Selection should reflect the work the model actually needs to perform, rather than a benchmark score in isolation.
Manage Prompts Precisely
As API costs rise, casual conversational prompting becomes less attractive for engineering workflows.
Clear input and output constraints, detailed requirements, and high-quality examples can reduce trial-and-error token consumption. A well-specified prompt also gives the model a better chance of producing a complete, internally consistent implementation.
Use Cloud-Native and Middleware Capabilities
When deploying model-generated applications such as the trading simulator, serverless hosting or container-based deployment can support on-demand execution and reduce spending on idle resources.
These infrastructure choices complement model-level cost controls. Efficient generation does not eliminate the need to manage application hosting costs.
Ultimately, LLM value for money is not a fixed property of a model. It emerges from the interaction between model capability, prompt engineering, and the underlying cloud architecture. Testing models against real development tasks—and measuring the cost of reaching a usable result—is the most practical way to find the best fit for a particular workflow.
