diff --git a/configurations/home/srid@zest.nix b/configurations/home/srid@zest.nix index f5f11c1..c50d8e1 100644 --- a/configurations/home/srid@zest.nix +++ b/configurations/home/srid@zest.nix @@ -10,6 +10,7 @@ in flake.inputs.self.homeModules.darwin-only "${homeMod}/gui/1password.nix" "${homeMod}/claude-code" + "${homeMod}/opencode" "${homeMod}/work/juspay.nix" diff --git a/configurations/nixos/pureintent/default.nix b/configurations/nixos/pureintent/default.nix index a534b33..5afb19f 100644 --- a/configurations/nixos/pureintent/default.nix +++ b/configurations/nixos/pureintent/default.nix @@ -19,6 +19,7 @@ in home-manager.sharedModules = [ "${homeMod}/work/juspay.nix" "${homeMod}/services/vira.nix" + "${homeMod}/opencode" # "${homeMod}/services/dropbox.nix" # "${homeMod}/services/obsidian.nix" diff --git a/modules/home/claude-code/default.nix b/modules/home/claude-code/default.nix index b5e6413..8c583b8 100644 --- a/modules/home/claude-code/default.nix +++ b/modules/home/claude-code/default.nix @@ -3,12 +3,10 @@ let inherit (flake.inputs) AI; in { - # Import the general home-manager module imports = [ "${AI}/nix/home-manager-module.nix" ]; - # Packages often used by Claude Code CLI home.packages = with pkgs; [ tree ]; @@ -16,10 +14,8 @@ in programs.claude-code = { enable = true; - # Use sandboxed version - package = flake.inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.claude; # see claude-sandboxed.nix + package = flake.inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.claude; - # Set the claude-code directory for auto-wiring autoWire.dir = AI; }; } diff --git a/modules/home/claude-code/juspay.nix b/modules/home/claude-code/juspay.nix new file mode 100644 index 0000000..c1d3e2c --- /dev/null +++ b/modules/home/claude-code/juspay.nix @@ -0,0 +1,24 @@ +{ flake, config, ... }: +let + inherit (flake) self; +in +{ + imports = [ + ../agenix.nix + ]; + + home.sessionVariables = { + ANTHROPIC_BASE_URL = "https://grid.ai.juspay.net"; + ANTHROPIC_MODEL = "claude-sonnet-4-5"; + CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = "1"; + }; + + age.secrets.juspay-anthropic-api-key.file = self + /secrets/juspay-anthropic-api-key.age; + + programs.zsh.initContent = '' + export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")" + ''; + programs.bash.initExtra = '' + export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")" + ''; +} diff --git a/modules/home/opencode/default.nix b/modules/home/opencode/default.nix new file mode 100644 index 0000000..efce836 --- /dev/null +++ b/modules/home/opencode/default.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: +let + juspayProvider = import ./juspay; +in +{ + programs.opencode = { + enable = true; + package = pkgs.opencode; + settings = { + model = "litellm/glm-latest"; + # Explore agent for fast codebase search/reading tasks + agent = { + explore = { + mode = "subagent"; + model = "litellm/open-fast"; + }; + }; + autoupdate = true; + provider = { + litellm = juspayProvider; + }; + mcp = { + deepwiki = { + type = "remote"; + url = "https://mcp.deepwiki.com/mcp"; + enabled = true; + }; + }; + plugin = [ ]; + }; + }; +} diff --git a/modules/home/opencode/juspay.nix b/modules/home/opencode/juspay.nix new file mode 100644 index 0000000..d22fe70 --- /dev/null +++ b/modules/home/opencode/juspay.nix @@ -0,0 +1,9 @@ +{ config, ... }: +{ + programs.zsh.initContent = '' + export JUSPAY_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")" + ''; + programs.bash.initExtra = '' + export JUSPAY_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")" + ''; +} diff --git a/modules/home/opencode/juspay/default.nix b/modules/home/opencode/juspay/default.nix new file mode 100644 index 0000000..14d6de1 --- /dev/null +++ b/modules/home/opencode/juspay/default.nix @@ -0,0 +1,13 @@ +let + models = import ./models.nix; +in +{ + npm = "@ai-sdk/openai-compatible"; + name = "Juspay"; + options = { + baseURL = "https://grid.ai.juspay.net"; + apiKey = "{env:JUSPAY_API_KEY}"; + timeout = 600000; + }; + inherit models; +} diff --git a/modules/home/opencode/juspay/models.nix b/modules/home/opencode/juspay/models.nix new file mode 100644 index 0000000..04458b5 --- /dev/null +++ b/modules/home/opencode/juspay/models.nix @@ -0,0 +1,145 @@ +{ + open-large = { + name = "open-large"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 202752; + output = 32000; + }; + }; + open-fast = { + name = "open-fast"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 196000; + output = 32000; + }; + }; + open-vision = { + name = "open-vision"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 262144; + output = 32000; + }; + }; + claude-opus-4-5 = { + name = "claude-opus-4-5"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 1000000; + output = 128000; + }; + }; + claude-opus-4-6 = { + name = "claude-opus-4-6"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 1000000; + output = 128000; + }; + }; + claude-sonnet-4-6 = { + name = "claude-sonnet-4-6"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 200000; + output = 64000; + }; + }; + claude-sonnet-4-5 = { + name = "claude-sonnet-4-5"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 200000; + output = 32000; + }; + }; + glm-flash-experimental = { + name = "glm-flash-experimental"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 262144; + output = 32000; + }; + }; + gemini-3-pro-preview = { + name = "gemini-3-pro-preview"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 1048576; + output = 65535; + }; + }; + gemini-3-flash-preview = { + name = "gemini-3-flash-preview"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 1048576; + output = 65535; + }; + }; + minimax-m2 = { + name = "minimax-m2"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 202752; + output = 32000; + }; + }; + glm-latest = { + name = "glm-latest"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 202752; + output = 32000; + }; + }; + kimi-latest = { + name = "kimi-latest"; + modalities = { + input = [ "text" "image" ]; + output = [ "text" ]; + }; + limit = { + context = 262000; + output = 32000; + }; + }; +} diff --git a/modules/home/work/juspay.nix b/modules/home/work/juspay.nix index 6c82e9c..86f1cef 100644 --- a/modules/home/work/juspay.nix +++ b/modules/home/work/juspay.nix @@ -1,18 +1,18 @@ # Juspay-specific configuration using the work jump host module -{ flake, config, ... }: +{ flake, ... }: let - inherit (flake) self; inherit (flake.inputs) jumphost-nix; + homeMod = flake.inputs.self + /modules/home; in { imports = [ "${jumphost-nix}/module.nix" - ../agenix.nix + "${homeMod}/claude-code/juspay.nix" + "${homeMod}/opencode/juspay.nix" ]; - # https://github.com/srid/jumphost-nix programs.jumphost = { enable = true; host = "vanjaram.tail12b27.ts.net"; @@ -31,25 +31,6 @@ in }; }; - # For Juspay LiteLLM AI configuration - home.sessionVariables = { - # ANTHROPIC_API_KEY set in initExtra via agenix (see below) - ANTHROPIC_BASE_URL = "https://grid.ai.juspay.net"; - ANTHROPIC_MODEL = "claude-sonnet-4-5"; - CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = "1"; # For GLM related bug - }; - age = { - secrets = { - juspay-anthropic-api-key.file = self + /secrets/juspay-anthropic-api-key.age; - }; - }; - programs.zsh.initContent = '' - export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")" - ''; - programs.bash.initExtra = '' - export ANTHROPIC_API_KEY="$(cat "${config.age.secrets.juspay-anthropic-api-key.path}")" - ''; - home.shellAliases = { jcurl = "curl --socks5 localhost:1080"; }; diff --git a/overlays/default.nix b/overlays/default.nix index 5efe3cc..1a4a71b 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -36,4 +36,5 @@ packageOverlays // { # Use claude-code from nix-ai-tools instead of nixpkgs claude-code = (nix-ai-tools self.system).claude-code; copilot-cli = (nix-ai-tools self.system).copilot-cli; + opencode = (nix-ai-tools self.system).opencode; }