Rawi (راوي) Documentation | Configure
Configuring settings for the Rawi CLI
Section titled “Configuring settings for the Rawi CLI”The Rawi Command Line Interface (Rawi CLI) uses configuration settings to determine how it interacts with AI providers and manages your sessions. These settings include:
- Credentials: Identify who is calling the API. API keys or tokens are used to authenticate your requests and determine your access permissions.
- Provider and Model: Specify which AI provider and model to use for your requests.
- Other options: Such as default profile, output format, and custom endpoints.
Configuration and credentials precedence
Section titled “Configuration and credentials precedence”Rawi CLI reads configuration and credentials from several locations, in the following order of precedence:
- Command line options – Overrides all other settings. Example:
--provider
,--model
,--api-key
,--profile
. - Environment variables – Set variables like
OPENAI_API_KEY
orRAWI_PROFILE
in your shell. - Profile configuration files – Stored in
~/.rawi/credentials
and~/.rawi/config
. - Default profile – Used if no profile is specified.
Configuration Examples
Section titled “Configuration Examples”-
Set up your credentials and default provider:
Terminal window rawi configure# Example prompts:# Provider [openai]: openai# Model [gpt-4o]: gpt-4o# API Key [None]: sk-... -
Configure a named profile:
Terminal window rawi configure --profile work# Provider [openai]: openai# Model [gpt-4o]: gpt-4o# API Key [None]: sk-...
-
Configure a profile non-interactively:
Terminal window rawi configure --provider openai --model gpt-4o --api-key sk-your-key
-
Set your API key in your shell:
Terminal window export OPENAI_API_KEY=sk-your-keyrawi ask "Hello, world!"
-
List, show, or switch between profiles:
Terminal window rawi configure --listrawi configure --show --profile workrawi configure --profile work --provider anthropic --model claude-3-sonnet-20240229
Configuration file locations
Section titled “Configuration file locations”- Linux/macOS:
~/.rawi/credentials
- Windows:
%USERPROFILE%\.rawi\credentials
For more details, see the Troubleshooting Guide or run rawi configure --help
.