Files
ironclaw/docs/drafts/providers/openai.mdx
2026-04-09 14:18:30 +02:00

89 lines
1.6 KiB
Plaintext

---
title: OpenAI
sidebarTitle: OpenAI
description: GPT models via OpenAI API
---
Use OpenAI's GPT models directly via their API.
## Configuration
```bash
# ~/.ironclaw/.env
LLM_BACKEND=openai
OPENAI_API_KEY=sk-...
```
## Getting an API Key
1. Visit https://platform.openai.com
2. Create an account
3. Generate an API key
4. Add billing information
5. Copy the key (starts with `sk-`)
## Available Models
| Model | Context | Best For |
|-------|---------|----------|
| `gpt-4o` | 128K | Complex tasks, reasoning |
| `gpt-4o-mini` | 128K | Cost-effective, fast |
| `o3-mini` | 128K | Reasoning tasks |
## Setup
### Via Wizard
```bash
ironclaw onboard
```
1. Step 3: Select "OpenAI"
2. Enter your API key
3. Step 4: Select a model
### Manual Configuration
```bash
# Edit ~/.ironclaw/.env
export LLM_BACKEND=openai
export OPENAI_API_KEY=sk-...
# Optional: custom base URL
export OPENAI_BASE_URL=https://api.openai.com/v1
```
Restart IronClaw:
```bash
ironclaw run
```
## Cost
Approximate pricing (per 1K tokens):
| Model | Input | Output |
|-------|-------|--------|
| GPT-4o | $2.50 | $10.00 |
| GPT-4o-mini | $0.15 | $0.60 |
| o3-mini | $1.10 | $4.40 |
See [OpenAI pricing](https://openai.com/pricing) for current rates.
## Troubleshooting
<AccordionGroup>
<Accordion title="Insufficient quota" icon="alert">
- Add billing information to OpenAI account
- Check your spending limit
- Verify you have available credits
</Accordion>
<Accordion title="Rate limit exceeded" icon="clock">
- OpenAI has tier-based rate limits
- Implement exponential backoff
- Consider using a different model tier
</Accordion>
</AccordionGroup>