tfrere HF Staff commited on
Commit
aba5856
·
1 Parent(s): 0332cd4

docs(readme): add 3-step guide to fork the Space and wire OpenRouter

Browse files

- New "Run your own copy on a Hugging Face Space" section: duplicate the
Space, grab an OpenRouter key, paste it as a Space secret
- Fix the stale OPENAI_API_KEY hint in the local-dev snippet (we use
OPENROUTER_API_KEY)

Made-with: Cursor

Files changed (1) hide show
  1. README.md +11 -1
README.md CHANGED
@@ -93,7 +93,7 @@ Backend and frontend run as two separate processes in dev (Vite proxies `/api`,
93
  ```bash
94
  # terminal 1 — backend (Express + Hocuspocus on :8080)
95
  cd backend
96
- cp .env.example .env # fill in HF_TOKEN, OPENAI_API_KEY, ...
97
  npm install
98
  npm run dev
99
 
@@ -116,6 +116,16 @@ docker run -p 8080:8080 --env-file backend/.env collab-editor
116
 
117
  Then open http://localhost:8080.
118
 
 
 
 
 
 
 
 
 
 
 
119
  ## Scripts
120
 
121
  ### Backend (`cd backend`)
 
93
  ```bash
94
  # terminal 1 — backend (Express + Hocuspocus on :8080)
95
  cd backend
96
+ cp .env.example .env # fill in OPENROUTER_API_KEY, OAUTH_*, HF_TOKEN, ...
97
  npm install
98
  npm run dev
99
 
 
116
 
117
  Then open http://localhost:8080.
118
 
119
+ ### Run your own copy on a Hugging Face Space
120
+
121
+ Want your own editor with your own AI key? Three steps:
122
+
123
+ 1. **Duplicate the Space.** On https://huggingface.co/spaces/tfrere/research-article-template-editor, click `⋯ → Duplicate this Space`. Pick your namespace and visibility. HF copies the Dockerfile, the OAuth wiring and rebuilds the image automatically.
124
+ 2. **Get an OpenRouter API key.** Sign up at https://openrouter.ai and create a key under https://openrouter.ai/keys. The chat agent and the embed studio call OpenRouter through the [Vercel AI SDK](https://ai-sdk.dev/), so any model exposed by OpenRouter works (defaults to `anthropic/claude-sonnet-4`).
125
+ 3. **Add the key as a Space secret.** In your duplicated Space, go to `Settings → Variables and secrets → New secret`, name it `OPENROUTER_API_KEY` and paste the value. Optional: add `OPENROUTER_MODEL` as a public variable to override the default model. Save - the Space restarts and the AI features light up.
126
+
127
+ That's it. The HF OAuth app, the persistence dataset (`<your-space>-data`) and the Docker build are wired automatically by HF Spaces; you only need the OpenRouter key to unlock the AI side.
128
+
129
  ## Scripts
130
 
131
  ### Backend (`cd backend`)