Misar IO Docs

AI Tools

AI-powered writing tools — title suggestions and streaming research via the MisarBlog API.

AI Tools

Generate Title Suggestions

POST /ai/titles

Returns AI-generated title options based on your article topic or outline.

Request Body

{
  "topic": "How to build a real-time chat app with Next.js and WebSockets",
  "tone": "technical",
  "count": 5
}

| Field | Type | Required | Description | |-------|------|----------|-------------| | topic | string | Yes | Topic, keywords, or a brief outline (max 500 chars) | | tone | string | No | technical | conversational | clickbait (default: conversational) | | count | integer | No | Number of suggestions (1–10, default: 5) |

Response

200 OK

{
  "titles": [
    "Building Real-Time Chat with Next.js 15 and WebSockets",
    "WebSockets in Next.js: A Complete Guide to Real-Time Apps",
    "How to Add Live Chat to Any Next.js App in Under an Hour",
    "Next.js + WebSockets: From Zero to Production",
    "Real-Time Communication in Next.js — The Practical Guide"
  ]
}

AI Research (Streaming)

POST /ai/research

Streams AI-generated research on a topic using Server-Sent Events (SSE). Returns sourced insights, key points, and draft outlines.

Request Body

{
  "topic": "Impact of large language models on software development productivity",
  "depth": "detailed"
}

| Field | Type | Required | Description | |-------|------|----------|-------------| | topic | string | Yes | Research topic (max 500 chars) | | depth | string | No | brief | detailed | comprehensive (default: detailed) |

Response

The endpoint streams text/event-stream. Each event contains a partial chunk:

data: {"chunk": "Large language models (LLMs) have significantly..."}

data: {"chunk": " transformed how developers write and review code..."}

data: [DONE]

Example (Browser)

const es = new EventSource(
  "https://api.misar.io/blog/v1/ai/research",
  // EventSource doesn't support POST — use fetch with ReadableStream instead:
);

// Use fetch for POST + SSE:
const res = await fetch("https://api.misar.io/blog/v1/ai/research", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ topic: "LLMs in software development", depth: "detailed" }),
});

const reader = res.body!.getReader();
const decoder = new TextDecoder();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const lines = decoder.decode(value).split("\n");
  for (const line of lines) {
    if (line.startsWith("data: ") && line !== "data: [DONE]") {
      const { chunk } = JSON.parse(line.slice(6));
      process.stdout.write(chunk);
    }
  }
}

For more details on streaming, see the Streaming guide.

Errors

| Status | Description | |--------|-------------| | 400 | Missing topic or invalid depth | | 401 | Invalid or missing API key | | 429 | Rate limit exceeded |