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
Model requests require your API key or an approved app credential. Get a key by registering for a free account. Model discovery is public.
Your regular API key provides inference and authenticated model listing. App integrations support finer permissions and optional read-only account information approved by the user.
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="")
Auto Routing
Use logfare/auto (aliases: auto, logfare/random) as the model name and Logfare routes to the best available model automatically — falling through a quality-ordered chain on failures so you always get a response.
The chain is ordered by model quality (best first). If a provider fails, the next model is tried. Your key's permissions are respected: mappings derived from models you can't access (private or premium models requiring opt-in) are filtered out before routing.
curl https://logfare.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "logfare/auto",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
The three names are interchangeable — logfare/auto, auto, and logfare/random all route to the same chain. See /models for the current list of models in the chain and their health status.
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
}'
Request limits
These are the currently configured request budgets. Changes made by staff are reflected here automatically.
| Scope | Request budget | Concurrent requests |
|---|---|---|
| Regular account | 20 requests per minute 500 requests per hour 2,500 requests per day |
3 |
| New account | 5 requests per minute 100 requests per hour 250 requests per day |
1 |
| Shared network / IP | 60 requests per minute 3,000 requests per hour 25,000 requests per day |
Account and service limits apply |
The new-account budget applies during the first 24 hours after account creation, unless staff has approved an access exception.
The service also allows up to 64 requests in progress across all accounts. Model and provider budgets can impose additional shared limits; the limits above do not guarantee available model capacity.
Account and network request budgets apply across endpoints. Multiple windows (minute, hour, day, or custom intervals) and concurrent-request limits may apply. New accounts can have lower initial quotas. Windows use fixed UTC boundaries; provider daily budgets reset at 00:00 UTC. Retrying or regenerating a key does not reset an account's allowance.
Staff may assign an individual account a custom request budget or concurrency allowance. These replace the corresponding account defaults, while network, service, model, and provider limits still apply.
A 429 response explains the limit. Respect Retry-After
when present and use backoff. A 403 may require completing Discord
screening, waiting for account/member eligibility, or contacting staff.
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 | Account, network, concurrency, or provider request limit reached |
| 500 | server_error | Upstream provider error — try again or try another model |
| 503 | server_error | Service temporarily unavailable |
Account API
Account APIs are available while the linked Discord account is in the Logfare server. New accounts verify on the registration page; existing accounts can log in and link Discord at /migrate. Leaving suspends access until rejoining. A Discord account can be linked to one Logfare account.
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/auth/register | Create account, get API key |
| GET | /v1/auth/discord/start | Start registration verification in a browser |
| GET | /v1/auth/discord/link/start | Link Discord to a logged-in existing account |
| POST | /v1/auth/discord/membership/check | Refresh membership after rejoining the Logfare server |
| POST | /v1/auth/login | Login; unlinked accounts must migrate first |
| 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 |
Registration requests must include the short-lived, HttpOnly verification cookie issued by the Discord flow. Use the web registration page to complete verification before calling this endpoint.
curl -X POST https://logfare.ai/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "myuser",
"password": "mypassword",
"tos_accepted": true,
"age_confirmed": true
}'
App integrations
Users can grant an app specific access without sharing their password, browser session, or main API key. They can revoke its separate credential at any time.
Register your application
In Developer Apps, create an app and choose its permissions. Its public lfa_… app ID identifies the registration. Each account can have five apps; deleting one frees a slot.
Who can connect? Choose Anyone or Only you. Only you restricts approval to the creator's Logfare account. Switching to it revokes other users' connections; switching back permits new approvals without restoring revoked tokens.
App authentication defaults to App ID only, for distributed apps and plugins. Anyone knowing the ID can start a request, but account access still requires user approval. For backends or private automation, choose Require app secret: requests must also authenticate with the generated secret. Copy it when shown; Logfare stores only its hash. Keep it out of distributed apps, where it could be extracted.
Changing authentication or resetting a secret cancels unfinished connection attempts. Existing approved connections stay active. An app ID alone does not prove which executable is running; confirm that you started the connection in an app you trust.
Select permissions
Each connection can request a subset of the permissions you register. Users see and approve those exact permissions. Scopes are read-only for account data; none can change privacy choices, API keys, or account settings.
inference:chatSend text-model requests and receive responses, including streaming and tool calls.
inference:imagesGenerate and edit images using your account's available models.
inference:audioGenerate speech and transcribe audio using your account's available models.
inference:videoGenerate videos using your account's available models.
inference:embeddingsCreate embeddings using your account's available models.
usage:readView aggregate account-wide usage: totals, time charts, and breakdowns by model and API/app connection. No prompts, responses, or individual request history.
consent:readView training and evaluation preferences, including when each was last changed. Cannot change either preference.
account:readView your Logfare user ID, username, and account creation date. No API key or account changes.
discord:readView your linked Discord user ID, whether you are in the Logfare server, and when you joined. This status remains readable after leaving the server while your Logfare account is active. No Discord token, role list, or Discord account access.
inference:chat covers chat, completions, Anthropic Messages, and Responses. Images covers generation and edits; audio covers speech and transcription. Scopes do not bypass account access, training requirements, or shared limits. /v1/models is public.
Connect an account
Secret-required apps authenticate both requests below using HTTP Basic auth: the app ID as username and app secret as password. Form-encoded client_secret with client_id is also supported; use one authentication method. Never put a secret in a URL. App ID only clients omit the secret.
- Request a device code with your app ID and registered scopes.
- Show the user code and open
verification_uri_complete; also offer the manualverification_uri. The user signs in, verifies Discord if prompted, then approves or denies. - Poll at the returned interval using the temporary
device_code. - Store the access token in the host's secure credential manager and send it as a Bearer token.
POST https://logfare.ai/v1/integrations/oauth/device_authorization Content-Type: application/x-www-form-urlencoded client_id=lfa_YOUR_APP_ID&scope=inference%3Achat%20consent%3Aread
This requests chat and read-only privacy preferences; register both first. If omitted, scope defaults to registered inference:chat. Unknown or unregistered scopes return invalid_scope.
The response includes device_code, user_code, verification_uri, verification_uri_complete, expires_in=900 (15 minutes), and interval=5 (seconds).
POST https://logfare.ai/v1/integrations/oauth/token Content-Type: application/x-www-form-urlencoded grant_type=urn:ietf:params:oauth:grant-type:device_code&client_id=lfa_YOUR_APP_ID&device_code=DEVICE_CODE
Success returns a Bearer access token, granted scopes, and a 180-day expiry. Device codes are single-use; there is no refresh token, so reconnect after expiry or revocation.
Waiting, errors, and recovery
authorization_pending: keep polling;slow_down: add at least five seconds to the interval.- For HTTP 429, honor
Retry-After. Back off on network errors or HTTP 503, and let the user cancel. access_denied: stop. Forexpired_tokenorinvalid_grant, offer a new connection.invalid_client: check the app ID, status, and required secret. Forinvalid_scope, check registered permissions. On API 401, clear the stale token; oninsufficient_scope, request new approval.
Read approved account information
| GET endpoint | Required scope | Response |
|---|---|---|
/v1/me/usage?hours=168 | usage:read | Account-wide totals, zero-filled time buckets, model and API/app breakdowns, last API use, and generation time. Windows: 24, 168 (default), or 720 hours. Cached for 60 seconds after checking access. |
/v1/me/consent | consent:read | training_opt_in, eval_dataset_opt_out, and their respective training_pref_updated_at and eval_pref_updated_at timestamps (null if never changed). |
/v1/me/profile | account:read | user_id, username, and UTC created_at. |
/v1/me/discord | discord:read | discord_user_id as a string or null, discord_is_member, and discord_joined_at (null if unlinked or unavailable). No Discord access token or role list. |
GET https://logfare.ai/v1/me/consent
Authorization: Bearer <access_token>
{"training_opt_in": false, "eval_dataset_opt_out": false}For model selection, hide models marked requires_training_optin=true when training_opt_in=false. Evaluation preference is independent and does not unlock models. Logfare still checks current access on every inference request.
The account owner's browser session also works, but a Bearer token needs its own scope. These read-only endpoints are not a Sign in with Logfare service: browser callbacks and identity tokens are not provided. Deactivation revokes connections. Leaving the Logfare Discord server blocks inference and account reads until access is restored; discord:read can still report membership for an active account.
Permissions and connection lifecycle
Changing an app's permissions never silently expands existing credentials. Removing a scope removes it from credentials and invalidates pending requests that need it. Users can revoke connections individually; disabling or deleting an app revokes all of them. Revoked credentials stay revoked, while usage attribution is retained.
Developers see connection totals, not users' credentials, prompts, responses, or request history. Account data requires a user's approved token with the matching scope.
Connect and make a test request
Run your integration's normal setup or connect command, approve the requested permissions in Logfare, then select a Logfare model in the integration. For an OpenAI-compatible client, use this configuration:
Base URL: https://logfare.ai/v1 API credential: the access token returned after approval Model: logfare/auto
Keep /v1 exactly once in the base URL. Test with a short chat request, then review the connection and usage in your dashboard. Revoke test connections you no longer need.
Use HTTPS outside loopback development. Never log device codes or access tokens or put them in URLs. The protocol follows the OAuth device authorization grant.