Skip to content

Rawi (راوي) Documentation | Environment Variables

Configuring Environment Variables for Rawi CLI

Section titled “Configuring Environment Variables for Rawi CLI”

Rawi CLI supports environment variables for configuration, similar to the AWS CLI. Environment variables provide a convenient way to set credentials, provider options, and other settings for scripting, automation, or temporary overrides.

Rawi CLI loads configuration in the following order (highest to lowest):

  1. Command-line options (e.g. --profile, --provider, --api-key)
  2. Environment variables (see below)
  3. Profile settings in ~/.rawi/credentials (default or named profile, stored as JSON)

If you set a value in multiple places, the command-line option takes precedence over environment variables, which take precedence over profile settings.


  1. Set environment variables in your shell:

    Terminal window
    export RAWI_PROFILE=work
    export RAWI_PROVIDER=openai
    export RAWI_API_KEY=sk-your-key
    export RAWI_MODEL=gpt-4o
    export RAWI_BASE_URL=https://api.openai.com/v1
    export RAWI_TEMPERATURE=0.7
    export RAWI_MAX_TOKENS=2048
    export RAWI_LANGUAGE=english

VariableDescriptionExample Value
RAWI_PROFILEProfile name to usework
RAWI_PROVIDERAI provider (openai, anthropic, etc.)openai
RAWI_API_KEYAPI key for the providersk-...
RAWI_MODELModel namegpt-4o
RAWI_BASE_URLCustom base URL for provider APIhttps://api.openai.com/v1
RAWI_TEMPERATURESampling temperature (0-2)0.7
RAWI_MAX_TOKENSMaximum tokens for response2048
RAWI_LANGUAGELanguage setting (english, arabic)english
RAWI_REGIONRegion (for Bedrock/AWS providers)us-east-1
RAWI_ACCESS_KEY_IDAWS access key (for Bedrock)AKIA...
RAWI_SECRET_ACCESS_KEYAWS secret key (for Bedrock)wJalr...
RAWI_SESSION_TOKENAWS session token (for Bedrock, optional)FwoGZXIvYXdz...
RAWI_USE_PROVIDER_CHAINUse AWS provider chain (for Bedrock)true
RAWI_RESOURCE_NAMEAzure resource name (for Azure provider)my-azure-resource
RAWI_API_VERSIONAzure API version2024-10-01-preview

Note: Not all variables are required for every provider. See the Configuration Guide and Providers Guide for details.


Terminal window
export RAWI_PROFILE=work
export RAWI_PROVIDER=bedrock
export RAWI_REGION=us-west-2
export RAWI_USE_PROVIDER_CHAIN=true
rawi ask "Summarize this S3 bucket policy"

This will use the work profile, Amazon Bedrock provider, and the AWS credential provider chain for authentication.


To make environment variables available in every terminal session, add the export lines to your shell’s startup file (e.g. ~/.bashrc, ~/.zshrc).


You can always override environment variables by specifying options directly:

Terminal window
rawi ask "What is TypeScript?" --profile personal --provider openai --model gpt-4o

  • If a required variable is missing, Rawi will prompt for configuration or show an error.
  • To view the current configuration, run:
Terminal window
rawi configure --show