AI and BYOK
Semestra's AI features run on providers you bring. How keys are stored and which model is used.
Sem (the assistant), syllabus and timetable extraction, image reading and file search all call an AI provider that you configure: bring your own key (BYOK). Semestra does not resell model access, so there is no AI quota and no AI bill from Semestra; your provider bills you directly.
Where to configure it
Global settings, under AI:
| Page | What it holds |
|---|---|
| Providers | Your providers: type, name, base URL, key, and what the endpoint can do |
| Models | Which model serves each purpose, and optional model parameters |
| Usage | Tokens used and their estimated cost |
How keys are stored
- Keys are encrypted with the server's
SEMESTRA_ENCRYPTION_KEYbefore they are written to the database. The API only ever returns a masked hint. - A provider is test-called before it is saved, and again when its key changes.
- Data exports never include keys. After importing a backup, providers that had a key are turned off until you enter it again.
Purposes
Each AI call has a purpose, and each purpose needs one capability from the provider.
| Purpose | Used for | Needs |
|---|---|---|
| Sem | Conversations with the assistant, and compacting them | chat |
| Reading documents | Course details, deadlines and grades from syllabi | chat |
| Reading images | Timetable screenshots | vision |
| OCR | Text in scanned PDFs and photos of pages | vision |
| Search | Finding passages in your course files | embedding |
| Light tasks | Conversation titles, suggested questions, tidying Sem's memory | chat |
File indexing
New course files are read and indexed as soon as they are added, which is when scanned pages go to the image model and passages to the search model. To control that spending, turn off File indexing → Index new files automatically in the program's (or a course's) settings. Files added while it is off are indexed when you ask for it, or when an import needs them.
Search vectors belong to the model that made them, so changing the search model rebuilds them for every indexed file in the background. When files already have vectors, the settings ask before switching.
Which model answers
For each purpose, Semestra takes the first of:
- The model you chose for that purpose on Models, if its provider is on and can serve it.
- Any enabled provider that can serve it, with that provider type's recommended model.
- On a self-hosted instance, the instance-wide provider.
When none applies, the feature shows a quiet "connect AI" hint instead of failing.
Recommended models (used in step 2):
| Provider | Sem, documents, images | Light tasks | Search |
|---|---|---|---|
| Anthropic | claude-sonnet-5-5 | claude-haiku-5-5 | (none) |
| OpenAI | gpt-5; gpt-5-mini for documents and images | gpt-5-nano | text-embedding-3-small |
| Gemini | gemini-2.5-pro; gemini-2.5-flash for documents and images | gemini-2.5-flash-lite | gemini-embedding-001 |
| Ollama | qwen3:8b (no images) | qwen3:8b | nomic-embed-text |
OCR uses the light-task model (Ollama has none). A self-hosted server can read scanned pages itself instead, with no model at all: see Local OCR. It can also embed text for search itself: see Local embedding.
Compatible endpoints have no recommendation: pick a model on Models, or type its name when the endpoint cannot list its models.
Cost estimates
The Usage page estimates cost with the genai-prices price list bundled with the server. Compatible endpoints are matched by their base URL (DeepSeek, OpenRouter and others); models with no known price show no cost, and Ollama is always free.