Configuration
Settings
Proper settings is key to getting the most out of Cookie AI CLI. This guide will walk you through the steps to configure the CLI tool to suit your preferences and requirements.
Initial settings
Start by initializing your Cookie AI CLI settings. Run the following command in your terminal:
ai --init
This command launches a setup wizard that guides you through the settings process.
Settings
Cookie AI CLI offers various settings to tailor the tool to your needs.
Service Type
Specify the AI service you want to use. Currently, Cookie AI CLI supports openai and custom services.
openai
: Use this option if you want to integrate with OpenAI's GPT models.custom
: Choose this for any custom or local AI models compatible with the OpenAI messages API.
Model
- Define the AI model (e.g., gpt-4) you wish to use for processing commands. This option is mandatory.
API Key (OpenAI Service)
- If you're using OpenAI, you'll need to provide your OpenAI API key. You can find your API key on your OpenAI dashboard. Make sure you have added at least $5 of credits to your account to use the API.
Endpoint (Custom Service)
- For custom services, specify the endpoint URL of your AI service.
Additional Options
- headers: Custom headers for HTTP requests (optional).
- payload: Additional payload data for custom services (optional).
Settings Schema Overview
The settings.json schema is defined as follows:
endpoint
: Optional. A URL string required when using a custom service.service
: Required. Specifies the service type, either"custom"
or"openai"
.model
: Required. Indicates the model to use (e.g.,"gpt-4"
).openai
: Optional. Contains OpenAI specific settings.key
: Required for theopenai
service. Your OpenAI API key.
custom
: Optional. Contains settings for a custom service.payload
: Optional. A record of strings for additional payload data.
headers
: Optional. A record of strings for custom headers in each request.
Example settings
Here’s how you can set up the settings for different services:
OpenAI Service
{
"service": "openai",
"model": "gpt-4",
"openai": {
"key": "<your-open-ai-api-key>"
}
}
Custom Service
{
"service": "custom",
"endpoint": "https://<your-custom-endpoint>/v1/chat/completions",
"model": "gpt-4",
"headers": {
"Authorization": "Bearer <your-token>",
"Some-Other-Header": "Some-Other-Value"
}
}
Custom Payload Example
{
"service": "custom",
"endpoint": "https://<your-custom-endpoint>/v1/chat/completions",
"model": "gpt-4",
"payload": {
"instruction_template": "Alpaca"
}
}
Editing settings Manually
You can also edit the settings file manually if you prefer. The file is located at:
~/.cookie-ai/settings.json
Make sure to follow the JSON structure as outlined in the examples above.
Finalizing settings
After configuring your settings, save the changes. If you edited the settings file manually, re-run the ai command to apply the new settings.
Troubleshooting
If you encounter issues after configuring your settings, verify that all details are correct, especially API keys and endpoints. For further assistance, visit our GitHub Issues page or join our Discord Community.
Remember, proper settings is essential for the effective functioning of Cookie AI CLI. Take your time to ensure all settings are correctly set up to enjoy a seamless command-line experience.