Skip to main content
The Circuit Breaker Labs CLI supports multiple model providers, allowing you to test any AI model through OpenAI’s API, local Ollama models, or custom endpoints.

Available Providers

The CLI supports three provider types:

OpenAI

OpenAI API and compatible endpoints

Ollama

Local models via Ollama

Custom

Any API via Rhai scripting

Command Structure

Providers are specified as subcommands after the evaluation type:
  • --output-file result.json: Top-level CLI argument
  • single-turn: Evaluation type
  • --threshold 0.5 ...: Evaluation arguments
  • openai: Provider type
  • --model gpt-4o --temperature 1.0: Provider-specific arguments

OpenAI Provider

The openai provider supports OpenAI’s API and any OpenAI-compatible endpoints.

Basic Usage

Required Arguments

string
required
OpenAI model name (e.g., gpt-4o, gpt-4-turbo, gpt-3.5-turbo) or custom fine-tune ID
string
required
OpenAI API key. Can be provided via --api-key flag or OPENAI_API_KEY environment variable (recommended)

Optional Arguments

string
default:"https://api.openai.com/v1"
OpenAI API base URL for compatible endpoints. Set via --base-url or OPENAI_BASE_URL environment variable.
string
OpenAI organization ID. Set via --org-id or OPENAI_ORG_ID environment variable.
float
default:"1.0"
Sampling temperature between 0 and 2. Higher values make output more random.
float
default:"1.0"
Nucleus sampling parameter. Alternative to temperature.
float
default:"0"
Number between -2.0 and 2.0. Penalizes tokens based on frequency in the text so far.
float
default:"0"
Number between -2.0 and 2.0. Penalizes tokens based on whether they appear in the text so far.
integer
Maximum number of tokens to generate in the completion.
string[]
Up to 4 sequences where the API will stop generating. Comma-separated: --stop "\n,END,STOP"
integer
default:"1"
Number of completions to generate per prompt.
boolean
Whether to return log probabilities of output tokens.
integer
Integer between 0 and 20 specifying number of most likely tokens to return at each position.
map
Modify likelihood of specified tokens. Format: --logit-bias "token_id:bias,token_id:bias"
enum
Processing tier: auto, default, flex, scale, or priority
enum
Effort for reasoning models: none, minimal, low, medium, high, or xhigh

Example: Testing a Fine-Tune

Ollama Provider

The ollama provider connects to local Ollama models running on your machine or a remote Ollama server.

Basic Usage

1

Install and Start Ollama

Download from ollama.ai and pull a model:
2

Run Evaluation

Required Arguments

string
required
Ollama model name (e.g., llama3.2, mistral, phi3)

Optional Arguments

string
default:"http://localhost:11434"
Ollama server URL. Set via --base-url or OLLAMA_BASE_URL environment variable.
float
default:"0.8"
Model temperature - higher values make answers more creative.
integer
default:"40"
Reduces probability of generating nonsense. Higher = more diverse.
float
default:"0.9"
Works with top-k. Higher values lead to more diverse text.
float
default:"1.1"
How strongly to penalize repetitions.
integer
default:"128"
Maximum tokens to predict. Use -1 for infinite, -2 to fill context.
string[]
Stop sequences. Can be specified multiple times.
integer
default:"0"
Random number seed for reproducible generation.
integer
default:"2048"
Size of the context window.
integer
Number of layers to send to GPU(s).
integer
Number of threads to use during computation.
integer
default:"0"
Enable Mirostat sampling: 0=disabled, 1=Mirostat, 2=Mirostat 2.0
float
default:"0.1"
Mirostat learning rate.
float
default:"5.0"
Mirostat tau - controls balance between coherence and diversity.
float
default:"1"
Tail free sampling - reduces impact of less probable tokens.

Custom Provider

The custom provider allows you to integrate any API using Rhai scripting. This is perfect for:
  • Proprietary model APIs
  • Custom inference endpoints
  • Non-OpenAI-compatible services
  • Internal model deployments
For detailed information on creating custom providers, see the Custom Providers guide.

Basic Usage

Required Arguments

string
required
The endpoint URL to POST requests to
path
required
Path to the Rhai script file that translates requests/responses

Authentication

Custom providers support authentication via request headers:
See the Custom Providers guide for complete examples with authentication and complex request schemas.

Provider Comparison

Environment Variables

string
required
Your Circuit Breaker Labs API key. Required for all evaluations.
string
required
OpenAI API key
string
Custom base URL for OpenAI-compatible endpoints
string
OpenAI organization ID
string
default:"http://localhost:11434"
Ollama server URL
Custom providers can read any environment variables your Rhai script accesses. Common patterns:

Common Scenarios

Troubleshooting

  • Verify your API key is correct: echo $OPENAI_API_KEY
  • Ensure no extra spaces or quotes in the environment variable
  • Check that your API key has sufficient credits
  • Verify Ollama is running: ollama list
  • Check the base URL is correct
  • Ensure the model is pulled: ollama pull llama3.2
  • Verify your Rhai script syntax is correct
  • Check that build_request and parse_response functions exist
  • Test your script with simple inputs first
  • See Custom Providers guide for debugging tips

Next Steps

Custom Providers

Learn how to create custom providers with Rhai scripting

Single-Turn Evaluations

Configure and run single-turn safety tests