# Choose an AI model

Source: https://testis.dev/docs/ai-models

> Bring any model key, use hosted credits, set a fallback, and keep the cost under control.

Testis works with **any** model. The model is the tester's mind: it reads your PRD, decides what to do on each page and judges what it sees. **How well Testis tests depends on the model you choose.** A stronger model finds more and makes fewer mistakes; a model that can see pictures also gets a screenshot of every step.

## Bring your own key

```bash
testis setup
```

Pick a provider from the list: DeepSeek, Google Gemini, Groq, OpenRouter, OpenAI, Anthropic, Mistral, Together AI, Cerebras, or a model on your own computer with Ollama or LM Studio. Paste your key, and Testis asks the provider for the models that key can use, lets you search them, and makes a test call before saving.

Your key is stored in `~/.testis/credentials.json` (readable only by you), or you can keep it in an environment variable and give its name. It is never written to your project.

### Roles

Testis uses up to two models:

- **judge** is the tester: it uses the app and decides what works. Use the strongest model you can afford here.
- **planner** reads the PRD and writes the to-do list, once per run. The same model is fine.

```bash
testis models list
testis models use --all groq/openai/gpt-oss-120b
testis models use judge=anthropic/claude-sonnet-5-5 planner=deepseek/deepseek-chat
testis models test                 # check that each model answers properly
```

Use `--global` to save a choice for all your projects. Any OpenAI-compatible service can be added with `testis models add <name> --base-url <url>`.

## Hosted credits

Instead of a key, you can use credits from your Testis account and skip the setup. Sign in (`testis login`) and type `/model` in the terminal to choose a hosted model based on credit usage:

- **`gemini-2.5-flash`** *(Recommended)* — Standard credit usage · Balanced speed & accuracy
- **`gemini-2.5-flash-lite`** — Lowest credit usage · Fastest (~2x fewer credits)
- **`gemini-2.5-pro`** — Highest credit usage · Deepest reasoning (~8x more credits — uses the most credits)

```bash
testis login
testis models use --all testis/gemini-2.5-flash
```

Credits are prepaid (10,000 credits = $1). Paid plans include a monthly allowance and you can buy more in the dashboard. New accounts get a small trial credit. A call can never take your balance below zero, and your own key is never billed by us. See [Account, dashboard and plans](/docs/cloud-account#credits-and-plans).

## Keep the cost under control

```bash
testis test --max-credits 20000     # stop hosted AI at $2 for this run
testis test "the checkout"          # test one part: fewer steps, less cost
testis credits                      # balance and recent use
```

`--max-credits` stops hosted AI for that run when the limit is reached; what was found so far is kept and reported. A whole-app run on a small web shop takes about 50 to 100 model calls.

## Keep working when credits or quota run out

By default a run stops with a message when hosted credit or a provider's quota is used up. To switch automatically instead:

```bash
testis models fallback groq/openai/gpt-oss-120b     # your own key as the backup for hosted credits
testis models fallback --off
```

The fallback applies only when **money or quota** ran out. A bad key, a rate limit or your own `--max-credits` cap do not trigger it. When it switches, Testis tells you. A fallback to hosted credits spends credits, so it is your choice to set.

## What the model sees

To test your app, the model reads what the tester sees: page content (text and structure, and screenshots if the model supports images), API responses, program output and your PRD. Passwords and other secrets you give as variables are typed for it and never shown to it. If none of this may leave your machine, use a local model with Ollama or LM Studio.

Text the app under test produces is treated as untrusted data, not as instructions, so a page that says "ignore your instructions" does not steer the tester.
