Skip to Content
API ReferenceResponsesCreate Responses

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.

字段类型必填说明
inputstring or list of objectsInput for a response request - can be a string or array of items
instructionsstring or null-
metadatamap from strings to stringsMetadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
toolslist of objects-
tool_choiceenum or object-
parallel_tool_callsboolean or null-
modelstring-
modelslist of strings-
textobjectText output configuration including format and verbosity
reasoningobjectConfiguration for reasoning mode in the response
max_output_tokensdouble or null-
temperaturedouble or null0-2
top_pdouble or null>=0
top_logprobsinteger or null0-20
max_tool_callsinteger or null-
presence_penaltydouble or null-2-2
frequency_penaltydouble or null-2-2
top_kdouble-
image_configmap from strings to strings or doublesProvider-specific image configuration options. Keys and values vary by model/provider. See https://novapai.ai/docs/features/multimodal/image-generation  for more details.
modalitieslist of enumsOutput modalities for the response. Supported values are “text” and “image”. Allowed values:text image
prompt_cache_keystring or null-
previous_response_idstring or null-
promptobject-
includelist of enums or nullAllowed values:file_search_call.results message.input_image.image_url computer_call_output.output.image_url reasoning.encrypted_content code_interpreter_call.outputs
backgroundboolean or null-
safety_identifierstring or null-
storefalse-
service_tierenumDefaults to auto Allowed values:auto
truncationobject-
streambooleanDefaults to false
providerobject or nullWhen multiple model providers are available, optionally indicate your routing preference.
pluginslist of objectsPlugins you want to enable for this request, including their settings.
userstring<=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_idstring<=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.
traceobjectMetadata 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_atdouble or null--
created_atdouble--
errorobject-Error information returned from the API
frequency_penaltydouble or null--
idstring--
incomplete_detailsobject--
instructionsstring or list of objects or any--
metadatamap 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.
modelstring--
objectenum-Allowed values:response
parallel_tool_callsboolean--
presence_penaltydouble or null--
statusenum--
temperaturedouble or null--
tool_choiceenum or object--
toolslist of objects--
top_pdouble or null--
backgroundboolean or null--
max_output_tokensdouble or null--
max_tool_callsdouble or null--
outputlist of objects--
output_textstring--
previous_response_idstring or null--
promptobject--
prompt_cache_keystring or null--
reasoningobject--
safety_identifierstring or null--
service_tierenum-Allowed values:auto default flex priority scale
storeboolean--
textobject-Text output configuration including format and verbosity
top_logprobsdouble--
truncationenum-Allowed values:auto disabled
usageobject-Token usage information for the response
userstring or null--

Errors

状态码说明
400Bad Request Error
401Unauthorized Error
402Payment Required Error
404Not Found Error
408Request Timeout Error
413Content Too Large Error
422Unprocessable Entity Error
429Too Many Requests Error
500Internal Server Error
502Bad Gateway Error
503Service Unavailable Error