Call the Locai API
Use the model id this Locai One serves, for example locaione/Juno-N-Coder-25B-A3B-NVFP4. Do not use a catalogue label such as Juno-N-Coder-25B-A3B (NVFP4), and do not use a name from OpenAI or Anthropic. GET /v1/models lists the ids that are loaded.
Prerequisites
Section titled “Prerequisites”- A model is loaded on this Locai OS.
- You can create a Locai API key in the Locai App (API keys on the Locai API side) or in the Admin Console. Both keys are for this Locai OS.
- Your computer can reach Locai One on the office network, or on the public domain if an administrator turned it on.
- On API keys in the Locai App, create a Locai API key. Copy it once.
- Copy the base URL shown next to that key (the office-network address, or the public domain if an administrator turned it on).
- Point your OpenAI or Anthropic client at that URL and Locai API key.
from openai import OpenAI
client = OpenAI( api_key="LOCAI_API_KEY", base_url="https://locai-<id>.local/v1",)
print( client.chat.completions.create( model="locaione/YOUR-MODEL-ID", max_tokens=64, messages=[{"role": "user", "content": "Hello Locai"}], ) .choices[0] .message.content)# Output: Hello from Locai.import anthropic
client = anthropic.Anthropic( api_key="LOCAI_API_KEY", base_url="https://locai-<id>.local",)
print( client.messages.create( model="locaione/YOUR-MODEL-ID", max_tokens=64, messages=[{"role": "user", "content": "Hello Locai"}], ) .content)# Output: Hello from Locai.A request sent with a Locai API key reaches the model with only the messages you send. The agent’s system prompt from the Admin Console applies in Playground and Locai App chat, not to API requests. Send your own system message if your client needs one.
Playground in the Admin Console sends a test completion without a Locai API key. The Locai App has Playground on the Locai API side. Use either before you change the client.
If a Locai API key is leaked, revoke it and create a replacement.