Skip to content

Environment Variables

The application uses pydantic-settings to manage configuration via app/core/config.py.

Configuration Table

Variable Default / Example Purpose
OPENAI_API_KEY sk-... Critical. Used for embeddings, reranking, and chat.
PINECONE_API_KEY pcsk_... Critical. Connection to Vector DB.
SUPABASE_URL https://... Supabase project URL.
SUPABASE_SERVICE_ROLE_KEY ... Critical. Service role key used for all backend operations. Bypasses RLS.
ADMIN_API_KEY ... Internal key fallback for admin bootstrap (deprecated, migrate to JWT).
OPENAI_CHAT_MODEL gpt-4o Main reasoning model.
OPENAI_RERANK_MODEL gpt-4o-mini Cost-effective model for reranking candidates.
OPENAI_EMBEDDING_MODEL text-embedding-3-small Embedding model for vector generation.
PINECONE_INDEX_NAME curriculum-1536 Target index in Pinecone.
ENV local local or prod. Affects CORS and logging.
BASE_CHAT_COST 5 Tokens deducted per chat message.
TOKEN_BUFFER 10 Extra tokens reserved to prevent mid-request failures.

Note: SUPABASE_ANON_KEY and SUPABASE_KEY have been removed. The backend uses only SUPABASE_SERVICE_ROLE_KEY for all operations. The SUPABASE_SERVICE_KEY alias is maintained for backward compatibility and is auto-populated from SUPABASE_SERVICE_ROLE_KEY.

.env.example Usage

Always keep .env.example updated with safe placeholder values. - DO NOT commit the actual .env file. - Add new variables to app/core/config.py first, then update .env.example.

Back to Index