Why OpenAI?
- High quality - Industry-leading models with excellent code understanding
- Reliable - Stable API with consistent performance
- Fast - GPT-4o-mini provides quick analysis with good quality
- Well-documented - Extensive documentation and community support
OpenAI is a paid service. You’ll need to add credits to your account to use their API.
Get an API key
Create an account
Visit platform.openai.com and sign up.
Add billing
Navigate to Billing and add payment information.
Create an API key
Go to API Keys and create a new key.
Setup
Option 1: Environment variable (recommended)
Set the environment variable in your shell:Option 2: .env file
Create a.env file in your project directory:
.env
Option 3: Configuration file
Create avibrant.config.js file:
vibrant.config.js
Usage
Run Vibrant with OpenAI:Available models
Vibrant uses gpt-4o-mini by default for the best balance of cost and quality.gpt-4o-mini (default)
gpt-4o-mini (default)
- Context: 128k tokens
- Cost: ~0.60 per 1M output tokens
- Speed: Very fast
- Quality: Excellent for code analysis
- Best for: Daily development, CI/CD pipelines
gpt-4o
gpt-4o
- Context: 128k tokens
- Cost: ~10 per 1M output tokens
- Speed: Fast
- Quality: Industry-leading
- Best for: Critical analysis, complex codebases
gpt-4-turbo
gpt-4-turbo
- Context: 128k tokens
- Cost: ~30 per 1M output tokens
- Speed: Medium
- Quality: Excellent reasoning
- Best for: Complex architectural analysis
Change the model
Set theOPENAI_MODEL environment variable:
.env file:
.env
Pricing
Typical costs for analyzing a medium-sized project (100 files):| Model | Input Cost | Output Cost | Typical Total |
|---|---|---|---|
| gpt-4o-mini | ~$0.002 | ~$0.005 | ~$0.01 per analysis |
| gpt-4o | ~$0.04 | ~$0.08 | ~$0.15 per analysis |
| gpt-4-turbo | ~$0.15 | ~$0.25 | ~$0.50 per analysis |
Vibrant’s Smart Summarizer reduces token usage by 50-60%, cutting your API costs in half.
Example output
Troubleshooting
Error: API key not found
OPENAI_API_KEY environment variable:
Error: Insufficient credits
Error: Rate limit exceeded
Best practices
Start with gpt-4o-mini
Use the default model for daily development. It provides excellent quality at low cost.
Use gpt-4o for critical analysis
When analyzing production code or complex issues, upgrade to gpt-4o for the best results.
Monitor your usage
Check your usage dashboard regularly to track costs.
CI/CD integration
For GitHub Actions:.github/workflows/code-quality.yml
Add
OPENAI_API_KEY as a secret in your repository settings.Next steps
AI providers overview
Compare all available providers
Configuration
Customize Vibrant’s behavior