Create a response
POST
https://novapai.ai/api/v1/responses
POST
/api/v1/responses
Python
reference-responses-create-responses-01.py
import requests
url = "https://novapai.ai/api/v1/responses"
payload = {
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
],
"tools": [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": { "location": { "type": "string" } }
}
}
],
"model": "anthropic/claude-4.5-sonnet-20250929",
"temperature": 0.7,
"top_p": 0.9
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```json showLineNumbers filename="reference-responses-create-responses-02.json"
<div className="endpoint-status-chip">200 Successful</div>
```json showLineNumbers filename="reference-responses-create-responses-03.json"
{
"completed_at": 1.1,
"created_at": 1704067200,
"frequency_penalty": 1.1,
"id": "resp-abc123",
"instructions": "string",
"model": "gpt-4",
"object": "response",
"parallel_tool_calls": true,
"presence_penalty": 1.1,
"status": "completed",
"tool_choice": "auto",
"tools": [],
"output": [
{
"id": "msg-abc123",
"role": "assistant",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! How can I help you today?",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 10,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 25,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 35
}
}Creates a streaming or non-streaming response using OpenResponses API format
Authentication
Authorization Bearer
API key as bearer token in Authorization header
Request
This endpoint expects an object.
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| input | string or list of objects | 否 | Input for a response request - can be a string or array of items |
| instructions | string or null | 否 | - |
| metadata | map from strings to strings | 否 | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. |
| tools | list of objects | 否 | - |
| tool_choice | enum or object | 否 | - |
| parallel_tool_calls | boolean or null | 否 | - |
| model | string | 否 | - |
| models | list of strings | 否 | - |
| text | object | 否 | Text output configuration including format and verbosity |
| reasoning | object | 否 | Configuration for reasoning mode in the response |
| max_output_tokens | double or null | 否 | - |
| temperature | double or null | 否 | 0-2 |
| top_p | double or null | 否 | >=0 |
| top_logprobs | integer or null | 否 | 0-20 |
| max_tool_calls | integer or null | 否 | - |
| presence_penalty | double or null | 否 | -2-2 |
| frequency_penalty | double or null | 否 | -2-2 |
| top_k | double | 否 | - |
| image_config | map from strings to strings or doubles | 否 | Provider-specific image configuration options. Keys and values vary by model/provider. See https://novapai.ai/docs/features/multimodal/image-generation for more details. |
| modalities | list of enums | 否 | Output modalities for the response. Supported values are “text” and “image”. Allowed values:text image |
| prompt_cache_key | string or null | 否 | - |
| previous_response_id | string or null | 否 | - |
| prompt | object | 否 | - |
| include | list of enums or null | 否 | Allowed values:file_search_call.results message.input_image.image_url computer_call_output.output.image_url reasoning.encrypted_content code_interpreter_call.outputs |
| background | boolean or null | 否 | - |
| safety_identifier | string or null | 否 | - |
| store | false | 否 | - |
| service_tier | enum | 否 | Defaults to auto Allowed values:auto |
| truncation | object | 否 | - |
| stream | boolean | 否 | Defaults to false |
| provider | object or null | 否 | When multiple model providers are available, optionally indicate your routing preference. |
| plugins | list of objects | 否 | Plugins you want to enable for this request, including their settings. |
| user | string | 否 | <=128 characters A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. |
| session_id | string | 否 | <=128 characters A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. |
| trace | object | 否 | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. |
Response
Successful response
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| completed_at | double or null | - | - |
| created_at | double | - | - |
| error | object | - | Error information returned from the API |
| frequency_penalty | double or null | - | - |
| id | string | - | - |
| incomplete_details | object | - | - |
| instructions | string or list of objects or any | - | - |
| metadata | map from strings to strings | - | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. |
| model | string | - | - |
| object | enum | - | Allowed values:response |
| parallel_tool_calls | boolean | - | - |
| presence_penalty | double or null | - | - |
| status | enum | - | - |
| temperature | double or null | - | - |
| tool_choice | enum or object | - | - |
| tools | list of objects | - | - |
| top_p | double or null | - | - |
| background | boolean or null | - | - |
| max_output_tokens | double or null | - | - |
| max_tool_calls | double or null | - | - |
| output | list of objects | - | - |
| output_text | string | - | - |
| previous_response_id | string or null | - | - |
| prompt | object | - | - |
| prompt_cache_key | string or null | - | - |
| reasoning | object | - | - |
| safety_identifier | string or null | - | - |
| service_tier | enum | - | Allowed values:auto default flex priority scale |
| store | boolean | - | - |
| text | object | - | Text output configuration including format and verbosity |
| top_logprobs | double | - | - |
| truncation | enum | - | Allowed values:auto disabled |
| usage | object | - | Token usage information for the response |
| user | string or null | - | - |
Errors
| 状态码 | 说明 |
|---|---|
| 400 | Bad Request Error |
| 401 | Unauthorized Error |
| 402 | Payment Required Error |
| 404 | Not Found Error |
| 408 | Request Timeout Error |
| 413 | Content Too Large Error |
| 422 | Unprocessable Entity Error |
| 429 | Too Many Requests Error |
| 500 | Internal Server Error |
| 502 | Bad Gateway Error |
| 503 | Service Unavailable Error |