feat(agents): z.ai GLM coding plan provider + paperclip env passthrough

- opencode.nix: add zai-coding-plan provider (OpenAI-compatible coding-plan
  endpoint, apiKey via {env:ZAI_API_KEY}) with glm-5.3 (1M ctx) and
  glm-5-turbo — resolves in OpenCode itself, so Paperclip's opencode-harness
  agents can run on the GLM flat rate
- paperclip.nix: optional EnvironmentFile=%h/.config/paperclip.env so
  agents spawned by the service inherit provider keys
This commit is contained in:
m3tam3re committed 2026-09-25 08:19:52 +02:00
1 parent 800a356b66
commit a660e920b6
2 files changed
+36

No files matched your search

+32
View File
@@ -168,6 +168,38 @@
# AZ-Gruppe LiteLLM endpoint + available models
provider = {
# Z.AI GLM Coding Plan (flat-rate subscription).
# OpenAI-compatible endpoint; API key from the z.ai console is
# injected via {env:...} so it never lands in the store. Consumed by
# interactive opencode2 sessions (shell env) and by agents spawned
# through Paperclip's opencode harness (service EnvironmentFile).
zai-coding-plan = {
npm = "@ai-sdk/openai-compatible";
name = "Z.AI Coding Plan";
options = {
baseURL = "https://api.z.ai/api/coding/paas/v4";
apiKey = "{env:ZAI_API_KEY}";
};
models = {
# Primary worker: 1M ctx flat-rate model.
"glm-5.3" = {
name = "GLM-5.3";
limit = {
context = 1000000;
output = 128000;
};
};
# High-volume parallel scans: speed-tuned GLM on flat rate.
"glm-5-turbo" = {
name = "GLM-5 Turbo";
limit = {
context = 200000;
output = 128000;
};
};
};
};
litellm = {
npm = "@ai-sdk/openai-compatible";
name = "LiteLLM (AZ-Gruppe)";
@@ -40,6 +40,10 @@
"PAPERCLIP_INSTANCE_ID=default"
"PAPERCLIP_HOME=%h/.paperclip"
];
# Optional per-user env file (e.g. ZAI_API_KEY for the GLM coding
# plan) — inherited by agent harnesses spawned from the service.
# Leading '-' keeps the unit working when the file is absent.
EnvironmentFile = "-%h/.config/paperclip.env";
WorkingDirectory = "%h";
Restart = "always";
RestartSec = 5;