1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const axios = require('axios');
const fs = require('fs');
const path = require('path');
// helper function to help you convert your local images into base64 format
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/gpt-5.4-mini";
const data = {
"messages": [
{
"role": "user",
"content" : "tell me a joke on cats"
},
{
"role": "assistant",
"content" : "here is a joke about cats..."
},
{
"role": "user",
"content" : "now a joke on dogs"
},
]
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();An array of objects containing the role and content
Could be "user", "assistant" or "system".
A string containing the user's query or the assistant's response.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
GPT-5.4 Mini is OpenAI's most capable small model, released on March 17, 2026 as part of the GPT-5.4 family. Engineered for speed and cost-efficiency, it approaches flagship GPT-5.4 performance while running over 2x faster — making it the go-to model for production AI systems where latency directly shapes product experience.
With a 400,000-token context window, multimodal inputs (text and images), and native support for OpenAI's full tool suite — including function calling, code interpreter, web search, and computer use — GPT-5.4 Mini is purpose-built for high-volume agentic workflows, coding pipelines, and real-time automation. Pricing starts at $0.75/M input tokens and $4.50/M output tokens, a fraction of the flagship cost.
GPT-5.4 Mini delivers exceptional value in latency-sensitive, high-throughput environments:
For coding tasks, include the programming language, relevant code context, and the specific change needed. The model handles long-context inputs well — use the full context window for multi-file codebases. For computer use and UI automation, attach a high-resolution screenshot and describe the target action precisely.
In agentic workflows, keep each subtask prompt narrow and bounded — GPT-5.4 Mini excels when given clear, focused objectives rather than broad open-ended requests. Use system prompts to define agent roles explicitly, and structured output formats to enforce consistent responses at scale.
Is GPT-5.4 Mini better than GPT-4o Mini? Significantly so. GPT-5.4 Mini runs over 2x faster than GPT-5 Mini and approaches GPT-5.4 flagship performance on coding and computer use benchmarks — a generational leap over GPT-4o Mini.
Can GPT-5.4 Mini analyze images? Yes. It accepts both text and image inputs, making it effective for UI analysis, visual Q&A, and screenshot-driven automation tasks.
Is it good for agentic and subagent workflows? Absolutely — it was designed for subagent delegation, handling narrower parallel tasks quickly and cost-efficiently within larger multi-agent systems.
What is the context window size? 400,000 input tokens with up to 128,000 output tokens — large enough for multi-file codebases and complex multi-turn agent conversations.
How does pricing compare to GPT-5.4? Input is $0.75/M tokens and output is $4.50/M tokens — significantly cheaper than the flagship while delivering near-equivalent performance on most developer tasks.
When should I use GPT-5.4 instead of GPT-5.4 Mini? Choose GPT-5.4 for tasks requiring maximum reasoning depth, nuanced long-form writing, or the highest accuracy on complex evaluations where cost is a secondary concern.