Setup
After installing Chat GipiTTY, you'll need to configure it with your API credentials and any custom settings. This page covers the essential setup steps to get you started.
API Key Configuration
Chat GipiTTY requires an API key to communicate with AI services. The setup process depends on which provider you're using.
OpenAI API Key
For OpenAI services (recommended), set up your API key as an environment variable:
export OPENAI_API_KEY=your_key_here
To make this permanent, add the export statement to your shell profile:
# For bash users
echo 'export OPENAI_API_KEY=your_key_here' >> ~/.bashrc
source ~/.bashrc
# For zsh users
echo 'export OPENAI_API_KEY=your_key_here' >> ~/.zshrc
source ~/.zshrc
Getting an OpenAI API Key
- Visit OpenAI's website
- Sign up for an account or log in
- Navigate to the API section
- Generate a new API key
- Copy the key and use it in the export command above
Security Note: Keep your API key secure and never commit it to version control. The environment variable approach keeps your key out of your code and configuration files.
Custom API Endpoints
Chat GipiTTY supports any OpenAI-compatible API provider. You can specify a custom API endpoint by setting the OPENAI_BASE_URL
environment variable.
Default Behavior
If not set, Chat GipiTTY uses the default OpenAI endpoint:
https://api.openai.com
Provider Examples
Local Ollama Instance
export OPENAI_BASE_URL=http://localhost:11434/v1
Google Gemini (via OpenAI-compatible proxy)
export OPENAI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
Mistral AI
export OPENAI_BASE_URL=https://api.mistral.ai/v1
Other OpenAI-compatible Services
export OPENAI_BASE_URL=https://your-provider.com/v1
Custom Endpoint Patterns
# If your provider uses a different endpoint pattern
export OPENAI_BASE_URL=https://custom-api.com/v2/chat/completions
URL Construction Logic
Chat GipiTTY intelligently constructs the API endpoint:
- If your base URL already contains
/chat/completions
, it uses it as-is - If your base URL ends with
/v1
(or similar version pattern), it appends/chat/completions
- Otherwise, it appends
/v1/chat/completions
(standard OpenAI pattern)
Basic Configuration
Default Model
Set your preferred default model:
cgip config --set model=gpt-4o
View Current Configuration
Check your current settings:
cgip config --get model
Available Configuration Options
Common configuration options include:
model
: Default AI model to usesystem_prompt
: Default system prompt for conversationsmax_tokens
: Maximum response lengthtemperature
: Response creativity (0.0 to 2.0)
Session Management Setup
To enable session management across terminal sessions, set up a session name:
Unique Session Per Terminal
export CGIP_SESSION_NAME=$(uuid)
Daily Sessions (shared across terminals)
export CGIP_SESSION_NAME=$(date -I)
Custom Session Management
# Custom session based on your needs
export CGIP_SESSION_NAME="my-project-session"
Add your chosen session configuration to your shell profile for persistence.
Verification
Test your setup with a simple command:
echo "Hello, world!" | cgip "What can you tell me about this text?"
If everything is configured correctly, you should receive a response from the AI model.
Common Issues
"API key not found" error: Make sure you've exported the OPENAI_API_KEY
environment variable in your current shell session.
"Model not found" error: Check that your configured model is available with your API provider.
Network errors: Verify your OPENAI_BASE_URL
is correct and accessible.
Next Steps
Now that Chat GipiTTY is set up, you're ready to:
- Learn basic usage patterns
- Explore core features like sessions and web search
- Try different subcommands for specialized tasks
Advanced Configuration
For more detailed configuration options, see:
- Environment Variables - Complete list of configuration options
- Custom API Endpoints - Detailed provider setup guides
- Configuration - Advanced configuration management