feat: add gemini-cli to OpenClaw
This commit is contained in:
parent
509c824941
commit
74d98c0e52
2 changed files with 55 additions and 19 deletions
|
|
@ -29,7 +29,12 @@
|
||||||
gateway = {
|
gateway = {
|
||||||
port = 18789;
|
port = 18789;
|
||||||
bind = "loopback";
|
bind = "loopback";
|
||||||
trustedProxies = [ "::1" "127.0.0.1" "10.88.0.0/16" "10.89.0.0/16" ];
|
trustedProxies = [
|
||||||
|
"::1"
|
||||||
|
"127.0.0.1"
|
||||||
|
"10.88.0.0/16"
|
||||||
|
"10.89.0.0/16"
|
||||||
|
];
|
||||||
auth = {
|
auth = {
|
||||||
mode = "none";
|
mode = "none";
|
||||||
};
|
};
|
||||||
|
|
@ -42,7 +47,10 @@
|
||||||
discord = {
|
discord = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
token = "/run/secrets/openclaw-discord-token";
|
token = "/run/secrets/openclaw-discord-token";
|
||||||
allowFrom = [ "1178286690750693419" "*" ];
|
allowFrom = [
|
||||||
|
"1178286690750693419"
|
||||||
|
"*"
|
||||||
|
];
|
||||||
groupPolicy = "open";
|
groupPolicy = "open";
|
||||||
dmPolicy = "open";
|
dmPolicy = "open";
|
||||||
};
|
};
|
||||||
|
|
@ -71,7 +79,7 @@
|
||||||
mode = "merge";
|
mode = "merge";
|
||||||
providers.zai = {
|
providers.zai = {
|
||||||
baseUrl = "https://api.z.ai/api/coding/paas/v4";
|
baseUrl = "https://api.z.ai/api/coding/paas/v4";
|
||||||
apiKey = "e77f2c392cb942eca9d0407eebc75549.XG7ikxT2kBEQUPYx";
|
apiKey = config.sops.secrets."openclaw/glm_api_key".path;
|
||||||
models = [
|
models = [
|
||||||
{
|
{
|
||||||
id = "glm-4.7";
|
id = "glm-4.7";
|
||||||
|
|
@ -89,6 +97,25 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
providers.cli = {
|
||||||
|
api = "openai-completions";
|
||||||
|
baseUrl = "http://localhost:8045/cli/v1";
|
||||||
|
apiKey = config.sops.secrets."openclaw/master_api_key".path;
|
||||||
|
models = [
|
||||||
|
{
|
||||||
|
id = "gemini-3.1-pro-preview";
|
||||||
|
name = "gemini-3.1-pro-preview";
|
||||||
|
contextWindow = 1000000;
|
||||||
|
maxTokens = 65536;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
id = "gemini-3-flash-preview";
|
||||||
|
name = "gemini-3-flash-preview";
|
||||||
|
contextWindow = 128000;
|
||||||
|
maxTokens = 65536;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
skills.entries.mcporter.enabled = true;
|
skills.entries.mcporter.enabled = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
{ config, lib, pkgs, inputs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
@ -27,7 +33,7 @@ in
|
||||||
default = 18789;
|
default = 18789;
|
||||||
description = "Port to listen on";
|
description = "Port to listen on";
|
||||||
};
|
};
|
||||||
|
|
||||||
dataDir = mkOption {
|
dataDir = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "/var/lib/openclaw";
|
default = "/var/lib/openclaw";
|
||||||
|
|
@ -67,16 +73,18 @@ in
|
||||||
group = cfg.group;
|
group = cfg.group;
|
||||||
key = "searxng_brave_api_key";
|
key = "searxng_brave_api_key";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Ensure secrets exist in sops config, if not user needs to add them.
|
sops.secrets."openclaw/master_api_key" = {
|
||||||
# We assume secrets.yaml has these keys or user will map them.
|
owner = cfg.user;
|
||||||
# The user had /run/secrets/openclaw-discord-token before.
|
group = cfg.group;
|
||||||
|
key = "master_api_key";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.openclaw = {
|
systemd.services.openclaw = {
|
||||||
description = "OpenClaw AI Agent";
|
description = "OpenClaw AI Agent";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
|
|
@ -85,14 +93,6 @@ in
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = "10s";
|
RestartSec = "10s";
|
||||||
|
|
||||||
# Environment variables or config file generation
|
|
||||||
# OpenClaw seems to take config via a file or env vars.
|
|
||||||
# Based on previous flake, it used a config file.
|
|
||||||
# We can generate the config file in the ExecStartPre or rely on env vars if supported.
|
|
||||||
# The previous flake copied a config file.
|
|
||||||
|
|
||||||
# Let's verify how openclaw takes config.
|
|
||||||
# It used OPENCLAW_CONFIG_DIR, OPENCLAW_DATA_DIR, OPENCLAW_WORKSPACE_DIR env vars.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
|
|
@ -110,7 +110,7 @@ in
|
||||||
mkdir -p ${cfg.dataDir}/config
|
mkdir -p ${cfg.dataDir}/config
|
||||||
mkdir -p ${cfg.dataDir}/data
|
mkdir -p ${cfg.dataDir}/data
|
||||||
mkdir -p ${cfg.dataDir}/workspace
|
mkdir -p ${cfg.dataDir}/workspace
|
||||||
|
|
||||||
# Generate config.json
|
# Generate config.json
|
||||||
cat > ${cfg.dataDir}/config/openclaw.json <<EOF
|
cat > ${cfg.dataDir}/config/openclaw.json <<EOF
|
||||||
{
|
{
|
||||||
|
|
@ -175,6 +175,15 @@ in
|
||||||
{ "id": "glm-4.7", "name": "GLM 4.7", "reasoning": true, "contextWindow": 128000, "maxTokens": 128000 },
|
{ "id": "glm-4.7", "name": "GLM 4.7", "reasoning": true, "contextWindow": 128000, "maxTokens": 128000 },
|
||||||
{ "id": "glm-5", "name": "GLM 5", "reasoning": true, "contextWindow": 128000, "maxTokens": 128000 }
|
{ "id": "glm-5", "name": "GLM 5", "reasoning": true, "contextWindow": 128000, "maxTokens": 128000 }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"cli": {
|
||||||
|
"api": "openai-completions",
|
||||||
|
"baseUrl": "http://localhost:8045/cli/v1",
|
||||||
|
"apiKey": "$(cat ${config.sops.secrets."openclaw/master_api_key".path})",
|
||||||
|
"models": [
|
||||||
|
{ "id": "gemini-3.1-pro-preview", "name": "gemini-3.1-pro-preview", "contextWindow": 1000000, "maxTokens": 65536 },
|
||||||
|
{ "id": "gemini-3-flash-preview", "name": "gemini-3-flash-preview", "contextWindow": 128000, "maxTokens": 65536 }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue