API Documentation
OpenAI-compatible. Drop-in replacement.
Logfare is 100% OpenAI API compatible. Point any OpenAI-compatible client at https://logfare.ai/v1 and it just works. No SDK changes needed.
Authentication
All requests require an API key. Get one by registering for a free account.
Send your key in the Authorization header as a Bearer token:
Authorization: Bearer YOUR_API_KEY
Base URL
All API endpoints are under https://logfare.ai/v1
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat completions (streaming supported) |
| POST | /v1/completions | Legacy text completions |
| POST | /v1/messages | Anthropic-style messages API |
| POST | /v1/responses | OpenAI Responses API |
| POST | /v1/images/generations | Image generation |
| POST | /v1/images/edits | Image editing |
| POST | /v1/audio/speech | Text-to-speech |
| POST | /v1/audio/transcriptions | Speech-to-text |
| POST | /v1/embeddings | Text embeddings |
| GET | /v1/models | List available models |
| GET | /v1/status | System + model health status |
Chat Completions
POST /v1/chat/completions
Standard OpenAI chat completions format. Streaming via SSE is supported — set "stream": true.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (see /models) |
messages | array | Yes | Array of {role, content} message objects |
stream | boolean | No | Stream response via SSE (default: false) |
temperature | number | No | Sampling temperature (default: 1.0) |
max_tokens | integer | No | Max tokens to generate |
top_p | number | No | Nucleus sampling (default: 1.0) |
stop | string/array | No | Stop sequence(s) |
curl https://logfare.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "kimi-k2.5",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
from openai import OpenAI
client = OpenAI(
base_url="https://logfare.ai/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="kimi-k2.5",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
from openai import OpenAI
client = OpenAI(
base_url="https://logfare.ai/v1",
api_key="YOUR_API_KEY",
)
stream = client.chat.completions.create(
model="kimi-k2.5",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Anthropic Messages API
POST /v1/messages
Anthropic-compatible messages endpoint. Use the same request format as the Anthropic API — model, messages, max_tokens, system, etc. The x-api-key header or Authorization: Bearer both work.
curl https://logfare.ai/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
Image Generation
POST /v1/images/generations
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Image model ID (e.g. flux-2-pro) |
prompt | string | Yes | Text description of the image |
n | integer | No | Number of images (default: 1) |
size | string | No | Image dimensions as WxH (e.g. 1024x768). Parsed and sent as width/height to the provider. |
steps | integer | No | Number of diffusion steps (model-dependent). Higher = more detail, slower. Mapped to num_steps for providers that require it. |
response_format | string | No | b64_json or url (default: b64_json) |
curl https://logfare.ai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "flux-2-pro",
"prompt": "a cat sitting on a windowsill, warm afternoon light",
"size": "1024x1024",
"n": 1
}'
Embeddings
POST /v1/embeddings
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model ID |
input | string/array | Yes | Text or array of texts to embed |
Text to Speech
POST /v1/audio/speech
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | TTS model ID |
input | string | Yes | Text to synthesize |
voice | string | No | Voice name (model-dependent) |
Audio Transcriptions
POST /v1/audio/transcriptions
Send an audio file as multipart/form-data. Returns transcribed text.
List Models
GET /v1/models
Returns all active public models. No authentication required.
curl https://logfare.ai/v1/models
Errors
Errors follow the OpenAI API error format:
{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"code": null
}
}
| Status | Type | Meaning |
|---|---|---|
| 401 | authentication_error | Missing or invalid API key |
| 403 | permission_error | Model not available for your key |
| 404 | not_found_error | Model not found |
| 429 | rate_limit_error | Rate limited (rare — we don't rate-limit users) |
| 500 | server_error | Upstream provider error — try again or try another model |
| 503 | server_error | Service temporarily unavailable |
Account API
Manage your account programmatically (no web UI needed).
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/auth/register | Create account, get API key |
| POST | /v1/auth/login | Login, get API key |
| GET | /v1/auth/me | Get current user info |
| POST | /v1/auth/regenerate-key | Generate new API key |
| POST | /v1/auth/consent | Set eval-dataset consent |
| DELETE | /v1/me/delete | Delete account |
curl -X POST https://logfare.ai/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "myuser",
"password": "mypassword"
}'