Skip to main content

OpenAI Compatibility API

GoingMerry exposes an OpenAI-compatible API layer directly on the daemon port. This allows tools designed for the OpenAI API to swap in GoingMerry as a local backend.

  • Base Endpoint: http://localhost:11434/v1
  • Authentication: Set the Authorization header to any dummy key (e.g. Bearer merry).

1. Chat Completions

Generate completions matching the OpenAI JSON schema.

  • Endpoint: POST /v1/chat/completions
  • Supported Parameters:
    • model (string, required): Local model tag.
    • messages (array of objects): Chat message thread history.
    • stream (boolean): Stream response delta chunks.
    • temperature (float): Creativity control.
    • max_tokens (integer): Output token limits (maps to num_predict).

curl Example

curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer merry" \
-d '{
"model": "gemma4",
"messages": [
{"role": "user", "content": "Hello!"}
],
"stream": false
}'

Response Payload

{
"id": "chatcmpl-103ab28f9a0c",
"object": "chat.completion",
"created": 1780730100,
"model": "gemma4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 8,
"total_tokens": 20
}
}

2. Generate Embeddings

Generate vector representations of text matching the OpenAI embeddings schema.

  • Endpoint: POST /v1/embeddings

curl Example

curl http://localhost:11434/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"model": "nomic-embed-text",
"input": "Vectorize this text"
}'

Response Payload

{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.01723901, -0.0823901, 0.1023812, ...]
}
],
"model": "nomic-embed-text",
"usage": {
"prompt_tokens": 4,
"total_tokens": 4
}
}