§ 02 · LOCAL API SERVER127.0.0.1:1337/V1OPENAI SDK COMPATIBLE
Enabling the Local API Server on Port 1337
To call your downloaded Jan models from Python, curl or IDE extensions, open Settings → Local API Server, pick a downloaded model under Default Model and click Start Server. Jan binds an OpenAI-compatible server to http://127.0.0.1:1337/v1.
import os
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:1337/v1",
api_key="ollama",
)
r = client.chat.completions.create(
model="llama3.2-3b-instruct",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)
curl http://127.0.0.1:1337/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"llama3.2-3b-instruct","messages":[{"role":"user","content":"Hello"}]}'
Server won't start? Make sure a downloaded model is selected under Default Model Local API Server before clicking Start Server, and confirm no other app is already bound to port 1337.