Configuration
All of Scribe's settings live in app/Config/AI.php after you publish the config.
defaultDriver
The driver key to use when a prompt doesn't specify one. Must match a key in the $drivers array below.
Change it to switch providers globally:
drivers
Each driver entry is a keyed array. The key is what you use in $defaultDriver and in BasePrompt::$driver.
Per-driver options
Every driver supports these keys:
| Key | Type | Default | Description |
|---|---|---|---|
apiKey |
string | '' |
Your API key for this provider |
model |
string | provider default | The model to use for completion requests |
timeout |
int | 30 |
Request timeout in seconds |
maxTokens |
int | varies | Maximum tokens the model may generate (Claude and Gemini; omit for OpenAI to use provider default) |
baseUrl |
string | (optional) | Override the provider's API endpoint |
Example: full config
<?php
public array $drivers = [
'claude' => [
'apiKey' => env('ANTHROPIC_API_KEY', ''),
'model' => 'claude-haiku-4-5',
'timeout' => 30,
'maxTokens' => 4096,
],
'openai' => [
'apiKey' => env('OPENAI_API_KEY', ''),
'model' => 'gpt-5.4-mini',
'timeout' => 30,
],
'gemini' => [
'apiKey' => env('GOOGLE_API_KEY', ''),
'model' => 'gemini-flash-latest',
'timeout' => 30,
'maxTokens' => null, // set an int to cap output tokens
],
];
Using a custom endpoint
The optional baseUrl key lets you point a driver at a compatible API endpoint — useful for local models or proxies:
<?php
'openai' => [
'apiKey' => 'not-needed',
'model' => 'local-llama',
'timeout' => 60,
'baseUrl' => 'http://localhost:11434/v1',
],
Adding a custom driver
You can add your own driver key for any provider that has a matching Scribe driver package:
<?php
public string $defaultDriver = 'my-provider';
public array $drivers = [
'my-provider' => [
'apiKey' => env('MY_PROVIDER_KEY', ''),
'model' => 'my-model',
'timeout' => 30,
],
];
Note
Scribe doesn't validate driver keys at config-load time. If you reference a key with no registered driver factory, AIService::run() throws AIException with a clear message.
API key management
Never put real API keys directly in app/Config/AI.php. The config file is typically committed to version control — keys embedded there will be exposed.
Instead, store keys in your .env file and reference them via env(), which is what the default config already does:
A .env.example is included in this package as a starting point. Copy it to .env in your project root and fill in the keys for the drivers you use:
Make sure .env is listed in your .gitignore (CI4 projects include this by default).