For novelists and genre writers, moving generative AI offline represents creative autonomy: zero API token bills, total manuscript confidentiality without cloud telemetry, and complete freedom from puritanical content filters when writing dark fantasy, psychological thrillers, or explicit romance. Novelcrafter is arguably the premier workspace for long-form fiction authors, offering an unparalleled narrative engine with its Codex story bible, scene beat manager, and custom prompt builder.
However, running local models like Llama 3, Mistral, Qwen 2.5, or Command R inside Novelcrafter presents an immediate technical roadblock: Cross-Origin Resource Sharing (CORS) connection failures.
Because Novelcrafter runs in a secure HTTPS browser sandbox (https://app.novelcrafter.com), modern browser security blocks cross-origin fetch requests directed to unencrypted local machine ports (http://localhost:11434 or http://localhost:1234). Writers attempting this setup routinely encounter opaque "Failed to fetch," "Network Error," or empty model dropdowns.
At 365Finds, our technical assessment is clear: running local models inside Novelcrafter is both practical and sustainable for fiction production—provided you properly bridge the browser-to-local security perimeter and aggressively expand model context parameters. Here is the comprehensive configuration playbook to defeat CORS errors across Ollama and LM Studio, alongside our architectural recommendations for fiction generation.
Why the CORS Error Happens in Novelcrafter
To solve the connection failure, authors must understand the browser handshake:
- Origin Disparity: Novelcrafter operates over secure HTTPS from
https://app.novelcrafter.com. Your local model backends run over plain HTTP on loopback IP addresses (127.0.0.1orlocalhost). - Preflight Rejection: When Novelcrafter’s web interface attempts to query your local server (such as probing
GET /api/tagson Ollama orGET /v1/modelson LM Studio), the web browser sends a preflightOPTIONSrequest. - Missing Response Headers: Unless the local service explicitly replies with
Access-Control-Allow-Origin: https://app.novelcrafter.com(or a wildcard*), the browser instantly terminates the request at the network stack. Novelcrafter never sees the response, leading to a silent hang or a red error notification.
Fixing this requires configuring your local inference runner to explicitly trust Novelcrafter's origin domain.
Configuring Ollama: System-Level Origin Whitelisting
Ollama runs as a low-overhead background daemon. Because its HTTP server refuses web requests by default, you must inject the OLLAMA_ORIGINS environment variable.
1. Windows Setup
Windows executes Ollama as a startup background task accessible via the system tray.
- Shut Down Ollama: Right-click the Ollama llama icon in your Windows Taskbar System Tray and select Quit.
- Set the Persistent Environment Variable:
- Open PowerShell or Command Prompt as your standard user.
- Run the following command:
setx OLLAMA_ORIGINS "https://app.novelcrafter.com" - Alternative (GUI): Open the Start Menu, search for Edit environment variables for your account, click New under User Variables, set Variable Name to
OLLAMA_ORIGINS, and Variable Value tohttps://app.novelcrafter.com(or*if you use multiple local tools).
- Relaunch Ollama: Launch Ollama again from the Start Menu. It will now boot with cross-origin headers active.
2. macOS Setup
On macOS, GUI applications started by the operating system do not inherit .zshrc shell variables. You have two reliable launch options:
- Option A: System Service via Launchctl (Recommended)
- Open Terminal.
- Set the launch environment variable:
launchctl setenv OLLAMA_ORIGINS "https://app.novelcrafter.com" - Quit the Ollama icon from your top macOS menu bar and relaunch the app.
- Option B: Manual Terminal Execution
- Quit the Ollama menu bar app.
- In your Terminal, launch the daemon directly with the variable attached:
OLLAMA_ORIGINS="https://app.novelcrafter.com" ollama serve
3. Linux (Systemd Service) Setup
Linux installations typically run Ollama via systemd:
- Open the systemd override editor:
sudo systemctl edit ollama.service - Insert the following block under the Service definition:
[Service] Environment="OLLAMA_ORIGINS=https://app.novelcrafter.com" - Save the file and reload the daemon:
sudo systemctl daemon-reload sudo systemctl restart ollama
Configuring LM Studio: The UI-Native Local Server
LM Studio provides the friendliest visual environment for authors running quantized GGUF models. It includes a native graphical toggle to eliminate CORS restrictions.
- Open LM Studio: Launch the desktop application.
- Navigate to Local Server Settings:
- Click the Developer / Local Server tab (represented by the double-bracket or server icon on the left navigation bar).
- Ensure the app is in Developer/Power User mode if prompted.
- Activate Server Configuration:
- Locate the Server Settings card on the right or top sidebar.
- Toggle Enable CORS to ON. (This instructs the built-in HTTP server to emit all necessary permissive CORS headers).
- Toggle Just-in-Time Model Loading to ON. (This is critical: it lets Novelcrafter discover your entire local library of downloaded GGUFs without forcing you to pre-load a 16GB model into VRAM ahead of time).
- Set Port and Network Binding:
- Keep the default port at
1234. - Ensure the server binds to
127.0.0.1(Localhost) if running on the same computer.
- Keep the default port at
- Start the Engine: Click Start Server. The console log will confirm that the OpenAI-compatible REST server is active on
http://localhost:1234.
Connecting Local Runners Inside Novelcrafter
Once your runner is broadcasting with CORS permissions, configure Novelcrafter's AI Provider hub:
- Log into
https://app.novelcrafter.comand open your Project. - Navigate to Account Settings (gear icon) -> AI Connections / Providers.
- Click Add Connection and pick your respective runner:
| Connection Type | Endpoint URL | API Key Field | Model Population |
|---|---|---|---|
| Ollama | http://localhost:11434 | Leave blank | Automatic click on dropdown |
| LM Studio | http://localhost:1234/v1 (or http://localhost:1234) | Any text (e.g., lm-studio) | Populates from downloaded GGUFs |
| OpenAI Compatible | http://localhost:1234/v1 | Any placeholder text | Manual Model ID matching local alias |
Click Test Connection or refresh the model list. If CORS was configured properly, your downloaded open-source models will appear immediately in the dropdown list.
Crucial Browser Compatibility Caveat
- Recommended Browsers: Google Chrome, Microsoft Edge, and Mozilla Firefox handle HTTPS-to-HTTP loopback routing reliably.
- Avoid Apple Safari: Safari enforces rigid sandboxing against mixed secure-insecure loopback requests, frequently blocking local calls regardless of CORS headers.
- Brave Browser Note: If using Brave, the aggressive "Brave Shields" feature may intercept local loopback calls. Click the Lion icon in the URL bar and disable Shields for
app.novelcrafter.com.
The Critical Fiction Trap: Expanding Context Limits (num_ctx)
Getting the green connection checkmark is only half the battle. The most devastating silent failure fiction writers face when deploying local LLMs is context starvation.
The Problem
By default, Ollama and LM Studio often initialize models with conservative context ceilings (such as 2,048 or 4,096 tokens) to conserve system memory. However, Novelcrafter’s prose engine dynamically packages:
- The current chapter’s previous 1,500 words.
- Injected Codex character and world lorebook entries.
- Scene beat guidelines and author style instructions.
When this payload exceeds 4k tokens on an unconfigured local model, the runner silently truncates your history or fails with an out-of-memory exception. The author experiences amnesia: characters forget recent dialogue, narrative pacing breaks down, or the model loops repetitive phrases.
1. Extending Context in Ollama (Custom Modelfile)
To permanently lock an expanded context window into your chosen writing model, create an Ollama Modelfile:
- Create a plain text file named
Modelfileon your desktop. - Add your base model and the target context parameter (e.g., 16,384 or 32,768 tokens):
FROM llama3.1:8b PARAMETER num_ctx 16384 - Open Terminal/CMD and compile your dedicated authoring model:
ollama create llama3.1-novel -f Modelfile - In Novelcrafter, select your new
llama3.1-novelmodel.
2. Extending Context in LM Studio
- In LM Studio, click on your downloaded model in the Local Server or Chat view.
- In the right-hand Model Loader Settings, look for Context Length.
- Manually increase the slider from
2048or4096up to16384(or32768if your VRAM allows). - Reload the model into memory.
3. Tuning Novelcrafter Custom Model Parameters
In Novelcrafter’s Custom Model configuration pane, mirror these hardware limits:
- Context Limit: Set manually to match your engine allocation (e.g.,
16384). - Temperature: Set between
0.70and0.85for creative fiction prose (lower values cause clinical rigidity; higher values trigger hallucinated syntax). - Repetition Penalty: Set to
1.10–1.15to prevent local 7B/8B models from repeating stock sensory descriptors.
Hardware Reality and the 365Finds Institutional Verdict
Local fiction writing is liberating, but commercial realism demands honest appraisal of hardware overhead. Long context generation in local models demands dedicated VRAM for the KV (Key-Value) Cache:
| Hardware Class | Typical VRAM | Recommended Models | Practical Context Ceiling |
|---|---|---|---|
| Entry Level | 8 GB (RTX 3060/4060 laptop) | Llama 3.1 8B Q4_K_M; Mistral 7B Q4 | 8,192 tokens max |
| Mid-Tier Workhorse | 12 GB – 16 GB (RTX 4070 / Apple M-series 24GB) | Llama 3.1 8B Q8; Qwen 2.5 14B Q4 | 16,384 – 32,768 tokens |
| Enthusiast / Studio | 24 GB+ (RTX 3090/4090 / Apple M-series 64GB+) | Qwen 2.5 32B Q4; Command R 35B Q4 | 32,768+ tokens (Full Codex load) |
365Finds Recommendation: The Hybrid Author Pipeline
At 365Finds, we advise fiction authors not to treat local AI as an all-or-nothing dogmatic choice.
While open-weight 8B models have made remarkable strides, they still struggle with intricate, multi-threaded plot resolutions, subtextual irony, and vast cross-book continuity compared to premier frontier models like Claude 3.5 Sonnet or GPT-4o.
The winning strategy is a Hybrid Author Pipeline:
- Use Cloud Frontier Models for High-Level Architecture: Utilize Claude 3.5 Sonnet via OpenRouter for outlining 30-chapter story arcs, architecting the series Codex, and performing structural developmental editing.
- Route Uncensored & High-Volume Beats to Local Runners: Connect Novelcrafter to your CORS-configured Ollama or LM Studio instance for drafting gritty fight sequences, explicit romantic scenes, rapid sentence completions, and unlimited zero-cost prose brainstorming.
By mastering the OLLAMA_ORIGINS flag and LM Studio’s CORS toggle, you retain total sovereign control over your sensitive manuscripts while transforming Novelcrafter into an unrestricted, cost-free creative engine.