mirror of
https://github.com/srid/nixos-config.git
synced 2026-01-27 02:27:13 +08:00
LiteLLM + Claude Code configuration (#101)
This commit is contained in:
parent
ed2e86f942
commit
c7f82dce59
15 changed files with 151 additions and 156 deletions
|
|
@ -30,8 +30,10 @@ in
|
|||
rwx = [ "." ];
|
||||
env = [
|
||||
"HOME" # Needed for gcloud and claude to resolve ~/ paths for config/state files
|
||||
"CLAUDE_CODE_USE_VERTEX"
|
||||
# See juspay.nix
|
||||
"ANTHROPIC_MODEL"
|
||||
"ANTHROPIC_API_KEY"
|
||||
"ANTHROPIC_BASE_URL"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
19
modules/home/agenix.nix
Normal file
19
modules/home/agenix.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Debug agenix logs:
|
||||
# cat ~/Library/Logs/agenix/stdout
|
||||
# cat ~/Library/Logs/agenix/stderr
|
||||
{ flake, config, ... }:
|
||||
let
|
||||
inherit (flake.inputs) agenix;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
agenix.homeManagerModules.default
|
||||
];
|
||||
|
||||
# We use a separate SSH key for agenix decryption to avoid exposing the main
|
||||
# private key (which is in 1Password) to the filesystem.
|
||||
#
|
||||
# To provision this key once:
|
||||
# ssh-keygen -t ed25519 -f ~/.ssh/agenix
|
||||
age.identityPaths = [ "${config.home.homeDirectory}/.ssh/agenix" ];
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
# home.packages = [ pkgs._1password-cli ];
|
||||
# Using native CLI ^
|
||||
home.packages = lib.mkIf pkgs.stdenv.isDarwin [ pkgs._1password-cli ];
|
||||
# Using native CLI on Pop OS ^
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
# Juspay-specific configuration using the work jump host module
|
||||
{ flake, ... }:
|
||||
|
||||
|
||||
{ flake, config, ... }:
|
||||
let
|
||||
inherit (flake) self;
|
||||
inherit (flake.inputs) jumphost-nix;
|
||||
in
|
||||
{
|
||||
imports = [ "${jumphost-nix}/module.nix" ];
|
||||
imports = [
|
||||
"${jumphost-nix}/module.nix"
|
||||
../agenix.nix
|
||||
];
|
||||
|
||||
# https://github.com/srid/jumphost-nix
|
||||
programs.jumphost = {
|
||||
|
|
@ -25,26 +31,21 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# Mirroring configuration from https://github.com/juspay/vertex
|
||||
# For Juspay LiteLLM AI configuration
|
||||
home.sessionVariables = {
|
||||
# Enable Vertex AI integration
|
||||
CLAUDE_CODE_USE_VERTEX = "1";
|
||||
CLOUD_ML_REGION = "us-east5";
|
||||
ANTHROPIC_VERTEX_PROJECT_ID = "dev-ai-gamma";
|
||||
|
||||
# Optional: Disable prompt caching if needed
|
||||
DISABLE_PROMPT_CACHING = "1";
|
||||
|
||||
# Optional: Override regions for specific models
|
||||
VERTEX_REGION_CLAUDE_3_5_HAIKU = "us-central1";
|
||||
VERTEX_REGION_CLAUDE_3_5_SONNET = "us-east5";
|
||||
VERTEX_REGION_CLAUDE_3_7_SONNET = "us-east5";
|
||||
VERTEX_REGION_CLAUDE_4_0_OPUS = "europe-west4";
|
||||
VERTEX_REGION_CLAUDE_4_0_SONNET = "us-east5";
|
||||
VERTEX_REGION_CLAUDE_4_5_SONNET = "us-east5";
|
||||
|
||||
# Model configuration
|
||||
ANTHROPIC_BASE_URL = "https://grid.ai.juspay.net";
|
||||
ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
||||
ANTHROPIC_SMALL_FAST_MODEL = "claude-3-5-haiku";
|
||||
# ANTHROPIC_API_KEY set in initExtra via agenix (see below)
|
||||
};
|
||||
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}")"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue