POST /ask (non-streaming)
Send a chat message and receive the full response in one JSON payload.
Request
Method: POST
Path: /ask
Headers:
Authorization: Bearer <api_key>Content-Type: application/json
Body:
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | The user message. |
history | array | No | Previous messages in the conversation (default: []). |
conversationId | string | No | If provided, continues that conversation. |
Example:
{
"message": "Hello, what can you help me with?",
"history": [],
"conversationId": "abc123"
}
Response
Success (200 OK):
{
"response": [
{ "type": "text", "text": "I can help you with..." }
],
"conversationHistory": [
{ "role": "user", "content": "Hello, what can you help me with?" },
{ "role": "assistant", "content": [...] }
],
"conversationId": "abc123"
}
response: Array of content blocks (e.g.{ type: "text", text: "..." }).conversationHistory: Full conversation including the latest turn.conversationId: Use this in the next request to continue the thread.
cURL example
curl -X POST https://api.nyor.fun/ask \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Hello, what can you help me with?",
"history": []
}'
Errors
- 401 — Invalid or missing API key.
- 403 — Rate limit exceeded.
- 500 — Server error.
See Errors and rate limits for details.