Skip to main content

Request

Send a POST request with your prompt and options. Set stream: true to receive Server‑Sent Events (SSE), or omit stream for a single JSON response (default).
curl -X POST "https://api.incredible.one/v1/chat-completion" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "small-1",
    "messages": [
      { "role": "user", "content": "Hello, Incredible!", "file_ids": ["<id1>", "<id2>", "<id3>", ...] }
    ]
  }'

Request Body

  • model string — Model identifier (e.g., small-1).
  • messages array — Conversation history; at least one user message is required.
  • system string (optional) — System prompt defining assistant behavior.
  • stream boolean (optional) — Set true for SSE streaming; omit to get a single JSON response (default false).

Responses

stream = true (SSE)

data: {"content": {"type": "text_chunk", "content": "Hello"}}
data: {"content": {"type": "function_call", "function_call_id": "...", "function_calls": []}}
data: {"content": "[DONE]"}
See also: Chat Completion (Streaming).

Non‑streaming (default, JSON)

{
  "result": {
    "response": [
      {
        "content": "Hello! 👋",
        "role": "assistant"
      }
    ],
    "thinking": "Greet the user briefly."
  }
}

Streaming Example

Enable real-time streaming by setting stream: true. Receive Server-Sent Events (SSE) as the response is generated.
import requests
import json

url = "https://api.incredible.one/v1/chat-completion"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
payload = {
    "model": "small-1",
    "messages": [
        {"role": "user", "content": "Write a short poem about coding"}
    ],
    "stream": True
}

# Stream response
response = requests.post(url, headers=headers, json=payload, stream=True)

for line in response.iter_lines():
    if line:
        line_str = line.decode('utf-8')
        if line_str.startswith('data: '):
            data_str = line_str[6:]  # Remove 'data: ' prefix
            if data_str == '[DONE]':
                print("\n[Stream complete]")
                break
            try:
                data = json.loads(data_str)
                if 'content' in data and data['content'].get('type') == 'text_chunk':
                    print(data['content']['content'], end='', flush=True)
            except json.JSONDecodeError:
                pass
SSE Stream Format:
  • Each line starts with data: followed by JSON
  • text_chunk events contain content fragments
  • function_call events indicate tool usage
  • [DONE] signals stream completion
Benefits:
  • Real-time response display
  • Lower perceived latency
  • Better user experience for long responses
  • Ability to cancel mid-stream