Add opencode home-manager module for zest and pureintent (#103)

* Add opencode home-manager module for zest and pureintent

* Move claude-code Juspay config to separate module

* Add JUSPAY_API_KEY export for opencode
This commit is contained in:
Sridhar Ratnakumar 2026-03-11 13:56:30 -04:00 committed by GitHub
parent cea0595d60
commit f13b2406c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 231 additions and 28 deletions

View file

@ -10,6 +10,7 @@ in
flake.inputs.self.homeModules.darwin-only
"${homeMod}/gui/1password.nix"
"${homeMod}/claude-code"
"${homeMod}/opencode"
"${homeMod}/work/juspay.nix"

View file

@ -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"

View file

@ -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;
};
}

View file

@ -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}")"
'';
}

View file

@ -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 = [ ];
};
};
}

View file

@ -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}")"
'';
}

View file

@ -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;
}

View file

@ -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;
};
};
}

View file

@ -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";
};

View file

@ -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;
}