Documentation/Chat Completions

Chat Completions

Chat Completions

The Chat Completions API is MeeDoo-native. Send a list of messages and receive a model-generated response with full control over features, tools, thinking mode, and more.

Base URL

https://api.meedoo.co/api (production) or http://localhost:8080/api (local development)

Endpoints

POST /api/chat/completions
POST /api/v1/chat/completions

Authentication

All requests require a Bearer token in the Authorization header.

POST /api/v1/chat/completions

Create Chat Completion

Creates a model response for the given chat conversation.

Parameters

NameTypeReqDescriptionDefault
modelstringYesID of the model to use.—
messagesarrayYesA list of messages comprising the conversation.—
temperaturenumberNoSampling temperature between 0 and 2.0.7
max_tokensintegerNoMaximum number of tokens to generate.NULL (auto)
streambooleanNoIf set, partial message deltas will be sent.false

Response Examples

Chat Completions (200)
{
  "id": "md-resp-f737cb2e-e142-42df-943a-1ebebef99933",
  "created": 1791815801,
  "model": "meedoo:latest",
  "owned_by": "MeeDoo",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      }
    }
  ],
  "object": "chat.completion",
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 10,
    "total_tokens": 25,
    "input_tokens": 15,
    "output_tokens": 10,
    "total_duration_ms": 264,
    "tokens_per_second": 37.88,
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  }
}

Code Examples

Chat Completion
curl -X POST https://api.meedoo.co/api/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"meedoo:latest","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"What is edge AI?"}],"temperature":0.7}' 
Streaming Response JavaScript
const res = await fetch("https://api.meedoo.co/api/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "meedoo:latest",
    messages: [{ role: "user", content: "Hello!" }],
    stream: true
  })
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  process.stdout.write(decoder.decode(value));
}

Sub-sections