Documentation

Everything you need to integrate Grymoir into your product.

Getting Started

Grymoir is powered by a RAGFlow instance hosted at app.grymoir.com. You can interact with it via the HTTP API or embed a chat widget directly into your page using an iframe.

1. Get your API key

Sign up at app.grymoir.com and navigate to your chat assistant settings to obtain your API key. Keys are prefixed with ragflow-.

2. Choose your integration method

  • HTTP API — call the RAGFlow-compatible REST API for full control over chat sessions and completions.
  • Iframe embed — drop a single <iframe> tag into your page for a ready-made chat widget.

Authentication

All API requests require a valid API key passed via the Authorization header:

Authorization: Bearer ragflow-YourApiKeyHere

You can generate and manage API keys from the app.grymoir.com dashboard.

Chat API

The base URL for all API calls is:

https://app.grymoir.com/api/v1

Create a chat session

Start a new conversation session with a chat assistant:

curl -X POST https://app.grymoir.com/api/v1/chats/{chat_id}/sessions \
  -H "Authorization: Bearer ragflow-YourApiKeyHere" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Session"
  }'

Chat completions (OpenAI-compatible)

Send messages and receive answers using the OpenAI-compatible endpoint:

curl -X POST https://app.grymoir.com/api/v1/chats_openai/{chat_id}/chat/completions \
  -H "Authorization: Bearer ragflow-YourApiKeyHere" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-chat-id",
    "messages": [
      { "role": "user", "content": "What is our refund policy?" }
    ],
    "stream": false
  }'

Set "stream": true to receive a streaming response via server-sent events.

List chat assistants

curl https://app.grymoir.com/api/v1/chats \
  -H "Authorization: Bearer ragflow-YourApiKeyHere"

Embed Chat Widget

The fastest way to add Grymoir to your site is with the iframe embed. In the app.grymoir.com dashboard, hover over your chat assistant and click Edit to reveal the embed code, then paste it into your HTML:

<iframe
  src="https://app.grymoir.com/chat/share?shared_id=YOUR_CHAT_ID&from=chat&auth=YOUR_API_KEY"
  style="width: 100%; height: 600px; border: none;"
  allow="clipboard-write"
></iframe>

Replace YOUR_CHAT_ID and YOUR_API_KEY with the values from your dashboard. You can adjust the width and height to fit your layout.

Examples

Python

import requests

API_KEY = "ragflow-YourApiKeyHere"
BASE = "https://app.grymoir.com/api/v1"
CHAT_ID = "your-chat-id"

# Create a session
session = requests.post(
    f"{BASE}/chats/{CHAT_ID}/sessions",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"name": "Demo session"},
).json()

# Send a message (OpenAI-compatible)
response = requests.post(
    f"{BASE}/chats_openai/{CHAT_ID}/chat/completions",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "model": CHAT_ID,
        "messages": [{"role": "user", "content": "How do I reset my password?"}],
        "stream": False,
    },
).json()

print(response["choices"][0]["message"]["content"])

JavaScript (fetch)

const API_KEY = 'ragflow-YourApiKeyHere';
const BASE = 'https://app.grymoir.com/api/v1';
const CHAT_ID = 'your-chat-id';

const res = await fetch(
  `${BASE}/chats_openai/${CHAT_ID}/chat/completions`,
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: CHAT_ID,
      messages: [{ role: 'user', content: 'What is our refund policy?' }],
      stream: false,
    }),
  }
);

const data = await res.json();
console.log(data.choices[0].message.content);