DEV Community

Hagicode
Hagicode

Posted on • Originally published at docs.hagicode.com

GLM-5.1 Full Support and Gemini CLI Integration: HagiCode's Multi-Model Evolution

GLM-5.1 Full Support and Gemini CLI Integration: HagiCode's Multi-Model Evolution

This article introduces recent important updates to the HagiCode platform—comprehensive support for Zhipu AI's GLM-5.1 model, and the successful integration of Gemini CLI as the tenth Agent CLI. These two updates further strengthen the platform's multi-model capabilities and multi-CLI ecosystem.

Background

Time flies, and the development of large language models grows like bamboo in spring—shooting upward rapidly. Once we cheered for "an AI that can write code," but now we're in an era of multi-model collaboration and multi-tool integration. Is this interesting? Perhaps, after all, what developers need has never been just tools themselves, but a kind of composure that can adapt to different scenarios and switch flexibly.

As an AI-assisted coding platform, HagiCode has recently welcomed two major events: first, the comprehensive integration of Zhipu AI's GLM-5.1 model, and second, Gemini CLI officially becoming the tenth supported Agent CLI. These events are neither big nor small, but for the platform's improvement, they're certainly a good thing.

GLM-5.1 is Zhipu AI's latest flagship model. Compared to GLM-5.0, it has stronger reasoning capabilities, deeper code understanding, and smoother tool calling. More importantly, it's the first GLM model to support image input—what does this mean? It means users can directly take screenshots for the AI to see problems, without struggling to describe them. If you've used it, you understand this convenience.

At the same time, through the HagiCode.Libs.Providers architecture, HagiCode has successfully integrated Gemini CLI. This is the tenth Agent CLI, and honestly, reaching this point brings some sense of accomplishment.

It's worth mentioning that HagiCode's image upload feature allows users to communicate directly with AI through screenshots. Even when running GLM 4.7, the platform runs well and has already helped complete many important construction projects for the project. As for GLM-5.1? Naturally, it will go even further.

About HagiCode

The solution shared in this article comes from our practical experience in the HagiCode project. HagiCode is an open-source AI-assisted coding platform, designed to provide developers with a flexible and powerful AI programming assistant through multi-model and multi-CLI architecture design. Project address: github.com/HagiCode-org/site

Multi-CLI Architecture Design

One of HagiCode's core advantages is supporting multiple different AI programming CLI tools through a unified abstraction layer. The benefits of this design, when you get down to it, are just: new things can come in, old things can stay, and the code doesn't get messy. After all, everyone hopes life could be like this, right?

AIProviderType Enumeration

The platform defines supported CLI provider types through the AIProviderType enumeration:

public enum AIProviderType
{
    ClaudeCodeCli = 0,    // Claude Code CLI
    CodexCli = 1,          // GitHub Copilot Codex
    GitHubCopilot = 2,     // GitHub Copilot
    CodebuddyCli = 3,     // Codebuddy CLI
    OpenCodeCli = 4,      // OpenCode CLI
    IFlowCli = 5,         // IFlow CLI
    HermesCli = 6,        // Hermes CLI
    QoderCli = 7,         // Qoder CLI
    KiroCli = 8,          // Kiro CLI
    KimiCli = 9,          // Kimi CLI
    GeminiCli = 10,       // Gemini CLI (newly added)
}
Enter fullscreen mode Exit fullscreen mode

As you can see, Gemini CLI has joined this family as the tenth member. Each CLI has unique characteristics and applicable scenarios, and users can flexibly choose according to their needs. After all, all roads lead to Rome—some roads are just easier to walk, others a bit more winding.

Provider Architecture

HagiCode.Libs.Providers provides a unified Provider interface, making the integration of each CLI standardized and concise. Taking Gemini CLI as an example:

public class GeminiProvider : ICliProvider<GeminiOptions>
{
    private static readonly string[] DefaultExecutableCandidates = ["gemini", "gemini-cli"];
    private const string ManagedBootstrapArgument = "--acp";

    public string Name => "gemini";
    public bool IsAvailable => _executableResolver.ResolveFirstAvailablePath(DefaultExecutableCandidates) is not null;
}
Enter fullscreen mode Exit fullscreen mode

The benefits of this design are:

  • New CLI integration only requires implementing one Provider class
  • Unified lifecycle management and session pooling
  • Automated alias resolution and executable file lookup

When you get down to it, this design just simplifies complex things and makes life a little easier.

Provider Registry

The Provider Registry automatically handles alias mapping and registration:

if (provider is GeminiProvider)
{
    registry.Register(provider.Name, provider, ["gemini-cli"]);
    continue;
}
Enter fullscreen mode Exit fullscreen mode

This means users can call Gemini CLI using either gemini or gemini-cli, and the system will automatically recognize it. It's like having many friends—some call you by your formal name, some by your nickname, but either way, it's you.

GLM-5.1 Model Support

GLM-5.1 is Zhipu AI's latest flagship model, and HagiCode has completed comprehensive support for it.

Secondary Professions Catalog

HagiCode manages all supported models through the Secondary Professions Catalog. Here's the configuration for the GLM series:

Model ID Name SupportsImage Compatible CLI Families
glm-4.7 GLM 4.7 - claude, codebuddy, hermes, qoder, kiro
glm-5 GLM 5 - claude, codebuddy, hermes, qoder, kiro
glm-5-turbo GLM 5 Turbo - claude, codebuddy, hermes, qoder, kiro
glm-5.0 GLM 5.0 (Legacy) - claude, codebuddy, hermes, qoder, kiro
glm-5.1 GLM 5.1 true claude, codebuddy, hermes, qoder, kiro

The key features of GLM-5.1 can be summarized as:

  • Independent version identifier, without legacy baggage
  • First GLM model to support image input
  • Stronger reasoning capabilities and code understanding
  • Extensive multi-CLI compatibility

GLM-5.1 vs GLM-5.0

From a code perspective, the key differences between GLM-5.1 and GLM-5.0:

// GLM-5.0 (Legacy) - has special retention logic
private const string Glm50CodebuddySecondaryProfessionId = "secondary-glm-5-codebuddy";
private const string Glm50CodebuddyModelValue = "glm-5.0";

// GLM-5.1 - independent new model identifier
private const string Glm51SecondaryProfessionId = "secondary-glm-5-1";
private const string Glm51ModelValue = "glm-5.1";
Enter fullscreen mode Exit fullscreen mode

GLM-5.0 carries a "Legacy" mark, which is an old version identifier retained for backward compatibility. GLM-5.1 is a completely new independent version without any historical baggage. It's like some people always live in the past, while others travel light and walk faster.

Configuring GLM-5.1

Example configuration for using GLM-5.1 in HagiCode:

{
  "primaryProfessionId": "profession-claude-code",
  "secondaryProfessionId": "secondary-glm-5-1",
  "model": "glm-5.1",
  "reasoning": "high"
}
Enter fullscreen mode Exit fullscreen mode

Image Upload Feature

HagiCode's image support is implemented through the SupportsImage property of SecondaryProfession:

public class HeroSecondaryProfessionSettingDto
{
    public bool SupportsImage { get; set; }
}
Enter fullscreen mode Exit fullscreen mode

In the Secondary Professions Catalog, the configuration for GLM-5.1 is as follows:

{
  "id": "secondary-glm-5-1",
  "supportsImage": true
}
Enter fullscreen mode Exit fullscreen mode

This means users can directly upload screenshots for AI analysis, such as:

  • Screenshots of error messages
  • UI interface issues
  • Data visualization charts
  • Code execution results

No need to manually describe problems—just take a screenshot. Once you use this feature, you'll understand its convenience. After all, for some things, seeing is better than hearing a thousand descriptions.

Gemini CLI Integration

As the tenth Agent CLI, Gemini CLI is integrated into HagiCode through the standard Provider architecture.

Configuration Options

Gemini CLI supports rich configuration options:

public class GeminiOptions
{
    public string? ExecutablePath { get; set; }
    public string? WorkingDirectory { get; set; }
    public string? SessionId { get; set; }
    public string? Model { get; set; }
    public string? AuthenticationMethod { get; set; }
    public string? AuthenticationToken { get; set; }
    public Dictionary<string, string?> AuthenticationInfo { get; set; }
    public Dictionary<string, string?> EnvironmentVariables { get; set; }
    public string[] ExtraArguments { get; set; }
    public TimeSpan? StartupTimeout { get; set; }
    public CliPoolSettings? PoolSettings { get; set; }
}
Enter fullscreen mode Exit fullscreen mode

These options cover everything from basic configuration to advanced features, allowing users to flexibly configure according to their needs. After all, everyone's needs are different, and having flexibility is always good.

ACP Communication Protocol

Gemini CLI supports the ACP (Agent Communication Protocol), which is HagiCode's unified CLI communication standard. Through ACP, different CLIs can interact with the platform in a consistent manner, greatly simplifying integration work. When you get down to it, it's just unifying complex things so everyone can work a little easier.

Environment Configuration

To use Zhipu AI's models, you need to configure the corresponding environment variables.

Zhipu AI ZAI Platform

export ANTHROPIC_AUTH_TOKEN="your-zai-api-key"
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"
Enter fullscreen mode Exit fullscreen mode

Alibaba Cloud DashScope

export ANTHROPIC_AUTH_TOKEN="your-aliyun-api-key"
export ANTHROPIC_BASE_URL="https://coding.dashscope.aliyuncs.com/apps/anthropic"
Enter fullscreen mode Exit fullscreen mode

After configuration is complete, HagiCode can call the GLM-5.1 model normally. This task is neither difficult nor simple—just follow the steps.

HagiCode's Own Build Practice

Speaking of practice, the best example is HagiCode platform's own build process. HagiCode's development has already fully utilized AI capabilities:

Runs Well with GLM 4.7

HagiCode platform is well-optimized, so even using GLM 4.7 provides a good development experience. The platform has helped complete several important build projects, including:

  • Multi-CLI Provider integration
  • Image upload feature implementation
  • Documentation generation and content publishing

This is actually quite good—after all, not everyone needs to use the latest things. What suits you is best.

GLM-5.1 for Greater Efficiency

After upgrading to GLM-5.1, these capabilities will be further enhanced:

  • Stronger code understanding, reducing back-and-forth communication
  • More accurate dependency analysis, pointing in the right direction in one go
  • More efficient error diagnosis, quickly locating problems
  • Image input support, accelerating problem description

It's like upgrading from a bicycle to a car—you can reach the same destinations, just with different speed and comfort.

Multi-CLI Integration Best Practices

HagiCode.Libs.Providers provides a unified registration and usage mechanism:

services.AddHagiCodeLibs();

var gemini = serviceProvider.GetRequiredService<ICliProvider<GeminiOptions>>();
var codebuddy = serviceProvider.GetRequiredService<ICliProvider<CodebuddyOptions>>();
var hermes = serviceProvider.GetRequiredService<ICliProvider<HermesOptions>>();
Enter fullscreen mode Exit fullscreen mode

This dependency injection design makes using each CLI very concise, and also facilitates unit testing and mocking. After all, writing clean code is also a form of responsibility to yourself.

Notes

In actual use, there are a few things to note:

  1. API Key Configuration: Ensure ANTHROPIC_AUTH_TOKEN is correctly set, otherwise the model cannot be called
  2. Model Availability: GLM-5.1 requires enabling permissions at the corresponding model provider
  3. Image Feature: Only models with supportsImage: true can use the image upload feature
  4. CLI Installation: Before using Gemini CLI, ensure gemini or gemini-cli is in the system PATH

These are small things, but if small things aren't handled well, they can become big things. So pay attention to them.

Summary

Through comprehensive support for GLM-5.1 and successful integration of Gemini CLI, HagiCode has further strengthened its capabilities as a multi-model, multi-CLI AI programming platform. These updates not only provide users with more choices but also demonstrate HagiCode's forward-looking and extensible architecture design.

GLM-5.1's image support capability, combined with HagiCode's screenshot upload feature, makes "speaking through pictures" possible—greatly reducing the cost of problem description. And support for ten CLIs means users can flexibly choose the most suitable AI programming assistant based on their preferences and scenarios. After all, having more choices is always a good thing.

Most importantly, HagiCode platform's own build practice proves: even using GLM 4.7, the platform can run well and complete complex tasks; after upgrading to GLM-5.1, development efficiency will be further improved. It's like life—you don't necessarily have to pursue the best, what suits you is good. Of course, if you can become better while still being suitable, that's naturally even better.

If you're interested in a multi-model, multi-CLI AI programming platform, why not try HagiCode—open-source, free, and constantly evolving. Trying doesn't cost anything, and it might really suit you.

References


If this article helped you:

Original Article & License

Thanks for reading. If this article helped, consider liking, bookmarking, or sharing it.
This article was created with AI assistance and reviewed by the author before publication.

Top comments (0)