Square CloudSquare Cloud

Which AI model to choose for your chatbot

No single model is best for every chatbot: choose by results on your own questions, latency and price per token. Start with the smallest model that passes your tests and move up only when quality falls short.

Updated 8 min read

Learning objectives

After reading this article you will be able to:

  • Evaluate an AI model on quality, latency, price, context, tool calling, language and privacy
  • Know which model size fits each role in a chatbot
  • Test candidates with your own questions before choosing
On this page

Every month a new AI model tops some leaderboard, and the question "which one is best?" goes stale before your deploy finishes. For a chatbot, the useful question is different: which model answers your users' questions well, fast enough for a conversation, at a price your product can carry.

This guide has no ranking and no version names, because both change quickly. It covers the criteria, the role of each model size and a script to test candidates with your own questions.

Why can't a leaderboard choose for you?#

Public leaderboards and benchmarks measure generic tasks: math, code, general knowledge, rater preference in open-ended chats. A store or support chatbot has a narrow job: follow the system prompt, look things up in your knowledge base, call your functions and answer in your brand's tone. A model can lead a reasoning benchmark and still break the format your frontend expects.

Catalogs also move fast: providers ship new generations and retire old ones on a schedule, as Anthropic publishes on its deprecations page. A choice based on criteria and on tests with your own data survives a generation change.

Which criteria matter?#

  1. Quality on your task. The main criterion, and you can only measure it with your own questions. Include hard cases: out of scope, angry customer, ambiguous request.
  2. Latency. In chat, users feel the time to the first word. Smaller models usually answer faster, and high reasoning levels delay the start of the reply. Measure with streaming on.
  3. Price per token. Input and output are both billed, and the gap between a provider's smallest and largest model is wide. The math is in how much an LLM API costs.
  4. Context window. How much text fits in one call. At the major providers it already reaches hundreds of thousands of tokens or more, but filling the window makes replies slower and more expensive. When a conversation no longer fits, you get the context_length_exceeded error.
  5. Tool calling. If the chatbot looks up orders or books appointments, the model has to pick the right function and fill in the arguments correctly. Test with your real functions. Some providers offer a strict mode that forces arguments to follow your JSON Schema.
  6. Language. Every major model writes English well, but quality in other languages, slang and local terms varies. Write your tests in your users' language and register, and count their tokens, because the same text turns into different token counts depending on the language and the model.
  7. Privacy. OpenAI says data sent to its API does not train its models unless you opt in to share it; Anthropic says the same for its commercial products. Under the Gemini API terms, unpaid usage may be read by human reviewers and used to improve Google's products, and paid usage is not. For data that cannot leave your infrastructure, the answer is an open model, compared in local LLM vs API.

Which model size fits each role?#

The major providers split their catalogs into size tiers. At Anthropic, the lines include Haiku (the smallest and fastest), Sonnet and Opus; OpenAI and Google also offer large, mid-size and small models, with names that change each generation. Each model is described on the official model pages of Anthropic, OpenAI and Google.

Role in the chatbot Size Examples
Triage, classification, extraction Small and fast Detect the topic of a message, pull out the order number, answer a short FAQ
General support with tools Mid-size Answer from documents, call a few functions, keep the tone
Hard reasoning and long tasks Large Technical diagnosis, code, agents with many steps

Anthropic's model selection guide describes two starting points: start small and move up only when tests show a concrete failure (prototypes, tight latency, high volume), or start with the most capable model and size down later (when accuracy outweighs cost).

You can also combine models: a small one classifies every message and only the hard ones go to a larger one. And many models expose a reasoning effort setting (effort, reasoning_effort or similar); according to Anthropic, tuning it is often a better lever than switching models. Open-weight models, such as Google's Gemma family, run on your own hardware and trade the per-token bill for the cost of the GPU.

How do you test candidates with your own questions?#

  1. Collect 30 to 50 real questions from your support history. Include 5 to 10 hard cases: out of scope, ambiguous, in another language, and attempts to make the bot ignore its rules, as in prompt injection.
  2. Write down what a good answer is for each one: the correct fact, the tone and when to hand off to a person.
  3. Run every candidate with the same system prompt.
  4. Grade blind, from 1 to 5, and count separately the answers that make up a deadline or a policy (the hallucination problem).
  5. Add up quality, latency and cost and keep the smallest model that passes.

OpenAI, Anthropic and Google all accept the OpenAI SDK pointed at an OpenAI-compatible endpoint, so one script covers all three. Anthropic itself says its compatibility layer is mainly meant for testing and comparing models; in production, prefer each provider's native SDK.

python
# evaluate.py: python evaluate.py questions.txt  (pip install openai)
import csv
import os
import sys
import time

from openai import OpenAI

# Candidates: OpenAI-compatible endpoint, key variable and model variable
CANDIDATES = {
    "openai": (None, "OPENAI_API_KEY", "OPENAI_MODEL"),
    "anthropic": ("https://api.anthropic.com/v1/", "ANTHROPIC_API_KEY", "ANTHROPIC_MODEL"),
    "google": (
        "https://generativelanguage.googleapis.com/v1beta/openai/",
        "GEMINI_API_KEY",
        "GEMINI_MODEL",
    ),
}
SYSTEM = (
    "You are the support agent for the Example store. Answer in at most 3 sentences. "
    "If you don't know the answer, say you will bring in a person from the team."
)

with open(sys.argv[1], encoding="utf-8") as f:
    questions = [line.strip() for line in f if line.strip()]

with open("results.csv", "w", newline="", encoding="utf-8") as out:
    csv_out = csv.writer(out)
    csv_out.writerow(
        ["candidate", "question", "answer", "first_token_s", "total_s", "input_tokens", "output_tokens"]
    )
    for name, (base_url, key_var, model_var) in CANDIDATES.items():
        if not os.environ.get(key_var):
            continue  # skip providers without a key
        client = OpenAI(base_url=base_url, api_key=os.environ[key_var])
        for question in questions:
            start = time.perf_counter()
            first, parts, usage = None, [], None
            stream = client.chat.completions.create(
                model=os.environ[model_var],
                messages=[
                    {"role": "system", "content": SYSTEM},
                    {"role": "user", "content": question},
                ],
                stream=True,
                stream_options={"include_usage": True},
            )
            for chunk in stream:
                if chunk.choices and chunk.choices[0].delta.content:
                    first = first or time.perf_counter()
                    parts.append(chunk.choices[0].delta.content)
                if chunk.usage:
                    usage = chunk.usage
            end = time.perf_counter()
            csv_out.writerow([
                name,
                question,
                "".join(parts),
                round((first or end) - start, 2),
                round(end - start, 2),
                usage.prompt_tokens if usage else "",
                usage.completion_tokens if usage else "",
            ])
            print(f"{name}: {question[:50]}")

Put one question per line in questions.txt, set the keys of the providers you want to compare and copy each model ID from the official page into OPENAI_MODEL, ANTHROPIC_MODEL and GEMINI_MODEL. The script writes the answer, time to first token, total time and token counts to results.csv. It does not set temperature on purpose: on Anthropic's compatibility layer, the newest models return a 400 error for any value below the default. In the CSV, hide the candidate column before grading.

Which model should you pick for each scenario?#

Scenario Starting point
Store or service FAQ, short answers Small, with the documents in the prompt or through RAG
Support that looks up orders and books appointments Mid-size with solid tool calling, tested with your functions
Technical support, diagnosis or code Mid-size or large, with reasoning effort tuned
High volume on a tight budget Small, with a low max_tokens and short history
Triage before a human agent Small, with structured output (topic, urgency)
Sensitive data (health, legal, finance) A provider whose data terms fit your case, or an open model on your infrastructure
Long manuals and contracts RAG with a mid-size model; a large window only if the whole document must be in the call

Most of the time, the knowledge base matters more than the model size. A small model with the right excerpts in the prompt beats a large one without them; the pattern is in what RAG is.

How do you switch models without rewriting the chatbot?#

  • Model ID in an environment variable. Copy the ID from the official page into a variable such as OPENAI_MODEL and switch by restarting the app, as in how to host an AI chatbot.
  • Know what the ID points to. At Anthropic, every model ID is a pinned snapshot. At Google, there are stable IDs, preview IDs and latest aliases, which move to a new version after an email notice. In production, prefer the one that doesn't change on its own.
  • Track retirements and plan the migration before the date.
  • Run the test set again with the same questions, using the current model's CSV as the baseline.
  • Review the prompt. A prompt heavily tuned for one provider may do worse on another, as Anthropic warns in its compatibility guide.

How to do this on Square Cloud#

To add one more candidate to your tests without opening an account with another provider, Square Cloud's AI Gateway serves cubic, the platform's AI model, through an OpenAI-compatible API. The three values are the base URL https://api.squarecloud.app/v2/ai, an account API key with the ai:chat scope and the model cubic; run the same questions from your test set. For typed decisions (yes or no, a choice among options, a score on a scale), cubic-decision answers at POST /v2/ai/decisions.

Against this guide's criteria: function calling in the OpenAI format (up to 32 tools), streaming, reasoning_effort and built-in web search, where the model decides when to search and cites the URLs. Context goes up to 64k tokens on Standard, 128k on Pro and 256k on Enterprise. It is text only (no images, audio or files), stateless (you send the history with every request, up to 500 messages) and has no embeddings, so a RAG setup needs another provider for those.

Access starts on Standard (R$44.99 per month), at no extra charge within the plan's limits: up to 2.5 million tokens per day and 4 simultaneous requests on Standard, up to 5 million and 8 on Pro. Above that, AI credit packs keep it running, billed in Brazilian reais with a Brazilian invoice. See examples and limits on the AI Gateway page.

AI

Host AI apps in always-on containers

OpenAI-compatible API

FAQs

Which is the best AI model for a chatbot: GPT, Claude or Gemini?

None wins every time: catalogs change every few months and every chatbot has a different job. Test two or three candidates with 30 to 50 real questions from your users and keep the smallest one that gets enough right, within your latency and budget.

Does a bigger model always answer better?

Not necessarily. For FAQs, triage and data extraction, a small model is usually enough and answers faster and cheaper. A bigger model pays off on multi-step reasoning, code and tasks with many tools.

Does the provider use my chatbot's conversations to train models?

It depends on the provider and how you use it. OpenAI says data sent to its API does not train its models unless you opt in, and Anthropic says the same for its commercial products. Under the Gemini terms, unpaid usage may be used to improve Google's products, and paid usage is not.

Do I need a huge context window?

Rarely. A support chatbot sends the system prompt, a few history messages and some document excerpts. Since every token you send is billed, trim the history and use RAG before paying for a large window.

Next articleLangChain, LlamaIndex, AI SDK or the provider SDK: which to useCompare LangChain, LlamaIndex, the Vercel AI SDK and the provider's own SDK: what each one solves, the same flow in code and which to use in each scenario.