Global Options
Properties
The Kirby Copilot plugin can be configured globally in the config.php
file of your Kirby project. All options are nested under the johannschopplich.copilot
key.
return [
'johannschopplich.copilot' => [
// Customize Kirby Copilot
]
];
All possible options have reasonable defaults. Only if you want to change the default behavior, you need to add the option to your configuration.
The following list contains all available options:
provider
String
The provider
option defines the AI model provider that will be used to generate content across all Copilot sections. The plugin supports two providers:
openai
(default)anthropic
mistral
By default, the openai
provider is used. To change the provider, such as Anthropic Claude or Mistral AI, you need to add the configuration for the respective provider:
return [
'johannschopplich.copilot' => [
'provider' => 'anthropic',
'providers' => [
'anthropic' => [
'apiKey' => 'YOUR_API_KEY',
'model' => 'claude-3-5-sonnet-20240620'
]
]
]
];
providers
Array
apiKey
String
The providers
option holds the configuration for each AI provider, such as the AI model to use for text generation. A valid API key is required for Kirby Copilot to make requests to the AI provider.
No API key is provided by default. Please be sure to add your API key to the configuration:
return [
'johannschopplich.copilot' => [
'providers' => [
'openai' => [
'apiKey' => 'YOUR_API_KEY'
]
]
]
];
model
String
The model
option defines the provider model used to generate content. In the case of OpenAI, the default configuration uses the gpt-4o
model:
return [
'johannschopplich.copilot' => [
'providers' => [
'openai' => [
'model' => 'gpt-4o'
]
]
]
];
For example, if you prefer the cheaper but less accurate gpt-4o-mini
model, you can change the default model:
return [
'johannschopplich.copilot' => [
'providers' => [
'openai' => [
'model' => 'gpt-4o-mini'
]
]
]
];
baseUrl
String
The optional baseUrl
option applies to the Mistral provider and lets you define the base URL of a custom Mistral API instance.
temperature
Float
The temperature
option defines the randomness of the generated content. The higher the temperature, the more random the generated content will be.
The default value is 0.7
.
If you want the model to be more creative, you can increase the temperature:
return [
'johannschopplich.copilot' => [
'temperature' => 1
]
];
systemPrompt
String
The systemPrompt
is probably the most important configuration option besides the model
. It is the structural foundation of the generated content and complements the prompt that is provided by the user (userPrompt
section property).
With Kirby Copilot v2, the system prompt has been redesigned to accommodate all use cases without the need for manual configuration. The system prompt is designed to instruct the AI model on how to structure the generated text and what context to consider.
blocksUpdateThrottle
Integer
The blocksUpdateThrottle
option defines the number of milliseconds that the plugin will wait before updating the blocks field with new generated content.
The default value is 250
. Any value below 50
will be capped to 50
.
A minimum throttle interval is required to avoid performance issues, because the HTML to blocks conversion is done via an internal API route.
Configuration Example
As a reference, below is an example of a complete configuration with the most common options:
return [
'johannschopplich.copilot' => [
'provider' => 'openai',
'providers' => [
'openai' => [
'model' => 'gpt-4o',
'apiKey' => 'YOUR_API_KEY'
]
],
'temperature' => 0.7,
'blocksUpdateThrottle' => 250
]
];