Speed
Output tokens / second
Custom pricing for production workloads
GPT-4.1 is OpenAI's large-context language model with up to 1M token input and improved instruction following.
GPT-4.1 advanced coding-focused AI with million-token context and superior instruction following.
openai/gpt-4.1-2025-04-14https://api.aimlapi.com/v1GPT-4.1 is OpenAI's advanced large language model designed with significant improvements in coding capabilities, instruction following, and long context processing. The model represents a substantial step forward from GPT-4o, offering enhanced performance while maintaining a lower cost profile than GPT-4.5. GPT-4.1 excels particularly in software engineering tasks, with optimizations for real-world developer use cases including frontend coding, cleaner code editing, and precise instruction adherence.
GPT-4.1 processes input contexts of up to 1,047,576 tokens (approximately 750,000 words). The model generates outputs of up to 32,768 tokens in a single response.
All training data for GPT-4.1 extends to May 31, 2024, which serves as its knowledge cutoff date.
GPT-4.1 delivers enhanced frontend coding with significantly fewer unnecessary edits. The model provides improved code refactoring and debugging capabilities for complex software projects. It follows programming best practices with superior accuracy compared to previous models. GPT-4.1 generates optimized diffs through extensive training on recommended formats. The system supports advanced agentic development workflows for autonomous coding tasks. It achieves state-of-the-art performance across standard coding benchmarks, particularly in practical software engineering tasks.
GPT-4.1 processes and reasons over documents containing up to 1 million tokens with maintained coherence. The model effectively retrieves specific information from large corpuses even when relevant data is deeply embedded. It analyzes entire codebases at once, maintaining context across multiple files and functions. GPT-4.1 handles multi-document analysis with improved accuracy for complex research and legal applications. The system is optimized for XML-style delimiters that enhance structure and information retention in long-context inputs.
GPT-4.1 adheres precisely to explicit formatting instructions with higher consistency than previous models. The system handles negative instructions (what not to do) with improved accuracy and reliability. It performs multi-step ordered instructions with enhanced sequential understanding and context retention. GPT-4.1 executes ranking and sorting tasks with greater accuracy based on specified criteria. The model interprets prompts more literally, which provides greater control but requires more explicit instructions from users.
See how GPT-4.1 compares in generation speed and latency. Data retrieved Nov 3, 2026.
Output tokens / second
Compare 17 models available on AI/ML API across 5 independent benchmarks.
Expert-written questions across academic subjects.
Graduate-level science questions written to resist web search.
Reasoning across long documents of about 100k tokens.
Following precise instructions about the shape of the answer.
Customer support agent tasks with tool calls.
| Usage | Price | Unit |
|---|---|---|
| Input | $2 | 1M tokens |
| Output | $8 | 1M tokens |
| Cached input | $0.5 | 1M tokens |
Prices from the AI/ML API price list, checked on Nov 4, 2026.
AI/ML API input and output rates for 5 models, per million tokens.
| Model | Input | Output |
|---|---|---|
| $2 | $8 | |
| $0.1 | $0.5 | |
| $1 | $5 | |
| $2 | $10 | |
| $2.12 | $10.58 |
Give your agent the model details, code and documentation.
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"curl 'https://api.aimlapi.com/v1/chat/completions' \
-H "Authorization: Bearer $AIMLAPI_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "openai/gpt-4.1-2025-04-14",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}'import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['AIMLAPI_KEY']}",
"Content-Type": "application/json",
}
payload = {
"model": "openai/gpt-4.1-2025-04-14",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}
response = requests.post("https://api.aimlapi.com/v1/chat/completions", headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.aimlapi.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "openai/gpt-4.1-2025-04-14",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());GPT-4.1 has a 1,047,576 tokens context window and can return up to 32,768 tokens.
GPT-4.1 takes image, text as input and returns text.
Use openai/gpt-4.1-2025-04-14 as the model id. Requests go to https://api.aimlapi.com/v1/chat/completions.
GPT-4.1 became available on August 7, 2025.
GPT-4.1 costs $2 input and $8 output per 1M tokens on AI/ML API, billed as you go with no subscription.
Yes, GPT-4.1 can stream responses as they are generated.
Yes, GPT-4.1 accepts image input alongside text.
GPT-4.1 was built by OpenAI.