OpenAI Compatible FastAPI Endpoint API Reference
The following endpoints are compatible with OpenAI endpoints to make it compatible with Chat UI Interfaces.
GET /health
Check if the server is running.
Response
{
"status": "ok"
}
GET /v1/models
List available models.
Response
{
"object": "list",
"data": [
{
"id": "ragwire-agent",
"object": "model",
"created": 1776001225,
"owned_by": "ragwire"
}
]
}
GET /v1/models/{model_id}
Get a specific model by ID.
Response
{
"id": "ragwire-agent",
"object": "model",
"created": 1776001225,
"owned_by": "ragwire"
}
POST /v1/chat/completions
Send a chat message and receive a streamed response in OpenAI SSE format.
Request
{
"model": "ragwire-agent",
"messages": [
{ "role": "user", "content": "what is apple revenue?" }
]
}
Streamed Response (Server-Sent Events)
data: {"id": "chatcmpl-abc123", "object": "chat.completion.chunk", "created": 1776001225, "model": "ragwire-agent", "choices": [{"index": 0, "delta": {"role": "assistant", "content": ""}, "finish_reason": null}]}
data: {"id": "chatcmpl-abc123", "object": "chat.completion.chunk", "created": 1776001225, "model": "ragwire-agent", "choices": [{"index": 0, "delta": {"content": "Apple's total net sales"}, "finish_reason": null}]}
data: {"id": "chatcmpl-abc123", "object": "chat.completion.chunk", "created": 1776001225, "model": "ragwire-agent", "choices": [{"index": 0, "delta": {}, "finish_reason": "stop"}]}
data: [DONE]
POST /upload
Upload one or more documents to ingest into the knowledge base.
Request — multipart/form-data
files: report.pdf
files: earnings.pdf
Response
{
"message": "Ingested 42 chunks from 2 file(s) (0 skipped).",
"stats": {
"total": 2,
"processed": 2,
"skipped": 0,
"failed": 0,
"chunks_created": 42,
"errors": []
}
}
0 Comments