Pricing Guides2 دقيقة قراءة
OpenAI GPT-4o API Pricing Guide 2026
GPT-4o API Pricing Overview
GPT-4o is OpenAI's flagship multimodal model. Here's the complete pricing breakdown.
Current Pricing
| Model | Input (1M tokens) | Output (1M tokens) | |---|---|---| | gpt-4o | $2.50 | $10.00 | | gpt-4o-mini | $0.15 | $0.60 | | gpt-4-turbo | $10.00 | $30.00 | | o3-mini | $1.10 | $4.40 | | o1 | $15.00 | $60.00 |
Cost Calculator Example
# Calculate GPT-4o API cost for your usage
input_tokens = 1000000 # 1M input tokens
output_tokens = 500000 # 500K output tokens
input_cost = (input_tokens / 1000000) * 2.50
output_cost = (output_tokens / 1000000) * 10.00
total = input_cost + output_cost
print(f"Total cost: ${total:.2f}")
# Total cost: $7.50
How to Access GPT-4o via AI API Hub
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://api.apiyihe.org/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}]
)
When to Use Which Model
- gpt-4o: Complex reasoning, coding, multimodal tasks
- gpt-4o-mini: Lightweight tasks, cost-sensitive applications
- o3-mini: Math and science reasoning at lower cost
- o1: Hardest problems requiring deep reasoning
Saving Tips
- Use gpt-4o-mini for 80% of tasks, gpt-4o for the critical 20%
- Batch multiple prompts into single requests
- Cache common responses to avoid redundant API calls