Rawi (راوي) Documentation | Configure Settings
Configuration and Credential File Settings in Rawi CLI
Section titled “Configuration and Credential File Settings in Rawi CLI”Rawi CLI allows you to save your frequently used configuration settings and credentials in files managed by the CLI. These files are organized into profiles, making it easy to switch between different environments or accounts.
Where Are Configuration Settings Stored?
Section titled “Where Are Configuration Settings Stored?”- Credentials are stored in a file named
credentials
in the~/.rawi/
directory. - Configuration options are stored in a file named
config
in the same directory.
You can override the default location by setting environment variables (e.g., RAWI_CONFIG_FILE
, RAWI_CREDENTIALS_FILE
).
Using Named Profiles
Section titled “Using Named Profiles”-
Use a different profile for a single command:
Terminal window rawi ask --profile work "What is the weather today?"
-
Set a profile for all commands in your session:
Terminal window export RAWI_PROFILE=work
Format of the Credential File
Section titled “Format of the Credential File”Rawi CLI stores all credentials and provider settings in a single JSON file at ~/.rawi/credentials
.
Each top-level key is a profile name (e.g., default
, openai
, gemini
, etc.), and the value is an object containing provider, model, API key, and any provider-specific settings.
Example: ~/.rawi/credentials
{ "default": { "provider": "qwen", "model": "qwen-plus", "apiKey": "test_api_key", "temperature": 0.7, "maxTokens": 2048, "language": "english", "providerSettings": { "baseURL": "https://custom.qwen.endpoint.com/v1" } }, "openai": { "provider": "openai", "model": "o3-mini", "temperature": 0.7, "maxTokens": 2048, "language": "english", "apiKey": "sk-proj-..." } // ...other profiles...}
There is no ~/.rawi/config
file by default. All configuration is managed through the credentials JSON file.
Setting and Viewing Configuration
Section titled “Setting and Viewing Configuration”-
Set up your configuration interactively:
Terminal window rawi configure
-
Set values directly:
Terminal window rawi configure --provider openai --model gpt-4o --api-key sk-xxxxxx
-
List all profiles:
Terminal window rawi configure --list
-
Show a specific profile:
Terminal window rawi configure --show --profile work
Supported Config File Settings
Section titled “Supported Config File Settings”provider
: The AI provider (e.g., openai, anthropic, google, ollama, etc.)model
: The model to use (e.g., gpt-4o, claude-3-sonnet-20240229)output
: Output format (json
,text
,markdown
)api_key
: Your API key (store in credentials file)base_url
: (Optional) Custom API endpointprofile
: Profile name
Configuration Precedence
Section titled “Configuration Precedence”Settings are resolved in the following order:
- Command line options (e.g.,
--provider
,--model
) - Environment variables (e.g.,
RAWI_PROVIDER
,RAWI_API_KEY
) - Profile in config/credentials files
- Default profile
Example: Switching Profiles
Section titled “Example: Switching Profiles”- Switch and use a profile in one command:
bash rawi configure --profile work --provider anthropic --model claude-3-sonnet-20240229 --api-key sk-ant-yyyyyy rawi ask --profile work "Summarize this document."
- Keep your API keys secure. Do not share your
~/.rawi/credentials
file. - For troubleshooting configuration issues, see the Troubleshooting Guide.
This format provides clear, AWS CLI-style documentation for your users, making it easy to understand and manage Rawi CLI configuration.