izaart95-jpg/GLM-Free-API ? reverse-engineered prompt

Reverse engineered prompt

Build me a Go service that acts as a drop in proxy for chat.z.ai so I can use GLM models from tools that already speak OpenAI or Anthropic APIs.

I want one server with /v1/chat/completions and /v1/messages, plus a model list and a simple health check. It should handle both streaming and normal replies, use a bearer token for auth, and work without any browser automation. If possible, make it support agent mode too, so tool calls can be translated cleanly and sent back in a format the client understands.

It should also keep track of available models from Z.AI, fall back to a small built in list if needed, and support basic config through env vars like port, host, timeout, and optional ZAI token. I’d like a clean startup, helpful status info, and a simple way to run it locally with no complicated setup. If you need to check current docs or API behavior, look them up online first.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab