Use CURSOR_API_KEY for LLM narrative env config#4
Merged
Conversation
Rename optional LLM env vars from OPENAI_* to CURSOR_*: - OPENAI_API_KEY -> CURSOR_API_KEY - OPENAI_MODEL -> CURSOR_MODEL - (new) CURSOR_API_BASE_URL (default https://api.openai.com/v1) The LLM client still hits an OpenAI-compatible /chat/completions endpoint, so a Cursor API key (or any OpenAI-compatible provider key) can be used by pointing CURSOR_API_BASE_URL at the right host. Updated config, llm service, .env.example files at repo root and backend/, and README. Co-authored-by: Mr T <trenchsheikh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rename the optional LLM-narrative env vars to use a Cursor-style naming, and make the upstream endpoint configurable so a Cursor API key (or any OpenAI-compatible provider key) can be used.
Env var changes
OPENAI_API_KEYCURSOR_API_KEYOPENAI_MODELCURSOR_MODELCURSOR_API_BASE_URL(defaulthttps://api.openai.com/v1)What changed
app/core/config.py:openai_api_key/openai_modelsettings replaced withcursor_api_key,cursor_model, plus a newcursor_api_base_url.app/services/underwriting/llm.py: builds the chat-completions URL fromcursor_api_base_urland authenticates withcursor_api_key. Behavior is unchanged when the key is unset (rule-based narrative is returned and the LLM never affects outcome / amount / APR)..env.exampleandbackend/.env.example: updated to the new variable names with explanatory comments.README.md: feature blurb, underwriting section, and config table updated to referenceCURSOR_API_KEY/CURSOR_API_BASE_URL/CURSOR_MODEL.Testing
pytest -q— all 15 tests pass.${CURSOR_API_BASE_URL}/chat/completionsAuthorization: Bearer ${CURSOR_API_KEY}is sentmodelfield usesCURSOR_MODELNotes
CURSOR_API_BASE_URLdefaults to OpenAI's host so existing deployments continue to work after just renaming the env var. Point it at any other OpenAI-compatible chat-completions endpoint to use a different provider.Slack Thread