LOPI API Documentation

OpenAI-compatible and Anthropic-compatible endpoints with extended CPU model timeouts

Why 660s–900s Timeouts Matter: Reasoning models like deepseek-r1:8b run CPU-isolated local inference. Always enable stream=true and configure client/proxy timeouts >= 600s.

Supported Endpoints

API Base URL: https://lopi-app.rudd-catla.ts.net

  • GET /v1/models — List Active Models (/v1/models)
  • POST /v1/chat/completions — OpenAI Compatible (/v1/chat/completions)
  • POST /v1/completions — Legacy OpenAI Completions
  • POST /v1/messages — Anthropic Messages API (/v1/messages)

Authentication

Send your API key via Authorization: Bearer sk-lopi-... or x-api-key: sk-lopi-...

Authorization: Bearer sk-lopi-demo
x-api-key: sk-lopi-demo

Streaming & Timeout Guidance

Local reasoning models run with 660s upstream timeout and 900s proxy SSE stream limits.

600s · 660s · 900s SSE stream keepalive

Available Models

Model ID Provider Context Window Input / Output (per 1M) Streaming
qwen2.5-coder:1.5b LOPI Local AI (VM 107) 32768 $0.05 / $0.15 Supported
deepseek-r1:1.5b LOPI Local AI (VM 107) 32768 $0.08 / $0.24 Supported
gpt-4o-mini OpenAI Cloud 128000 $0.15 / $0.60 Supported
claude-3-5-haiku-latest Anthropic Cloud 200000 $0.80 / $4.00 Supported
qwen2.5-coder:7b LOPI Local AI (VM 107) 32768 $0.10 / $0.30 Supported
deepseek-r1:8b LOPI Local AI (VM 107) 32768 $0.15 / $0.45 Supported

Normalized Error Codes

HTTP Status Error Code Meaning & Retry Guidance
400VALIDATION_ERRORInput validation failed.
401INVALID_API_KEYAuthentication is required.
402INSUFFICIENT_CREDITSInsufficient available credits.
403RBAC_FORBIDDENYou do not have permission to perform this action.
404NOT_FOUNDRequested resource was not found.
429RATE_LIMIT_EXCEEDEDToo many requests. Please try again later.
503SERVICE_UNAVAILABLENo healthy provider is available for the requested model.

Code Examples (curl, Python, JavaScript)

curl (OpenAI & Anthropic)

curl -N https://lopi-app.rudd-catla.ts.net/v1/chat/completions \
  -H "Authorization: Bearer sk-lopi-demo" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen2.5-coder:7b","stream":true,"messages":[{"role":"user","content":"Hello"}]}'

curl -N https://lopi-app.rudd-catla.ts.net/v1/messages \
  -H "x-api-key: sk-lopi-demo" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-r1:8b","max_tokens":512,"stream":true,"messages":[{"role":"user","content":"Hello"}]}'

Python (openai & anthropic SDKs)

import os
import openai
import anthropic

oai = openai.OpenAI(api_key=os.environ["LOPI_API_KEY"], base_url="https://lopi-app.rudd-catla.ts.net/v1", timeout=660.0)
resp = oai.chat.completions.create(model="qwen2.5-coder:7b", messages=[{"role": "user", "content": "Hello"}], stream=True)

ant = anthropic.Anthropic(api_key=os.environ["LOPI_API_KEY"], base_url="https://lopi-app.rudd-catla.ts.net", timeout=660.0)
msg = ant.messages.create(model="deepseek-r1:8b", max_tokens=256, messages=[{"role": "user", "content": "Hello"}])

JavaScript / Node.js

import OpenAI from "openai";
import Anthropic from "@anthropic-ai/sdk";

const openai = new OpenAI({ apiKey: process.env.LOPI_API_KEY, baseURL: "https://lopi-app.rudd-catla.ts.net/v1", timeout: 660000 });
const anthropic = new Anthropic({ apiKey: process.env.LOPI_API_KEY, baseURL: "https://lopi-app.rudd-catla.ts.net", timeout: 660000 });