# Create Model Response

Create a response using the OpenAI-compatible Responses API format.

- Source: https://www.unifyllm.com/docs/api-reference/responses/
- Language: en
- Updated: 2026-11-30

## Endpoint

```http
POST https://api.unifyllm.top/v1/responses
```

Use the authentication and headers shown in the request examples. Content-Type: application/json

## Parameters

| Field | Location | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- | --- |
| model | body | string | yes | Model identifier used for this request. | gpt-6.2-astra, gpt-6.2-sol |  |
| input | body | string \| array | yes | Text, message, image, or file input supplied to the model. |  |  |
| instructions | body | string | no | System or developer instructions added to the model context. |  | You are a helpful assistant. |
| max_output_tokens | body | number | no | Maximum number of tokens allowed in the response. |  | 1024 |
| reasoning | body | object | no | Reasoning configuration for supported models. |  |  |
| stream | body | boolean | no | Whether to stream partial results as they become available. |  |  |
| temperature | body | number | no | Sampling temperature used to control response randomness. |  |  |

## Text Input

```json
{
  "model": "gpt-6.2-astra",
  "input": "Tell me a three sentence bedtime story about a unicorn."
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/responses' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-6.2-astra",
  "input": "Tell me a three sentence bedtime story about a unicorn."
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gpt-6.2-astra",
    "input": "Tell me a three sentence bedtime story about a unicorn."
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/responses",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"gpt-6.2-astra\",\n  \"input\": \"Tell me a three sentence bedtime story about a unicorn.\"\n}")
)
response.raise_for_status()
print(response.json())
```

## Image Input

```json
{
  "model": "gpt-6.2-astra",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "what is in this image?"
        },
        {
          "type": "input_image",
          "image_url": "https://example.com/reference-image.jpg"
        }
      ]
    }
  ]
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/responses' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-6.2-astra",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "what is in this image?"
        },
        {
          "type": "input_image",
          "image_url": "https://example.com/reference-image.jpg"
        }
      ]
    }
  ]
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gpt-6.2-astra",
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "what is in this image?"
          },
          {
            "type": "input_image",
            "image_url": "https://example.com/reference-image.jpg"
          }
        ]
      }
    ]
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/responses",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"gpt-6.2-astra\",\n  \"input\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"input_text\",\n          \"text\": \"what is in this image?\"\n        },\n        {\n          \"type\": \"input_image\",\n          \"image_url\": \"https://example.com/reference-image.jpg\"\n        }\n      ]\n    }\n  ]\n}")
)
response.raise_for_status()
print(response.json())
```

## Streaming

```json
{
  "model": "gpt-6.2-astra",
  "instructions": "You are a helpful assistant.",
  "input": "Hello!",
  "stream": true
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/responses' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-6.2-astra",
  "instructions": "You are a helpful assistant.",
  "input": "Hello!",
  "stream": true
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gpt-6.2-astra",
    "instructions": "You are a helpful assistant.",
    "input": "Hello!",
    "stream": true
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/responses",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"gpt-6.2-astra\",\n  \"instructions\": \"You are a helpful assistant.\",\n  \"input\": \"Hello!\",\n  \"stream\": true\n}")
)
response.raise_for_status()
print(response.json())
```

## Function Calling

```json
{
  "model": "gpt-6.2-astra",
  "input": "What is the weather like in Boston today?",
  "tools": [
    {
      "type": "function",
      "name": "get_current_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location",
          "unit"
        ]
      }
    }
  ],
  "tool_choice": "auto"
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/responses' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-6.2-astra",
  "input": "What is the weather like in Boston today?",
  "tools": [
    {
      "type": "function",
      "name": "get_current_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location",
          "unit"
        ]
      }
    }
  ],
  "tool_choice": "auto"
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gpt-6.2-astra",
    "input": "What is the weather like in Boston today?",
    "tools": [
      {
        "type": "function",
        "name": "get_current_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "unit": {
              "type": "string",
              "enum": [
                "celsius",
                "fahrenheit"
              ]
            }
          },
          "required": [
            "location",
            "unit"
          ]
        }
      }
    ],
    "tool_choice": "auto"
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/responses",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"gpt-6.2-astra\",\n  \"input\": \"What is the weather like in Boston today?\",\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"name\": \"get_current_weather\",\n      \"description\": \"Get the current weather in a given location\",\n      \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"location\": {\n            \"type\": \"string\",\n            \"description\": \"The city and state, e.g. San Francisco, CA\"\n          },\n          \"unit\": {\n            \"type\": \"string\",\n            \"enum\": [\n              \"celsius\",\n              \"fahrenheit\"\n            ]\n          }\n        },\n        \"required\": [\n          \"location\",\n          \"unit\"\n        ]\n      }\n    }\n  ],\n  \"tool_choice\": \"auto\"\n}")
)
response.raise_for_status()
print(response.json())
```

## Reasoning

```json
{
  "model": "gpt-6.2-astra",
  "input": "How much wood would a woodchuck chuck?",
  "reasoning": {
    "effort": "high",
    "summary": "detailed"
  }
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/responses' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-6.2-astra",
  "input": "How much wood would a woodchuck chuck?",
  "reasoning": {
    "effort": "high",
    "summary": "detailed"
  }
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gpt-6.2-astra",
    "input": "How much wood would a woodchuck chuck?",
    "reasoning": {
      "effort": "high",
      "summary": "detailed"
    }
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/responses",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"gpt-6.2-astra\",\n  \"input\": \"How much wood would a woodchuck chuck?\",\n  \"reasoning\": {\n    \"effort\": \"high\",\n    \"summary\": \"detailed\"\n  }\n}")
)
response.raise_for_status()
print(response.json())
```

## Response examples

### Default — HTTP 200

```json
{
  "id": "resp_08eee34deb147259016a55e17d834c819a9aff22e251c367b0",
  "object": "response",
  "created_at": 1784013181,
  "status": "completed",
  "background": false,
  "completed_at": 1784013184,
  "error": null,
  "frequency_penalty": 0,
  "incomplete_details": null,
  "instructions": "You are a helpful assistant.",
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-6.2-astra",
  "moderation": null,
  "output": [
    {
      "id": "msg_08eee34deb147259016a55e17e12a8819a8efec3711f7575f4",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "logprobs": [],
          "text": "A gentle unicorn named Luma lived in a moonlit meadow where the flowers glowed softly at night.  \nEach evening, she sprinkled stardust from her silver horn to help lost fireflies find their way home.  \nWhen the sky filled with twinkling lights, Luma curled beneath a velvet tree and dreamed of rainbow clouds."
        }
      ],
      "phase": "final_answer",
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "presence_penalty": 0,
  "previous_response_id": null,
  "prompt_cache_key": "034b1177-b68a-4e30-b3cc-0d4e7f3eec74",
  "prompt_cache_retention": "24h",
  "reasoning": {
    "context": "current_turn",
    "effort": "medium",
    "mode": "standard",
    "summary": null
  },
  "safety_identifier": "user-9f6nlV797bodUQhVEfE26DER",
  "service_tier": "default",
  "store": false,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    },
    "verbosity": "medium"
  },
  "tool_choice": "auto",
  "tool_usage": {
    "image_gen": {
      "input_tokens": 0,
      "input_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      },
      "output_tokens": 0,
      "output_tokens_details": {
        "image_tokens": 0,
        "text_tokens": 0
      },
      "total_tokens": 0
    },
    "web_search": {
      "num_requests": 0
    }
  },
  "tools": [],
  "top_logprobs": 0,
  "top_p": 0.98,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 27,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0
    },
    "output_tokens": 72,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 99
  },
  "user": null,
  "metadata": {}
}
```
