API Documentation
Use the OpenAI-compatible API from Seven Assistant to integrate AI capabilities into your own applications.
Quick Start
Your first API request in 2 minutes
How it works
The Seven Assistant API is fully OpenAI-compatible. This means: every tool, library, and SDK that works with the OpenAI API also works with Seven Assistant. You just need to change the base URL.
Create an API key
In settings under “API Keys”
Set the base URL
YOUR_DOMAIN/v1/
Call the API
Just like OpenAI: same formats
First request with curl
curl YOUR_DOMAIN/v1/chat/completions \
-H "Authorization: Bearer sk-educa-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "educa-ai",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is photosynthesis?"}
]
}'Authentication
Create and use API keys
Create an API key
- 1Open the Seven Assistant app and go to Settings → API Keys.
- 2Click “Create API Key” and assign a name (e.g. “My Project”).
- 3Copy the key immediately: it will only be shown once.
Using the key
Send the key in the Authorization header:
Authorization: Bearer sk-educa-xxxxxxxxxxxxx⚠ Security notes
- •Never include your API key in client-side code (JavaScript in the browser).
- •Store keys in environment variables, not in source code.
- •If a key is compromised, revoke it immediately in the settings.
- •Create separate keys for different projects.
Available Models
Choose the right model for your use case
educa-ai
General-purpose model
Best model for most use cases. High quality for text generation, summaries, translations, and question-answering.
educa-ai-mistral
Mistral Small 3.1
Faster, efficient model. Ideal for high-throughput requirements, simple tasks, and real-time applications.
educa-ai-code
Qwen3 Coder
Optimized for programming and code generation. Ideal for code completion, debugging, and technical tasks.
Retrieve models via API
curl YOUR_DOMAIN/v1/models \
-H "Authorization: Bearer sk-educa-YOUR_API_KEY"Chat Completions
POST /v1/chat/completions
Request format
{
"model": "educa-ai",
"messages": [
{"role": "system", "content": "You are a biology teacher."},
{"role": "user", "content": "Explain mitosis in simple terms."}
],
"temperature": 0.7,
"max_tokens": 1000,
"stream": false
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | ✓ | Model ID (e.g. educa-ai) |
| messages | array | ✓ | List of messages with role and content |
| temperature | number | – | Creativity (0.0 – 2.0, default: model-dependent) |
| max_tokens | integer | – | Maximum number of generated tokens |
| stream | boolean | – | Enable streaming (true/false) |
| top_p | number | – | Nucleus sampling (0.0 – 1.0) |
Response format
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1711900000,
"model": "educa-ai",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Mitosis is the process in which..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 156,
"total_tokens": 184
}
}Message roles
systemDefines the behavior and context of the assistant. Sent as the first message.userThe user's message: questions, instructions, or input.assistantPrevious responses from the assistant. Used for conversation history.
Streaming
Real-time responses via Server-Sent Events (SSE)
How streaming works
Set "stream": true in the request. The response is streamed as Server-Sent Events (SSE). Each chunk contains a text fragment. The stream ends with data: [DONE].
curl YOUR_DOMAIN/v1/chat/completions \
-H "Authorization: Bearer sk-educa-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "educa-ai",
"messages": [{"role": "user", "content": "Count to 5"}],
"stream": true
}'Stream chunks
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","created":1711900000,"model":"educa-ai","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","created":1711900000,"model":"educa-ai","choices":[{"index":0,"delta":{"content":"1, "},"finish_reason":null}]}
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","created":1711900000,"model":"educa-ai","choices":[{"index":0,"delta":{"content":"2, "},"finish_reason":null}]}
data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","created":1711900000,"model":"educa-ai","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]Embeddings
POST /v1/embeddings
What are embeddings for?
Embeddings convert text into numerical vectors. These vectors can be used for semantic search, clustering, recommendation systems, and Retrieval-Augmented Generation (RAG).
Example
curl YOUR_DOMAIN/v1/embeddings \
-H "Authorization: Bearer sk-educa-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "educa-ai",
"input": "Photosynthesis is the process by which plants convert light into energy."
}'Response
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.0023, -0.0091, 0.0152, ...],
"index": 0
}
],
"model": "educa-ai",
"usage": {
"prompt_tokens": 18,
"total_tokens": 18
}
}Code Examples & Integrations
Ready-made examples for Python, JavaScript, and more
from openai import OpenAI
client = OpenAI(
api_key="sk-educa-YOUR_API_KEY",
base_url="YOUR_DOMAIN/v1/"
)
# Chat Completion
response = client.chat.completions.create(
model="educa-ai",
messages=[
{"role": "system", "content": "You are a helpful teacher."},
{"role": "user", "content": "Create 5 quiz questions about the Middle Ages."}
],
temperature=0.7,
max_tokens=1000
)
print(response.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="educa-ai",
messages=[{"role": "user", "content": "Explain democracy."}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
# Embeddings
embedding = client.embeddings.create(
model="educa-ai",
input="Photosynthesis explained for children"
)
print(embedding.data[0].embedding[:5])Installation: pip install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-educa-YOUR_API_KEY",
baseURL: "YOUR_DOMAIN/v1/"
});
// Chat Completion
const response = await client.chat.completions.create({
model: "educa-ai",
messages: [
{ role: "system", content: "You are a helpful teacher." },
{ role: "user", content: "What is the rule of three?" }
]
});
console.log(response.choices[0].message.content);
// Streaming
const stream = await client.chat.completions.create({
model: "educa-ai",
messages: [{ role: "user", content: "Explain the water cycle." }],
stream: true
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content;
if (content) process.stdout.write(content);
}Installation: npm install openai
const response = await fetch("YOUR_DOMAIN/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer sk-educa-YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "educa-ai",
messages: [
{ role: "user", content: "Create a weekly plan for math, grade 5." }
]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);using Azure.AI.OpenAI;
using OpenAI.Chat;
using System.ClientModel;
var client = new ChatClient(
model: "educa-ai",
credential: new ApiKeyCredential("sk-educa-YOUR_API_KEY"),
options: new OpenAIClientOptions
{
Endpoint = new Uri("YOUR_DOMAIN/v1/")
}
);
var response = await client.CompleteChatAsync(
new ChatMessage[]
{
new SystemChatMessage("You are a helpful teacher."),
new UserChatMessage("What is a parabola in math?")
}
);
Console.WriteLine(response.Value.Content[0].Text);NuGet: Azure.AI.OpenAI
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="educa-ai",
api_key="sk-educa-YOUR_API_KEY",
base_url="YOUR_DOMAIN/v1/"
)
response = llm.invoke("Create a summary of the French Revolution.")
print(response.content)Installation: pip install langchain-openai
You can use Seven Assistant as an AI assistant in your IDE. Configure the following in the config.json of Continue.dev:
{
"models": [
{
"title": "Seven Assistant",
"provider": "openai",
"model": "educa-ai",
"apiKey": "sk-educa-YOUR_API_KEY",
"apiBase": "YOUR_DOMAIN/v1/"
}
]
}Error Handling & Limits
HTTP status codes, error messages, and rate limits
HTTP status codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Invalid request (e.g. missing field, unknown model) |
| 401 | Missing or invalid API key |
| 403 | API access not available for your account |
| 429 | Rate limit exceeded: wait and try again |
| 500 | Internal server error |
Error response format
{
"error": {
"message": "Model 'unknown-model' is not available.",
"type": "invalid_request_error",
"code": "model_not_found"
}
}Rate limits
| Plan | Limit | Period |
|---|---|---|
| Pro | 100 requests | per day |
Token usage is tracked per API key and can be viewed in the settings.
Rate limit exceeded?
- •Implement exponential backoff: wait 1s, 2s, 4s, 8s, etc. between retry attempts.
- •Use caching for repeated requests with identical content.
- •Use batching: combine multiple questions into a single prompt.
Ready to get started?
Create your first API key and integrate Seven Assistant into your application.
Open app