OpenAI-compatible API
Any app or library that speaks the OpenAI API works with base URL
http://127.0.0.1:8080/v1. No key is needed in local-only mode.
Example — Duy's quiz script in Python
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key="not-needed")
reply = client.chat.completions.create(
model="study-buddy",
messages=[{"role": "user", "content": "Quiz me: one question about the water cycle."}],
)
print(reply.choices[0].message.content)
Images, video, and speech
When the matching capability is on, the same port also serves:
| Endpoint | What it does |
|---|---|
POST /v1/images/generations | Create images (prompt, size, n; returns url and b64_json) |
POST /v1/videos/generations | Create a short video; the request waits until it's done |
POST /v1/audio/transcriptions | Speech to text (multipart file) |
POST /v1/audio/speech | Text to speech (input; returns a WAV file) |
GET /files/<path> | Download a file from outputs/ |
img = client.images.generate(model="sd-turbo", prompt="a red fox in the snow")
print(img.data[0].url) # /files/images/a-red-fox-in-the-snow-….png
with open("lecture.wav", "rb") as f:
print(client.audio.transcriptions.create(model="whisper", file=f).text)
Vision and omni chat models accept OpenAI image_url and input_audio
content parts in /v1/chat/completions messages, and tool calling works with
tools in the request.
Questions or problems? support@bdtren.com · Contact page.