Skip to main content

Getting started

Serenity Edge is an OpenAI-compatible inference API run by Substrate AI on its own GPU infrastructure in Valencia, Spain. Prompts and completions are never stored and never used for training. If your code already talks to the OpenAI API, you only need to change the base URL and the API key.

Base URLhttps://api.serenityedge.ai/v1
AuthenticationAuthorization: Bearer <key>
EndpointsPOST /v1/chat/completions, GET /v1/models
ModelsSee Models

1. Get an API key

There are three ways to use Serenity Edge. Pick the one that fits you and follow its page to obtain a key:

  • OpenRouter: choose the provider "Serenity Edge" from your existing OpenRouter account.
  • Serenity Star account: create API keys and buy prepaid credits.
  • Enterprise: a contract with committed capacity and a service level agreement.

Keep the key secret. Do not embed it in client-side code or commit it to a repository.

2. Make a request

All examples below send the same chat completion. Replace $SERENITY_EDGE_API_KEY with your key.

curl

curl https://api.serenityedge.ai/v1/chat/completions \
-H "Authorization: Bearer $SERENITY_EDGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "orion-pro",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain what a token is in one sentence."}
]
}'

Python

Install the official OpenAI library (pip install openai) and point it at Serenity Edge:

from openai import OpenAI

client = OpenAI(
base_url="https://api.serenityedge.ai/v1",
api_key="YOUR_SERENITY_EDGE_API_KEY",
)

completion = client.chat.completions.create(
model="orion-pro",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain what a token is in one sentence."},
],
)

print(completion.choices[0].message.content)

Node.js

Install the official OpenAI library (npm install openai):

import OpenAI from "openai";

const client = new OpenAI({
baseURL: "https://api.serenityedge.ai/v1",
apiKey: process.env.SERENITY_EDGE_API_KEY,
});

const completion = await client.chat.completions.create({
model: "orion-pro",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Explain what a token is in one sentence." },
],
});

console.log(completion.choices[0].message.content);

.NET

Install the official OpenAI NuGet package (dotnet add package OpenAI):

using System.ClientModel;
using OpenAI;
using OpenAI.Chat;

var client = new OpenAIClient(
new ApiKeyCredential(Environment.GetEnvironmentVariable("SERENITY_EDGE_API_KEY")!),
new OpenAIClientOptions { Endpoint = new Uri("https://api.serenityedge.ai/v1") });

ChatClient chat = client.GetChatClient("orion-pro");

ChatCompletion completion = chat.CompleteChat(
new SystemChatMessage("You are a helpful assistant."),
new UserChatMessage("Explain what a token is in one sentence."));

Console.WriteLine(completion.Content[0].Text);

3. Read the response

A non-streaming response is a standard chat completion object. The usage block is what you are billed on.

{
"id": "chatcmpl-8f0f1e2a",
"object": "chat.completion",
"created": 1758542400,
"model": "orion-pro",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A token is a small unit of text, roughly a word or part of a word, that a language model reads and writes."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 27,
"completion_tokens": 26,
"total_tokens": 53,
"prompt_tokens_details": { "cached_tokens": 0 }
}
}

Next steps