POST
javascript
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); } })();
RESPONSE
application/json
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


messagesArray

An array of objects containing the role and content


rolestr

Could be "user", "assistant" or "system".


contentstr

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 — Text & Multimodal Language Model

What is GPT-5.4 Mini?

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.

Key Features

  • 400K token context window with up to 128,000 tokens of output
  • Multimodal inputs: accepts both text and images, outputs text
  • Near-flagship benchmarks: 54.4% on SWE-Bench Pro (vs. 57.7% for GPT-5.4), 72.1% on OSWorld-Verified (above the human baseline of 72.4%)
  • 2x faster than GPT-5 Mini at comparable accuracy levels
  • Full tool support: function calling, structured outputs, file search, code interpreter, web search, and computer use
  • Fine-tuning via distillation — customize the model with your own labeled data

Best Use Cases

GPT-5.4 Mini delivers exceptional value in latency-sensitive, high-throughput environments:

  • Coding assistants: targeted code edits, codebase navigation, front-end generation, and debugging loops with fast turnaround
  • Computer use automation: rapidly interprets dense UI screenshots to drive browser and desktop workflows
  • Subagent pipelines: handles parallel, narrowly-scoped subtasks delegated by a larger GPT-5.4 orchestrator — reducing cost without sacrificing quality
  • Multimodal reasoning: real-time image understanding for document analysis, visual Q&A, and UI-driven applications
  • Batch API workloads: cost-efficient at scale for classification, summarization, and structured data extraction

Prompt Tips and Output Quality

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.

FAQs

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.