Skip to content

Real AI models

AgentPlay is model-neutral (ADR-0003): no vendor is built into the core, and every model gets the same prompt.

use Connects to Install
openai OpenAI included
openrouter Hundreds of hosted models through OpenRouter included
groq, deepseek, gemini, mistral, together That hosted service included
ollama A local Ollama server included
openai_compat Any other OpenAI-compatible server: LM Studio, vLLM, llama.cpp, proxies included
anthropic Claude, through the official SDK pip install "agentplaykit[anthropic]"
command Any program speaking JSON lines included
http Any agent behind a URL included
mcp A tool on an MCP server pip install "agentplaykit[mcp]" (Python 3.10+)

Provider presets

Each named service is a preset: it fills in the address and the key variable, so model is all you need (ADR-0005).

use Default base_url Key variable
openai https://api.openai.com/v1 OPENAI_API_KEY
openrouter https://openrouter.ai/api/v1 OPENROUTER_API_KEY
groq https://api.groq.com/openai/v1 GROQ_API_KEY
deepseek https://api.deepseek.com/v1 DEEPSEEK_API_KEY
gemini https://generativelanguage.googleapis.com/v1beta/openai GEMINI_API_KEY
mistral https://api.mistral.ai/v1 MISTRAL_API_KEY
together https://api.together.xyz/v1 TOGETHER_API_KEY
ollama http://localhost:11434/v1 none
- id: x
  use: groq
  config:
    model: "<model id from the provider's model list>"
    price: {input_per_mtok: 0.5, output_per_mtok: 1.5}   # the model's listed prices
  • If the key variable is not set, the run stops before any request and says which variable to export.
  • Every preset takes all the openai_compat options below. Override base_url to go through a proxy, api_key_env to read a different variable, or api_key_env: null to send no key.
  • A hosted preset is never counted as free, even through a proxy on localhost, so budget caps keep working. Set price, or local: true if the calls really cost nothing.
  • The log records the preset name as the provider (override with provider).
  • Replies are plain JSON text by default, the same for every model, so comparisons are fair. Set tool_calls: true to use native tool calls.

OpenRouter

OpenRouter gives one key for hundreds of hosted models:

- id: x
  use: openrouter
  config:
    model: "<provider>/<model>"          # copy the exact id from openrouter.ai/models
    app_name: "My benchmark"             # optional: sent as X-Title
    app_url: "https://example.org"       # optional: sent as HTTP-Referer
  • Cost is recorded for you. AgentPlay asks OpenRouter for each call's actual cost and logs it, so price is optional here. A price you set still wins.
  • Nothing identifies your app unless you set app_name / app_url (OpenRouter uses them for its app rankings).
  • Pick a chat (text to text) model. Embedding models (often with embed in the name) cannot play: every request is refused and runs end as aborted.
  • Models ending in :free cost nothing but have tight rate limits. Many games in a row hit 429 errors; the multi-run summary lists them under errors:. Run fewer games, wait between batches, or raise retries.
  • usage events record the model OpenRouter actually served, so you can see if it routed you elsewhere.

Ollama

- {id: x, use: ollama, config: {model: "llama3.2"}}   # run `ollama pull llama3.2` first

No key, and cost is 0 on this machine. If Ollama is not running, the error says to start it with ollama serve. For Ollama on another machine, set base_url: "http://<host>:11434/v1" and local: true to keep it free; otherwise its cost is unknown and the token cap applies.

openai_compat

For any other server that speaks the OpenAI chat format (LM Studio, vLLM, llama.cpp, a proxy):

- id: x
  use: openai_compat
  config:
    base_url: "http://localhost:1234/v1"    # required
    model: "local-model"                     # required
    api_key_env: MY_API_KEY                  # only if the server needs a key
    price: {input_per_mtok: 0.5, output_per_mtok: 1.5}
    tool_calls: false     # default: the model answers with JSON text, which every server supports
    json_mode: false
    temperature: 0.2      # sent only if set
    max_output_tokens: 1024
    timeout_s: 120
    retries: 5          # default; about 30 s of backoff for rate limits

anthropic

- id: x
  use: anthropic
  config:
    model: claude-opus-5-5
    api_key_env: ANTHROPIC_API_KEY
    price: {input_per_mtok: 4.0, output_per_mtok: 20.0}

It lets the model choose to call the act tool (tool_choice: auto), sends no sampling parameters unless you set them, and reports a refusal as an agent error.

Costs and budgets

  • Every call's tokens and cost are logged, and runs stop at limits.max_cost_usd (default $1).
  • AgentPlay ships no price list (ADR-0004): set price from your provider's current price list. The exception is openrouter, which reports each call's actual cost.
  • Local servers cost $0. Without a price, cost is unknown: the log gets a warning and limits.max_tokens applies instead.

Keys and safety

  • Keys come only from environment variables (api_key_env), never from scenario files.
  • Keys are redacted from logs, results and errors.
  • Keys are never sent over plain http:// to a remote host (override: allow_insecure_http: true).
  • Redirects are never followed, so a key only goes to the host you named.
  • Agent programs (command, mcp) do not inherit your environment; forward variables with pass_env.

Retries

Rate limits and server errors are retried with backoff (retries, default 5: waits of 1, 2, 4, 8 and 16 seconds), honoring Retry-After. Each retry is logged as a provider_error. If the provider stays down, the run ends as aborted; this never counts as a forfeit.