# OpenCode

> הוספת NotHoly כספק בקובץ opencode.json.


הפקודה `notholy run opencode` צריכה את ה-CLI של NotHoly, מותקן ומחובר ([התקנת ה-CLI](/he/cli/install)), ואת OpenCode עצמו: `npm i -g @opencode/cli`. להגדרה הידנית שבהמשך מספיק מפתח API.

```bash
notholy run opencode
```

ההגדרות קיימות רק לאותה הרצה, על שרת OpenCode פרטי. הקבצים ושירות הרקע של OpenCode שלך נשארים כמו שהיו.

הפקודה `notholy connect opencode` כותבת את אותן הגדרות לקובץ `~/.config/opencode/opencode.json` ושומרת על שאר הספקים שלך. קודם היא יוצרת גיבוי, והפקודה `notholy connect opencode --undo` משחזרת אותו.

הפקודה `connect` גם מוסיפה את שרת ה-MCP `notholy` תחת `mcp` באותו קובץ, והפקודה `notholy run opencode` מעבירה את אותו שרת להרצה הזו בלבד. שתיהן משתמשות בנתיב המוחלט של ה-CLI הזה ובכניסה השמורה שלו.

## הגדרה ידנית

מוסיפים את הספק לקובץ `~/.config/opencode/opencode.json`. ב-Windows הקובץ הוא `%USERPROFILE%\.config\opencode\opencode.json`, ואם המשתנה `XDG_CONFIG_HOME` מוגדר, OpenCode מחפש שם.

```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "notholy/notholy-specter",
  "providers": {
    "notholy": {
      "name": "NotHoly",
      "env": ["NOTHOLY_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "https://api.notholy.com/v1" },
      "models": {
        "notholy-specter": { "name": "NotHoly Specter", "capabilities": { "tools": true, "input": ["text"], "output": ["text"], "reasoning": { "supported": true, "effort": ["low", "high", "max"] } }, "limit": { "context": 1048576, "output": 131072 } },
        "notholy-pulse": { "name": "NotHoly Pulse Flash", "capabilities": { "tools": true, "input": ["text", "image"], "output": ["text"], "reasoning": { "supported": true, "effort": ["low", "high", "max"] } }, "limit": { "context": 1048576, "output": 131072 } },
        "notholy-vector": { "name": "NotHoly Vector Flash 1017", "capabilities": { "tools": true, "input": ["text", "image"], "output": ["text"], "reasoning": { "supported": true, "effort": ["off", "low", "high", "max"] } }, "limit": { "context": 1048576, "output": 131072 } },
        "notholy-wisp": { "name": "NotHoly Wisp Flash", "capabilities": { "tools": true, "input": ["text", "image"], "output": ["text"], "reasoning": { "supported": true, "effort": ["off", "low", "high", "max"] } }, "limit": { "context": 1048576, "output": 131072 } }
      }
    }
  }
}
```

את המפתח שמים במשתנה `NOTHOLY_API_KEY`. ב-PowerShell הפקודה היא `$env:NOTHOLY_API_KEY = "nh_live_..."`. אם שירות הרקע של OpenCode כבר רץ, צריך להפעיל אותו מחדש, כי הוא קורא את המשתנה כשהוא עולה.

```bash
export NOTHOLY_API_KEY="nh_live_..."
opencode service restart
opencode models
```

המודלים של NotHoly מופיעים ברשימה הזו בשם `notholy/...`. כל רמה בשדה `effort` היא וריאנט שבוחרים בהוספה שלו למודל: `opencode run -m notholy/notholy-specter#<level> "..."`.

אם המגבלות או הרמות משתנות, אפשר להשוות אותן מול `GET /v1/models`.

## OpenCode 1

החבילה `opencode-ai` ב-npm היא OpenCode 1. היא מתעלמת מהשדה `providers`, ולכן צריך בשבילה את הגרסה הזו של הקובץ. אין לה שירות רקע, והיא קוראת את אותו משתנה.

```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "notholy/notholy-specter",
  "provider": {
    "notholy": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "NotHoly",
      "options": { "baseURL": "https://api.notholy.com/v1", "apiKey": "{env:NOTHOLY_API_KEY}" },
      "models": {
        "notholy-specter": { "name": "NotHoly Specter", "tool_call": true, "reasoning": true, "attachment": false, "modalities": { "input": ["text"], "output": ["text"] }, "limit": { "context": 1048576, "output": 131072 }, "variants": { "low": { "reasoningEffort": "low" }, "high": { "reasoningEffort": "high" }, "max": { "reasoningEffort": "max" } } },
        "notholy-pulse": { "name": "NotHoly Pulse Flash", "tool_call": true, "reasoning": true, "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] }, "limit": { "context": 1048576, "output": 131072 }, "variants": { "low": { "reasoningEffort": "low" }, "high": { "reasoningEffort": "high" }, "max": { "reasoningEffort": "max" } } },
        "notholy-vector": { "name": "NotHoly Vector Flash 1017", "tool_call": true, "reasoning": true, "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] }, "limit": { "context": 1048576, "output": 131072 }, "variants": { "off": { "reasoningEffort": "off" }, "low": { "reasoningEffort": "low" }, "high": { "reasoningEffort": "high" }, "max": { "reasoningEffort": "max" } } },
        "notholy-wisp": { "name": "NotHoly Wisp Flash", "tool_call": true, "reasoning": true, "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] }, "limit": { "context": 1048576, "output": 131072 }, "variants": { "off": { "reasoningEffort": "off" }, "low": { "reasoningEffort": "low" }, "high": { "reasoningEffort": "high" }, "max": { "reasoningEffort": "max" } } }
      }
    }
  }
}
```

אפשר לבדוק עם `opencode models notholy`. הפקודות `notholy run` וגם `notholy connect` עובדות עם שתי הגרסאות.

## הבא

- [ה-API של המודלים](/he/api/models)
