Skip to content

Authentication

Siraya AI uses API keys for authentication. You can manage your keys in the Dashboard.

Using an API key

Our API follows the standard Bearer token authentication schema. This makes it compatible with most HTTP clients and the OpenAI SDK.

Setting the Authorization Header

If you're calling the Siraya AI API directly, set the Authorization header to your API key:

Authorization: Bearer <YOUR_API_KEY>

Examples

fetch('https://llm.siraya.pro/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'gpt-4o',
    messages: [{ role: 'user', content: 'What is the meaning of life?' }],
  }),
});
from openai import OpenAI

client = OpenAI(
    base_url="https://llm.siraya.pro/v1",
    api_key="<API_KEY>"
)

completion = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Say this is a test"}]
)
import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://llm.siraya.pro/v1',
  apiKey: '<API_KEY>'
});

async function main() {
  const completion = await openai.chat.completions.create({
    model: 'gpt-4o',
    messages: [{ role: 'user', content: 'Say this is a test' }],
  });
  console.log(completion.choices[0].message);
}
main();

Protecting Your API Keys

Always keep your API keys secure: * Never commit keys to public repositories. * Use environment variables (e.g., process.env.SIRAYA_API_KEY) to manage keys in production. * Rotate your keys immediately if you suspect they have been exposed.

Siraya AI is a GitHub secret scanning partner. If your key is detected in a public repository, we will automatically disable it and notify you via email.