AI Model Providers
OpenAI
Connect directly to OpenAI's API for access to GPT-4o, GPT-4 Turbo, and o1 reasoning models. The industry standard for AI-powered code assistance.
Quick answer
What is the Autohand OpenAI integration?
The Autohand OpenAI integration connects the coding agent directly to an OpenAI API account. It uses an OpenAI API key and a model identifier available to that account through the standard provider configuration.
- Status
- Available
- Requires
- An OpenAI API key, account billing, and access to the selected model.
- Configure with
- Set
OPENAI_API_KEY, select theopenaiprovider, and choose a model ID currently available to the account. - Best for
- Direct use of models exposed by an OpenAI API account.
Know before you start: Model names, access tiers, quotas, prices, and supported features can change; confirm them in the OpenAI account before deployment.
Overview
OpenAI provides some of the most capable AI models available. When integrated with Autohand, you get:
- Access to GPT-4o, GPT-4 Turbo, and o1 reasoning models
- Direct API connection for lowest latency
- Vision capabilities for image understanding
- Function calling for structured outputs
- Reliable infrastructure with high uptime
Alternative: If you want access to OpenAI models along with other providers, consider using OpenRouter which provides a unified API for multiple model providers.
Setup
Get started with OpenAI in a few steps.
Get your API key
- Go to platform.openai.com and sign in
- Navigate to API Keys in your account settings
- Click Create new secret key and copy it
Configure Autohand
# Set environment variable (recommended)
export OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxx"
# Or configure via CLI
autohand config set openai.apiKey "sk-xxxxxxxxxxxxxxxxxxxx"
Verify your configuration:
# Start with OpenAI provider
autohand --provider openai --model gpt-4o
# Test with a prompt
autohand --prompt "Hello, which model are you?"
CLI configuration
Configure OpenAI in your ~/.autohand/config.json:
{
"provider": "openai",
"openai": {
"apiKey": "${OPENAI_API_KEY}",
"model": "gpt-4o",
"maxTokens": 4096,
"temperature": 0.7,
"organization": "org-xxxxx"
}
}
Configuration options
| Option | Description | Default |
|---|---|---|
apiKey | Your OpenAI API key | - |
model | Model to use | gpt-4o |
maxTokens | Maximum tokens in response | 4096 |
temperature | Response randomness (0-2) | 0.7 |
organization | OpenAI organization ID | - |
baseUrl | Custom API endpoint | https://api.openai.com/v1 |
Available models
OpenAI offers several model tiers optimized for different tasks.
GPT-4o series
| Model | Context | Best for |
|---|---|---|
gpt-4o | 128K | Most capable, multimodal |
gpt-4o-mini | 128K | Fast and cost-effective |
GPT-4 Turbo
| Model | Context | Best for |
|---|---|---|
gpt-4-turbo | 128K | Complex reasoning |
gpt-4-turbo-preview | 128K | Latest features |
o1 reasoning models
| Model | Context | Best for |
|---|---|---|
o1 | 200K | Advanced reasoning, complex problems |
o1-mini | 128K | Fast reasoning tasks |
Switch models
# Set default model
autohand config set model "gpt-4o"
# Use a specific model for one session
autohand --model "o1"
# Switch during a session
/model openai/gpt-4o-mini
Best practices
- Use environment variables: Never commit API keys to version control.
- Choose the right model: Use gpt-4o for most tasks, o1 for complex reasoning.
- Monitor usage: Check your OpenAI dashboard for usage and costs.
- Set spending limits: Configure usage limits in OpenAI dashboard.
Recommended configurations
General coding
{
"openai": {
"model": "gpt-4o",
"temperature": 0.3,
"maxTokens": 4096
}
}
Complex reasoning
{
"openai": {
"model": "o1",
"maxTokens": 8192
}
}
Resources
Troubleshooting
Common issues
| Issue | Solution |
|---|---|
| Invalid API key | Verify key at platform.openai.com |
| Rate limited | Wait or upgrade your plan |
| Context too long | Reduce input or use a model with larger context |
| Model not available | Check model access in your OpenAI account |
Debug mode
# Enable verbose logging
AUTOHAND_DEBUG=true autohand --provider openai
# Check API status
curl https://status.openai.com/api/v2/status.json
Common questions
OpenAI integration FAQ
How do I configure the Autohand OpenAI integration?
Set OPENAI_API_KEY, select the openai provider, and choose a model ID currently available to the account.
What does the Autohand OpenAI integration require?
An OpenAI API key, account billing, and access to the selected model.
What limitations should I know about?
Model names, access tiers, quotas, prices, and supported features can change; confirm them in the OpenAI account before deployment.