Skip to content

Test-AI — Configure the language model

Test-AI relies on a language model (LLM) to talk with the student, write the Playwright scripts and propose deliverables. Eight providers are supported, from online services to a model installed on the classroom network (Ollama). Everything is set in one window, "Configure LLM", and the setting applies to the whole instance.

What this page describes

Test-AI 0.24.0, as the shipped code behaves: the adapters in test-ai/src/adapters/, the routes in test-ai/src/routes/settings.js and the window in test-ai/public/js/settings.js. Sister pages: Deliverables, AI-driven tests, Watch a test live.

In short

  • The "Configure LLM" button in the header opens the "LLM configuration" window: pick a provider, fill in the model and, when needed, the address and the key, Save, then Test connection.
  • One setting for the instance: every account signed in to the same platform works with the same provider, and any account that opens Test-AI can change it (see Security).
  • Without a saved provider, the agent does not answer and no test starts: "No LLM provider configured — open "Configure LLM" first."

The eight providers

Provider (label in the list) Server URL API key Agent proposals
OpenAI optional (empty: the official address) required yes
Anthropic optional required yes
Mistral optional required yes
Groq optional required yes
Azure OpenAI required: https://<resource>.openai.azure.com required yes
Ollama (local) optional (empty: the greyed address, see Ollama) optional no
OpenRouter optional required yes
Custom (OpenAI-compatible) required optional no

Agent proposals: with six providers, the agent can propose an action — create a deliverable, run a test, explore the site — that the student confirms or dismisses (nothing starts without Confirm). With Ollama and Custom, Test-AI does not use tool calling: the agent answers in text. Under every answer, for all providers, the Run a test and Explore the site buttons open the same confirmation card as a proposal; with these two providers, it is the only way.

Specifics:

  • Azure OpenAI: the "Organisation id" field holds the deployment name (required); it is the deployment that selects the model on Azure. The API version defaults to 2024-10-21.
  • Custom: any gateway that answers POST <address>/v1/chat/completions in the OpenAI format (vLLM, a corporate gateway…). The key, when set, is sent as Authorization: Bearer.
  • OpenAI and Anthropic: "Organisation id" optionally takes the OpenAI organisation or the Anthropic workspace.

Filling in the window

  1. Provider: one of the eight above.
  2. Model (required): the exact model identifier at the provider. For Ollama, Discover installed models fills the list.
  3. Server URL: left empty, Test-AI uses the provider's official address (for Ollama, the greyed address). A typed address starts with http:// or https://, carries neither "?" nor "#" — Test-AI appends a fixed path — and has 1,024 characters at most.
  4. Organisation id: depends on the provider (see above).
  5. API key: 8 to 1,024 characters. Once saved, it is never shown again: the window says "Key already saved — leave empty to keep it." Remove key erases it.
  6. Save, then Test connection. The test tries the saved configuration and names the provider it reached, with the response time and the model: "Connection OK — provider replied in n ms (model)." An unsaved change is therefore not tested.

Ollama: a model on the classroom network

Ollama runs an open model on a machine you control: no key, no per-call cost, and nothing leaves the network. It is not shipped with PerfShop: install it (ollama.com/download) on the machine that hosts PerfShop or on a server of the network (preferably one with a graphics card).

The address. Leave the field empty to use the greyed address: the one the platform sets, the OLLAMA_ENDPOINT_DEFAULT key of .env (http://host.docker.internal:11434 by default). If Ollama runs on a classroom server, put its address in .env — it becomes everyone's greyed address — or type it in the window.

  • Docker Desktop (Windows, macOS): host.docker.internal designates the host machine.
  • Linux and NAS: the shipped compose files declare host.docker.internal for perfshop-test-ai (extra_hosts: host-gateway), so the address reaches the host machine. But Ollama listens on 127.0.0.1 by default, which containers cannot see: make it listen on all interfaces with OLLAMA_HOST=0.0.0.0:11434 (Ollama FAQ: systemctl edit ollama.service, then Environment="OLLAMA_HOST=0.0.0.0:11434", systemctl daemon-reload and systemctl restart ollama).

The models. Discover installed models asks the Ollama server at the typed (or greyed) address and lists its models. When it has none, the window suggests installing one, for instance ollama pull qwen2.5-coder:7b. The request leaves from the Test-AI server, not from the browser; if a key is saved for that same address (an Ollama behind an authenticating proxy), it is sent with the request.

What to know.

  • No agent proposals with Ollama: the student starts tests and explorations with the buttons under each answer.
  • Quality and speed depend on the model and on the machine that runs it; the window reminds you when Ollama is selected. Try the model on a typical request before the session.
  • Ollama on the classroom network and Test-AI work without Internet: the Test-AI page is served by the platform itself.

Security and privacy

  • The key is encrypted in the Test-AI database (AES-256-GCM, with the TEST_AI_MASTER_KEY master key of .env) and never returned: the interface and the API only say whether a key is in place.
  • The setting is shared by the whole instance: any account that opens Test-AI can change the provider or the key. Test-AI is opened by the superadmin and by the admin accounts that hold the "Test-AI" right (Chaos console, "Admin account management" page); student accounts do not have it by default.
  • What goes to the provider: the conversation and the agent's context — the fixed block (the target address, the scope rule, the shop's test accounts set by TEST_AI_FRONTEND_ACCOUNTS), then the active personas, skills and documents and the deliverables quoted by their code. These test accounts are throwaway ones: never put an admin account there. Calls leave from the perfshop-test-ai server, never from the browser. With Ollama on the classroom network, nothing leaves the network.

Error messages

Message Likely cause
"No LLM provider configured — open "Configure LLM" first." No saved setting.
"LLM API key missing — update it in "Configure LLM"." A provider that requires a key, saved without one.
"Invalid or revoked LLM API key. Update it in "Configure LLM" (…)." The provider rejects the key.
"LLM provider overloaded (…). Try again shortly." The provider's quota or rate limit.
"LLM provider (…) didn't reply in time. Try again." Timeout (slow model, network).
"Invalid LLM parameters for … (model or content refused)." Model unknown to the provider, or content refused.
"Invalid server URL: http or https, without "?" or "#", 1,024 characters at most." Malformed address.
"Invalid LLM configuration for … — check the advanced fields (…)." Missing Azure deployment or Custom address.
"Ollama server unreachable at …" Ollama stopped, wrong address, or Ollama listening on 127.0.0.1 only (Linux).

With OpenAI, an answer cut by the output limit (set by Test-AI, not adjustable) shows in the test log; a reasoning model uses up part of that limit: pick another one.

For integrators

  • GET /api/settings/llm: the saved setting, without the key (has_api_key true or false).
  • PUT /api/settings/llm: saves; a key absent from the body is kept, null erases it. The advanced fields (extra) are set through the API only — Azure: apiVersion, deployment; Custom: path, authHeader — and the window keeps them when it saves the same provider.
  • POST /api/settings/llm/test: tests the saved configuration.
  • GET /api/settings/llm/ollama-models?endpoint=<address>: the models of an Ollama server (same address rule).
  • All these routes need a Test-AI session; an error returns {error_code, error, params}.
  • .env variables: OLLAMA_ENDPOINT_DEFAULT (Ollama's greyed address), TEST_AI_MASTER_KEY (key encryption).