Create a text response
Use the ShareAI Responses API for stateless text generation, explicit conversation history and Responses streaming events.
On this page
https://api.shareai.now/api/v1/responsesGenerate a text response from a prompt or conversation.
- Base URL
https://api.shareai.now- Authentication
- Bearer API key or approved OAuth access token
Choose this API when your application uses the Responses text-message format. Supply the conversation on every request; responses are not stored for later retrieval.
Send a request#
cURL
curl --fail-with-body --request POST \
"https://api.shareai.now/api/v1/responses" \
-H "Authorization: Bearer $SHAREAI_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "YOUR_CHAT_MODEL",
"input": "Explain semantic search in two sentences.",
"instructions": "Use plain language.",
"store": false,
"stream": false
}'
Python
import json
import os
import urllib.request
headers = {"Authorization": "Bearer " + os.environ["SHAREAI_API_KEY"]}
headers["Content-Type"] = "application/json"
payload = {'model': 'YOUR_CHAT_MODEL', 'input': 'Explain semantic search in two sentences.', 'instructions': 'Use plain language.', 'store': False, 'stream': False}
data = json.dumps(payload).encode()
request = urllib.request.Request('https://api.shareai.now/api/v1/responses', data=data, headers=headers, method='POST')
with urllib.request.urlopen(request, timeout=60) as response:
print(json.load(response))
TypeScript
const url = "https://api.shareai.now/api/v1/responses";
const headers: Record = {
Authorization: `Bearer ${process.env.SHAREAI_API_KEY}`,
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "YOUR_CHAT_MODEL",
"input": "Explain semantic search in two sentences.",
"instructions": "Use plain language.",
"store": false,
"stream": false
};
const response = await fetch(url, { method: "POST", headers, body: JSON.stringify(payload) });
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
console.log(await response.json());
Request fields#
| Field | Value |
|---|---|
model | An available chat model allowed by your credential. |
input | A nonempty string, or up to 256 text messages. |
instructions | Optional system instructions prepended to the conversation. |
store | false; storing responses is unsupported. |
stream | false for JSON or true for Responses SSE events. |
Continue a conversation#
Send earlier messages in input alongside the next user message. Supported roles are user, assistant, system and developer. Developer instructions use the system role internally. Message content can be text or input_text/output_text parts.
JSON
{
"model": "YOUR_CHAT_MODEL",
"input": [
{
"role": "user",
"content": "What is semantic search?"
},
{
"role": "assistant",
"content": "It finds results by meaning rather than exact words."
},
{
"role": "user",
"content": "Give one example."
}
],
"store": false
}
Read the result#
The JSON response is a response object. Read the assistant text from output[].content[] entries with type output_text. Check the response status: completed is a finished response; incomplete can indicate a token limit. Public usage is currently null; use Console Usage to inspect processed usage.
Stream a response#
Set stream: true and parse SSE. Events include response.created, response.output_text.delta and a terminal response.completed, response.incomplete or response.failed. Append text deltas in order and handle the terminal status explicitly.
Supported subset#
This endpoint supports text generation. Stored responses, previous_response_id, retrieval/deletion, tools, image input, background requests and generation settings such as temperature are unsupported and rejected. For message-based generation settings supported by Chat Completions, use Chat Completions.
Use an OAuth access token#
Replace the API key in the Authorization header with an approved OAuth access token. The surcharge scope and accepted usage plan are required for account-funded inference. Identity-only scopes do not authorize spending. See scopes and permissions.
Last updated September 15, 2026