LLM API Selection: A Six-Dimension Systematic Evaluation Method

    This article describes a systematic way to choose a large language model API. It breaks model capability into six measurable dimensions: price, context window, reasoning, programming performance, Chinese language quality, and response speed. It also explains how to set scenario-based weights, build an automated evaluation pipeline, and avoid common selection mistakes.

    1. Why API Selection Should Not Rely Only on “Which Model Is the Strongest”

    Model leaderboards are usually based on public benchmarks, and those benchmarks often differ from specific business scenarios. A model that scores highly on mathematical reasoning may not reliably output structured data that meets business rules. A model that excels at long-document analysis may still be a poor fit for a high-volume customer service scenario if its price is too high. Choosing an API means balancing several constraints. Capability therefore needs to be broken down into measurable dimensions, then weighted according to business priorities for an overall judgment.

    2. Six Core Evaluation Dimensions

    2.1 Price

    LLM APIs typically charge separately for input tokens and output tokens, and output prices are usually higher than input prices. Prices vary widely between models. A gap of several dozen times between a lower-tier model and a flagship reasoning model is not unusual. When evaluating price, pay attention to three points:

    • Billing unit: Most providers charge per million tokens, so costs need to be converted into a cost per request or per business event.
    • Input-output ratio: Summarization and classification tasks have long inputs and short outputs. Code generation and long-form writing have a higher share of output tokens.
    • Hidden costs: Reasoning models consume additional internal reasoning tokens, so the actual bill may exceed expectations. Record real token usage during testing.

    The following cost estimation example uses placeholder prices. Refer to the provider’s pricing page for actual rates.

    1. def estimate_monthly_cost(
    2. daily_requests: int,
    3. avg_input_tokens: int,
    4. avg_output_tokens: int,
    5. price_input_per_m: float, # Price per million input tokens (CNY)
    6. price_output_per_m: float, # Price per million output tokens (CNY)
    7. days: int = 30,
    8. ) -> float:
    9. input_cost = daily_requests * avg_input_tokens * price_input_per_m / 1_000_000
    10. output_cost = daily_requests * avg_output_tokens * price_output_per_m / 1_000_000
    11. return (input_cost + output_cost) * days

    2.2 Context Window

    The context window determines the total length of input and output a model can handle in one request. The nominal window length does not equal the effective length the model can actually use. When processing long text, recall of information in the middle of the input may decline. Recall should therefore be tested with real long documents rather than judged from the spec sheet alone.

    One practical approach is a targeted-question test. Insert a key fact at different positions in a long text, check whether the model answers correctly, and observe how accuracy changes with the fact’s position and the text length.

    2.3 Reasoning

    Reasoning ability shows up as accuracy on multi-step tasks, such as numerical calculation, logical inference, and applying complex rules. This capability matters most for analytical reports, compliance review, and solution design. Models with stronger reasoning usually respond more slowly and cost more. If a task does not require deep reasoning, using such a model wastes resources.

    2.4 Programming Performance

    Programming ability can be broken down into four sub-items: code generation, bug fixing, unit test writing, and tool calling. Evaluations should use the team’s real codebase and requirements instead of generic coding questions. Key checks include whether generated code compiles and passes tests, whether it follows the project’s existing naming and layering conventions, and whether it stays consistent across multi-file changes.

    2.5 Chinese Language Quality

    Chinese language quality covers fluency, accuracy of technical terminology, understanding of local context, and the ability to follow formatting instructions. For products serving Chinese-speaking users, the following points are worth checking:

    1. Whether industry terms use standard translations;
    2. Whether colloquial and abbreviated input is understood accurately;
    3. Whether dates, amounts, units, and other formats follow Chinese conventions;
    4. Whether the model strictly follows instructions such as “output JSON only.”

    2.6 Response Speed

    Response speed is usually measured with two metrics: Time To First Token (TTFT) and generation throughput, which is the number of tokens generated per second. Interactive products are more sensitive to TTFT, while batch processing tasks care more about throughput. Measurements should be sampled several times at different times of day, and P50 and P95 percentiles should be calculated. A single measurement has little reference value.

    3. Building a Weighted Scoring System

    The importance of each dimension varies by scenario. Assign a weight to each dimension, score the candidate models, and compute the weighted sum. The table below is an example. Adjust the weights to fit the actual business.

    Dimension Customer Service Q&A Code Assistant Document Analysis
    Price 30% 15% 20%
    Context Window 10% 15% 30%
    Reasoning 10% 25% 25%
    Programming Performance 5% 30% 5%
    Chinese Language Quality 30% 5% 15%
    Response Speed 15% 10% 5%

    After the weights are set, score each dimension on a unified 100-point scale. The overall score is the sum of each dimension score multiplied by its weight. Business leaders and the technical team should confirm the weights together, rather than having engineers set them alone.

    4. Building an Automated Evaluation Pipeline

    Selection conclusions should come from reproducible data. A minimum viable evaluation process includes the following steps:

    1. Build an evaluation set: Draw samples from real business data, prepare at least several dozen cases for each dimension, and label each case with a reference answer or scoring rule.
    2. Standardize the calling interface: Use an adapter layer to hide differences between service interfaces, so the same inputs are compared under the same parameters.
    3. Record metrics: Automatically log accuracy, token usage, TTFT, and total latency.
    4. Conduct manual spot checks: For subjective outputs such as copywriting quality, use double-blind review for scoring.

    The following is a sketch of an evaluation framework. call_model is an adapter function that you need to implement for the services you actually use.

    1. import time
    2. from statistics import quantiles
    3. def run_benchmark(model_name, cases, call_model, judge):
    4. results, latencies = [], []
    5. for case in cases:
    6. start = time.perf_counter()
    7. output, usage = call_model(model_name, case["prompt"])
    8. latencies.append(time.perf_counter() - start)
    9. results.append({
    10. "passed": judge(case, output),
    11. "input_tokens": usage["input"],
    12. "output_tokens": usage["output"],
    13. })
    14. accuracy = sum(r["passed"] for r in results) / len(results)
    15. p95 = quantiles(latencies, n=20)[18] # Approximate P95; requires at least 20 samples
    16. return {"accuracy": accuracy, "p95_latency_s": p95, "details": results}

    After the evaluation, enter each model’s results into the weighted scoring table to get comparable overall scores.

    5. Common Mistakes

    • Relying only on leaderboard rankings: The question mix on public leaderboards can differ greatly from business data, so your own evaluation set should be the primary reference.
    • Ignoring output length: Some models produce verbose output, which raises costs and slows responses.
    • Choosing once and never revisiting: Model versions change quickly, so re-test every quarter or after a major version release.
    • Overlooking fallback and disaster recovery: A single provider carries availability risk, so the architecture should allow switching providers.
    • Confusing test and production environments: Concurrency during testing differs from production, so latency data must be re-verified under a load close to production.

    6. Decision Recommendations

    Selection can proceed in the following order. First, define the hard constraints of the business, such as data compliance requirements, a per-call cost ceiling, and the maximum acceptable latency. Next, use the evaluation set to filter candidate models that meet those constraints. Finally, select the preferred model by weighted score and keep one backup candidate. This approach controls costs and keeps technical decisions documented, which makes later review easier.