OpenAI
Connect hi-shell to OpenAI to use GPT models for shell command generation. GPT models provide excellent command generation quality with broad knowledge of shell commands across platforms.
Prerequisites
- An OpenAI account
- An API key from platform.openai.com/api-keys
Setup
1. Get an API Key
- Sign up at platform.openai.com
- Go to API Keys
- Create a new secret key
- Copy the key (starts with
sk-)
2. Configure hi-shell
hi-shell --init
# Select "Cloud" â "OpenAI"
# Paste your API key
# Choose a model (e.g., "gpt-4o-mini") Manual Configuration
Edit ~/.config/hi-shell/config.toml:
llm_provider = "Cloud"
cloud_provider = "OpenAI"
cloud_model = "gpt-4o-mini"
api_key = "sk-your-api-key-here" Available Models
| Model | Best For | Relative Cost |
|---|---|---|
gpt-4o-mini | Fast, affordable, good quality | Low |
gpt-4o | Best quality responses | Medium |
gpt-4.1-mini | Latest fast model | Low |
gpt-4.1 | Latest flagship model | Medium |
We recommend gpt-4o-mini as the default â itâs fast, affordable, and generates excellent shell commands.
Configuration Options
| Option | Description |
|---|---|
cloud_model | Model identifier |
api_key | Your OpenAI API key |
Pricing
OpenAI charges per token. For hi-shell usage:
- Each command typically uses ~200-500 tokens
- gpt-4o-mini: ~$0.0002 per command
- gpt-4o: ~$0.001 per command
Very affordable for typical daily usage. Check openai.com/pricing for current rates.
Troubleshooting
âInvalid API keyâ Error
- Verify your key at platform.openai.com/api-keys
- Ensure youâre using an API key, not a ChatGPT Plus subscription
- Check for extra whitespace
âInsufficient quotaâ
- Add billing details in OpenAI platform settings
- Check your usage limits
Organization Errors
If youâre part of multiple organizations, make sure youâre using the correct API key for the intended organization.