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/o4-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.

OpenAI o4-mini – Generative Pre-trained Transformer

What is OpenAI o4-mini?

OpenAI o4-mini is a generative pre-trained transformer (GPT) and reasoning large language model launched in April 2025. Designed for advanced natural language understanding and multi-modal capabilities, o4-mini processes both text and images to deliver accurate, context-rich outputs. Whether you’re analyzing whiteboard sketches or parsing compliance documents, its built-in chain-of-thought reasoning helps surface clear, step-by-step insights. Available to all ChatGPT users, o4-mini boosts decision-making in sectors from healthcare to finance. For mission-critical applications, the premium o4-mini-high variant offers enhanced accuracy and faster response times.

Key Features

  • Multi-Modal Input
    – Accepts rich text prompts and image files for visual understanding.
  • Chain-of-Thought Reasoning
    – Reveals intermediate steps in its reasoning process for transparent outputs.
  • Advanced Natural Language Generation
    – Produces coherent, human-like text for summaries, reports, and creative content.
  • Domain-Specific Analysis
    – Excels at demand forecasting, infrastructure risk assessments, and healthcare data interpretation.
  • Automated Document Compliance
    – Scans contracts, financial statements, and regulatory filings for anomalies and compliance flags.
  • Seamless API Integration
    – Plug into ChatGPT or any RESTful API environment to embed o4-mini in your workflows.

Best Use Cases

  • Demand Forecasting
    Leverage historical data to predict sales trends and inventory requirements.
  • Infrastructure Analysis
    Assess engineering schematics, blueprints, or whiteboard snapshots for potential design issues.
  • Healthcare Data Interpretation
    Summarize patient records, extract critical insights, and support clinical decision-making.
  • Financial Compliance
    Automate the review of regulatory filings to flag missing disclosures or suspicious activity.
  • Creative Content & Chat Assistants
    Generate marketing copy, storyboards, or smart customer support bots that reason through user queries.

Prompt Tips and Output Quality

  • Use Descriptive Prompts
    Longer, detail-rich prompts yield comprehensive analyses.
  • Trigger Chain-of-Thought
    Phrases like “Explain your reasoning” prompt step-by-step breakdowns.
  • Image Parameter
    Upload diagrams or photos via the image field for visual-context tasks.
  • Adjust Prompt Length
    Short prompts for quick answers; extended prompts for in-depth reports.
  • Review & Refine
    Iterate on outputs—tune prompts for tone, length, and focus to optimize quality.

FAQs

Q: Can o4-mini analyze images?
A: Yes. Use the optional image parameter to feed sketches, diagrams, or photos into the model.

Q: What is chain-of-thought reasoning?
A: It’s the model’s ability to articulate intermediate steps, helping you understand how it arrives at conclusions.

Q: How do I access o4-mini?
A: OpenAI o4-mini is available to all ChatGPT users via the API or web interface.

Q: What’s the difference between o4-mini and o4-mini-high?
A: o4-mini-high offers improved accuracy and lower latency for time-sensitive or high-stakes applications.

Q: Which industries benefit most from o4-mini?
A: Finance, healthcare, manufacturing, logistics, and any field requiring a blend of generative AI and structured reasoning.