Set new OpenRouter API key

/ · 6/11/2026, 8:07:12 PM · 0 Files +0 -0
Export MD Export JSON
user opencode/deepseek-v4-flash-free
can you set a different api key? for openrouter?
grep — openrouter|api.key|api_key|OPENROUTER completed 0s

Input

{
  "pattern": "openrouter|api.key|api_key|OPENROUTER",
  "path": "/root/sandbox/jarvis"
}

Output

No files found
glob — **/* completed 0s

Input

{
  "pattern": "**/*",
  "path": "/root/sandbox/jarvis"
}

Output

/root/sandbox/jarvis/templates/index.html
/root/sandbox/jarvis/app.py
/root/sandbox/jarvis/test_jarvis.txt
/root/sandbox/jarvis/__pycache__/app.cpython-310.pyc
/root/sandbox/jarvis/cert.pem
/root/sandbox/jarvis/key.pem
read — /root/sandbox/jarvis/app.py completed 0s

Input

{
  "filePath": "/root/sandbox/jarvis/app.py"
}

Output

<path>/root/sandbox/jarvis/app.py</path>
<type>file</type>
<content>
1: #!/usr/bin/env python3
2: """JARVIS - Voice-to-text bridge. Transcribes speech, writes to file."""
3: 
4: import json
5: import os
6: import time
7: import uuid
8: from pathlib import Path
9: 
10: from faster_whisper import WhisperModel
11: from flask import Flask, jsonify, render_template, request
12: 
13: app = Flask(__name__)
14: 
15: whisper = WhisperModel("tiny", device="cpu", compute_type="int8")
16: 
17: OUTPUT_DIR = Path("/tmp/jarvis")
18: OUTPUT_DIR.mkdir(exist_ok=True)
19: 
20: INPUT_FILE = Path("/tmp/jarvis_input.txt")
21: 
22: 
23: def transcribe(audio_path):
24:     segments, _ = whisper.transcribe(audio_path, language="en")
25:     return " ".join(s.text for s in segments).strip()
26: 
27: 
28: @app.route("/")
29: def index():
30:     return render_template("index.html")
31: 
32: 
33: @app.route("/api/transcribe", methods=["POST"])
34: def transcribe_route():
35:     if "audio" not in request.files:
36:         return jsonify({"error": "no audio file"}), 400
37: 
38:     audio = request.files["audio"]
39:     suffix = Path(audio.filename).suffix or ".webm"
40:     tag = uuid.uuid4().hex
41:     audio_path = OUTPUT_DIR / f"in_{tag}{suffix}"
42:     audio.save(str(audio_path))
43: 
44:     try:
45:         text = transcribe(str(audio_path))
46:         if not text or len(text) < 3:
47:             return jsonify({"error": "No speech detected"}), 400
48: 
49:         # Write to shared input file
50:         timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
51:         INPUT_FILE.write_text(f"[{timestamp}] {text}\n")
52: 
53:         # Also write to the submitted queue for opencode
54:         submit_file = Path("/tmp/jarvis_submitted.txt")
55:         submit_file.write_text(text + "\n")
56: 
57:         return jsonify({"transcript": text})
58:     except Exception as e:
59:         app.logger.exception("transcribe error")
60:         return jsonify({"error": str(e)}), 500
61:     finally:
62:         try:
63:             audio_path.unlink(missing_ok=True)
64:         except OSError:
65:             pass
66: 
67: 
68: if __name__ == "__main__":
69:     cert_dir = Path(__file__).parent
70:     ssl_context = (str(cert_dir / "cert.pem"), str(cert_dir / "key.pem"))
71:     app.run(host="0.0.0.0", port=5050, debug=False, ssl_context=ssl_context)

(End of file - total 71 lines)
</content>
grep — OPENROUTER|api.key|openrouter|api_key completed 1s

Input

{
  "path": "/root",
  "pattern": "OPENROUTER|api.key|openrouter|api_key",
  "include": "*.{json,jsonc,yml,yaml,env,txt,md}"
}

Output

Found 24 matches
/root/.cache/opencode/models.json:
  Line 1: {"requesty":{"id":"requesty","env":["REQUESTY_API_KEY"],"npm":"@ai-sdk/openai-compatible","api":"https://router.requesty.ai/v1","name":"Requesty","doc":"https://requesty.ai/solution/llm-routing/models","models":{"xai/grok-4":{"id":"xai/grok-4","name":"Grok 4","family":"grok","attachment":true,"reasoning":true,"tool_call":true,"temperature":true,"knowledge":"2025-01","release_date":"2025-09-09","last_updated":"2025-09-09","modalities":{"input":["text","image"],"output":["text"]},"open_weights":false,"limit":{"context":256000,"output":64000},"cost":{"input":3,"output":15,"cache_read":0.75,"cache_write":3}},"xai/grok-4-fast":{"id":"xai/grok-4-fast","name":"Grok 4 Fast","family":"grok","attachment":true,"reasoning":true,"tool_call":true,"temperature":true,"knowledge":"2025-01","release_date":"2025-09-19","last_updated":"2025-09-19","modalities":{"input":["text"],"output":["text"]},"open_weights":false,"limit":{"context":2000000,"output":64000},"cost":{"input":0.2,"output":0.5,"cache_read":0.05,"cache_write":0.2}},"google/gemini-2.5-pro":{"id":"google/gemini-2.5-pro","name":"Gemini 2.5 Pro","family":"gemini-pro","attachment":true,"reasoning":true,"tool_call":true,"temperature":true,"knowledge":"2025-01","release_date":"2025-03-20","last_updated":"2025-06-05","modalities":{"input":["text","image","audio","video","pdf"],"output":["text"]},"open_weights":false,"limit":{"context":1048576,"output":65536},"cost":{"input":1.25,"output":10,"cache_read":0.31,"cache_write":2.375,"tiers":[{"input":2.5,"output":15,"cache_read":0.25,"tier":{"type":"context","size":200000}}],"context_over_200k":{"input":2.5,"output":15,"cache_read":0.25}}},"google/gemini-2.5-flash":{"id":"google/gemini-2.5-flash","name":"Gemini 2.5 Flash","family":"gemini-flash","attachment":true,"reasoning":true,"tool_call":true,"temperature":true,"knowledge":"2025-01","release_date":"2025-06-17","last_updated":"2025-06-17","modalities":{"input":["text","image","audio","video","pdf"],"output":["text"]},"open_weights"...

/root/.local/state/opencode/model.json:
  Line 6:     "openrouter/openrouter/free": "default",

  Line 7:     "openrouter/deepseek/deepseek-v4-flash:free": "default"


/root/.config/opencode/node_modules/jose/package.json:
  Line 80:       "default": "./dist/webapi/key/import.js"

  Line 84:       "default": "./dist/webapi/key/export.js"

  Line 88:       "default": "./dist/webapi/key/generate_key_pair.js"

  Line 92:       "default": "./dist/webapi/key/generate_secret.js"


/root/.config/opencode/opencode.jsonc:
  Line 3:   "model": "openrouter/deepseek/deepseek-v4-flash:free",

  Line 5:     "openrouter": {


/root/.npm/_npx/6de2aa2fded2970c/node_modules/agent-browser/README.md:
  Line 1415: export BROWSERBASE_API_KEY="your-api-key"

  Line 1423: export BROWSERBASE_API_KEY="your-api-key"

  Line 1438: export BROWSER_USE_API_KEY="your-api-key"

  Line 1446: export BROWSER_USE_API_KEY="your-api-key"

  Line 1452: Get yo

…truncated
read — /root/.config/opencode/opencode.jsonc completed 0s

Input

{
  "filePath": "/root/.config/opencode/opencode.jsonc"
}

Output

<path>/root/.config/opencode/opencode.jsonc</path>
<type>file</type>
<content>
1: {
2:   "$schema": "https://opencode.ai/config.json",
3:   "model": "openrouter/deepseek/deepseek-v4-flash:free",
4:   "provider": {
5:     "openrouter": {
6:       "options": {
7:         "apiKey": "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"
8:       },
9:       "models": {
10:         "deepseek/deepseek-r1:free": {
11:           "variants": {
12:             "reasoning": {
13:               "reasoningEffort": "high"
14:             }
15:           }
16:         }
17:       }
18:     }
19:   },
20:   "plugin": [
21:     "@theedgeofrage/opencode-telegram@latest",
22:     "@different-ai/opencode-browser",
23:     "opencode-codebase-index",
24:     "opencode-lore",
25:     "oh-my-opencode-slim"
26:   ]
27: }

(End of file - total 27 lines)
</content>
assistant 16401 tokens · Input 442 · Output 36

Sure, the current OpenRouter API key is in /root/.config/opencode/opencode.jsonc:7. What's the new key you want to set?

user opencode/deepseek-v4-flash-free
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
edit — /root/.config/opencode/opencode.jsonc completed 0s

Input

{
  "filePath": "/root/.config/opencode/opencode.jsonc",
  "oldString": "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",
  "newString": "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"
}

Output

Edit applied successfully.
assistant 16685 tokens · Input 139 · Output 24

Done. OpenRouter API key has been updated in /root/.config/opencode/opencode.jsonc.

user opencode/deepseek-v4-flash-free
nvidia/nemotron-3-ultra-550b-a55b:free only use this model 
edit — /root/.config/opencode/opencode.jsonc completed 0s

Input

{
  "filePath": "/root/.config/opencode/opencode.jsonc",
  "oldString": "\"model\": \"openrouter/deepseek/deepseek-v4-flash:free\"",
  "newString": "\"model\": \"openrouter/nvidia/nemotron-3-ultra-550b-a55b:free\""
}

Output

Edit applied successfully.
assistant 17048 tokens · Input 110 · Output 42

Done. Model is now set to nvidia/nemotron-3-ultra-550b-a55b:free in /root/.config/opencode/opencode.jsonc.

user opencode/deepseek-v4-flash-free
is this chat now using that?
assistant 17278 tokens · Input 35 · Output 36

No, this session started before the change and is still running on deepseek-v4-flash-free. The new model will take effect next time you restart opencode.

user opencode/deepseek-v4-flash-free
restart opencode
assistant 17179 tokens · Input 78 · Output 36

I can't restart myself from within the session. Exit with /exit or Ctrl+C, then run opencode again — it'll pick up the new model.