opencode: use upstream juspay/oc home module (#105)

This commit is contained in:
Sridhar Ratnakumar 2026-03-12 18:18:51 -04:00 committed by GitHub
parent 26e12b1662
commit 667543ceca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 154 additions and 298 deletions

View file

@ -17,7 +17,7 @@
# "nixos-hardware"
"nix-index-database"
"nixvim"
"nix-ai-tools"
"oc"
"AI"
];
};

View file

@ -1,43 +1,12 @@
{ flake, lib, pkgs, ... }:
let
inherit (flake.inputs) AI;
juspayProvider = import ./juspay;
commandsDir = AI + "/commands";
autoCommands = if builtins.pathExists commandsDir then
lib.mapAttrs'
(fileName: _: lib.nameValuePair
(lib.removeSuffix ".md" fileName)
(commandsDir + "/${fileName}"))
(builtins.readDir commandsDir)
else { };
in
{ config, flake, pkgs, ... }:
{
programs.opencode = {
enable = true;
package = pkgs.opencode;
commands = autoCommands;
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 = [ ];
};
};
imports = [ flake.inputs.oc.homeModules.default ];
programs.opencode.package = flake.inputs.oc.packages.${pkgs.stdenv.hostPlatform.system}.default;
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

@ -1,9 +0,0 @@
{ 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

@ -1,15 +0,0 @@
let
models = import ./models.nix;
in
{
npm = "@ai-sdk/openai-compatible";
name = "Juspay";
options = {
baseURL = "https://grid.ai.juspay.net";
# HACK: hardcoded path to agenix secret. Should use XDG_RUNTIME_DIR but
# OpenCode's {file:...} doesn't support environment variable expansion.
apiKey = "{file:/run/user/1000/agenix/juspay-anthropic-api-key}";
timeout = 600000;
};
inherit models;
}

View file

@ -1,145 +0,0 @@
{
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

@ -10,7 +10,7 @@ in
imports = [
"${jumphost-nix}/module.nix"
"${homeMod}/claude-code/juspay.nix"
"${homeMod}/opencode/juspay.nix"
"${homeMod}/opencode"
];
programs.jumphost = {