OpenAI Provider
The OpenAI provider gives you access to OpenAI’s latest language models, including the GPT-4o series and advanced reasoning models like o1 and o3.Configuration
API Key Setup
Set your OpenAI API key in your.env file:
config/llm-magic.php:
Available Models
LLM Magic supports the following OpenAI models:Reasoning Models
- o1 - Advanced reasoning model
- o1-pro - Professional tier reasoning model
- o3-mini - Compact o3 model
- o3 - Latest reasoning model
- o4-mini - Compact o4 model
GPT-4 Series
- gpt-4-turbo - GPT-4 Turbo
- gpt-4o - GPT-4 Optimized
- gpt-4o-mini - Compact GPT-4o model
Usage
Using the Constructor
Create an OpenAI model instance with any model name:Using Static Factory Methods
LLM Magic provides convenient static methods for common models:Getting Available Models
Retrieve a list of all available OpenAI models:Model Costs
OpenAI models include built-in cost tracking. The following pricing is configured (per 1,000 tokens):| Model | Input Cost | Output Cost |
|---|---|---|
| o1 | $0.015 | $0.075 |
| o1-pro | $0.003 | $0.015 |
| o3-mini | $0.0008 | $0.004 |
| o3 | $0.0008 | $0.004 |
| o4-mini | $0.0008 | $0.004 |
| gpt-4-turbo | $0.0008 | $0.004 |
| gpt-4o | $0.0008 | $0.004 |
| gpt-4o-mini | $0.0008 | $0.004 |
Organization Info
The OpenAI provider includes organization metadata:- ID:
openai - Name: OpenAI
- Website: https://openai.com
- Privacy: Data may be used for model training and abuse prevention
Advanced Options
You can pass additional options usingChatGptOptions: