Back – Docs
OLLMDocs

Authentication

How to authenticate requests to the OLLM API

Authentication

To call the OLLM API you need an API key.

Keep your API key secret. Do not expose it in frontend code.

Headers

Send the key via Authorization:

curl -X POST https://api.ollm.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"Hello"}'

Example Request

POST/v1/chat/completions
const res = await fetch("https://api.ollm.com/v1/chat/completions", {
method: "POST",
headers: {
  Authorization: "Bearer YOUR_API_KEY",
  "Content-Type": "application/json",
},
body: JSON.stringify({ prompt: "Hello" }),
});

Errors

If your key is invalid, you’ll receive a 401 Unauthorized response.