Skip to main content

Request

curl --location 'https://api.znapai.com/v1/responses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ZnapAI_API_KEY' \
--data '{
    "model": "gpt-5-mini",
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "Introduce artificial intelligence"
          }
        ]
      }
    ]
  }'

Response

{
  "id": "resp_01J8Y...",
  "object": "response",
  "created_at": 1741451370,
  "model": "gpt-5-mini",
  "status": "completed",
  "output": [
    {
      "id": "msg_01J8Y...",
      "role": "assistant",
      "status": "completed",
      "type": "message",
      "content": [
        {
          "type": "output_text",
          "text": "Artificial intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans. These machines can perform tasks such as learning, reasoning, problem-solving, perception, and language understanding."
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 45,
    "total_tokens": 57
  }
}

Parameters

model
string
required
Name of the model to use (for example: gpt-5-mini). To see the complete list of supported models, visit: https://znapai.com/models/chat
input
string | array
required
The user input. Can be a plain string for simple text prompts, or an array of message objects for multimodal and multi-turn conversations.
temperature
number
Controls output randomness between 0 and 2. Lower values (like 0.2) make the output more deterministic, higher values (like 1.8) make it more creative.Default: 1.0
max_tokens
integer
The maximum number of tokens to generate. Different models have different maximum limits.
stream
boolean
Whether to stream the response as it is generated (SSE format).Default: false
top_p
number
Controls diversity via nucleus sampling (range 0 to 1). Recommended to set either temperature or top_p, but not both.Default: 1.0
reasoning
object
Controls reasoning effort for supported models (e.g. gemini-2.5-flash, o3).
tools
array
A list of tools available for the model to extend its capabilities.

Usage examples

PDF / File understanding

Upload or reference a document and ask questions about it.
{
  "model": "gpt-4.1",
  "input": [{
    "role": "user",
    "content": [
      {
        "type": "input_file",
        "file_url": "https://example.com/report.pdf"
      },
      {
        "type": "input_text",
        "text": "Summarize this document"
      }
    ]
  }]
}

Advanced reasoning

Use higher reasoning effort for complex tasks.
{
  "model": "gemini-2.5-flash",
  "reasoning": {"effort": "high"},
  "input": "Design a scalable architecture for a multi-tenant CRM SaaS."
}

Function calling

Allow the model to invoke custom functions.
{
  "model": "gpt-5-mini",
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get weather for a city",
      "parameters": {
        "type": "object",
        "properties": {
          "city": {"type": "string"}
        },
        "required": ["city"]
      }
    }
  ],
  "input": "What is the weather in Delhi?"
}
Enable live web search capabilities.
{
  "model": "gpt-5-mini",
  "tools": [{"type": "web_search_preview"}],
  "input": "What are the latest AI announcements this week?"
}

Image understanding

Analyze images and answer questions about them.
{
  "model": "gpt-5-mini",
  "input": [{
    "role": "user",
    "content": [
      {
        "type": "input_text",
        "text": "Describe this image"
      },
      {
        "type": "input_image",
        "image_url": "https://example.com/image.jpg"
      }
    ]
  }]
}

Params to Avoid

ParamReason
messagesThe Responses API uses input instead of messages. Sending messages will result in an error.
response_formatUse structured outputs parameters defined for the Responses API instead of the standard response_format.
nGenerating multiple choices is not supported by the Responses API.
stream_optionsNot supported by this endpoint.
presence_penaltyNot supported by this endpoint.
frequency_penaltyNot supported by this endpoint.
logit_biasNot supported by this endpoint.
logprobsNot supported by this endpoint.
top_logprobsNot supported by this endpoint.
seedNot supported by this endpoint.