Setting up z.ai GLM 4.7 with Opencode
Why?
Still using z.ai GLM as my main model, I was looking at other harnesses for using the model. Opencode is an Open Source coding harness that supports z.ai. The harness still has UI problems, which is the main point of a harness, so I likely won't be using it in the near time. I wonder if it will ever get away from the fancy slop machine, but maybe if most of your time with a program is watching the model in it output text, then having some colourful distractions / blinking lights is attractive for people.
How it should look:

How it looks:

No option for making the UI monochrome:

Opencode has had some bad defaults in the name of user convenience, like sending all prompts to Groks free tier just for coming up with chat summaries for the UI. It seems that now the defaults don't do that anymore, but this weakens my trust in the harness.
Installation
Installing Opencode client just follows the default installation via npm.
Config setup
I did the model configuration within Opencode as outlined in the z.ai OpenCode instructions:
opencode auth login
and entered there a fresh API token from the z.ai API key page.
Afterwards I had to actively select the GLM 4.7 model.
Containerfile creating a container for CC-with-GLM4.7
The Containerfile I used for this harness is as follows:
FROM docker.io/library/debian:trixie-slim
# debian-trixie-slim
RUN <<EOF
apt update
# Install our packages
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y npm perl build-essential imagemagick git apache2 wireguard wget curl cpanminus liblocal-lib-perl ripgrep
EOF
RUN <<EOF
# Install opencode
npm install -g opencode-ai
# Set up our directories to be mountable from the outside
mkdir -p /work
mkdir -p /tools
mkdir -p /root/.config/opencode
# Now you need to login manually with opencode :-/
# opencode auth login
EOF
# Add claude to the search path
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin"
ENTRYPOINT ["bash"]
CMD ["-i"]
launched as
podman run --rm -it -v /home/corion/agents/claude/mailagent-meeting-setup:/work -v /home/corion/agents/opencode/.opencode:/root/.opencode -e IS_SANDBOX=1 -e FORCE_COLOR=0 opencode-runner:latest