ModelsSupportEnterpriseBlog
500+ AI Model API, All In One API.Just In CometAPI
Models API
Developer
Quick StartDocumentationAPI Dashboard
Resources
AI ModelsBlogEnterpriseChangelogAbout
2025 CometAPI. All right reserved.Privacy PolicyTerms of Service
Home/Models/Zhipu AI/GLM 5.1
Z

GLM 5.1

Input:$0.8/M
Output:$3.2/M
GLM-5.1 is the latest flagship model from Zhipu, with greatly enhanced coding capabilities and significantly improved long-term task performance. It can work continuously and autonomously for up to 8 hours in a single task, completing a complete closed loop from planning, execution to iterative optimization, and delivering engineering-grade results.
New
Commercial Use
Playground
Features
Pricing
API

Features for GLM 5.1

Explore the key features of GLM 5.1, designed to enhance performance and usability. Discover how these capabilities can benefit your projects and improve user experience.

Pricing for GLM 5.1

Explore competitive pricing for GLM 5.1, designed to fit various budgets and usage needs. Our flexible plans ensure you only pay for what you use, making it easy to scale as your requirements grow. Discover how GLM 5.1 can enhance your projects while keeping costs manageable.
Comet Price (USD / M Tokens)Official Price (USD / M Tokens)Discount
Input:$0.8/M
Output:$3.2/M
Input:$1/M
Output:$4/M
-20%

Sample code and API for GLM 5.1

Access comprehensive sample code and API resources for GLM 5.1 to streamline your integration process. Our detailed documentation provides step-by-step guidance, helping you leverage the full potential of GLM 5.1 in your projects.
POST
/v1/chat/completions
Python
JavaScript
Curl
from openai import OpenAI
import os

# Get your CometAPI key from https://www.cometapi.com/console/token
COMETAPI_KEY = os.environ.get("COMETAPI_KEY") or "<YOUR_COMETAPI_KEY>"
BASE_URL = "https://api.cometapi.com/v1"

client = OpenAI(base_url=BASE_URL, api_key=COMETAPI_KEY)

completion = client.chat.completions.create(
    model="glm-5.1",
    messages=[{"role": "user", "content": "Hello! Tell me a short joke."}],
)

print(completion.choices[0].message.content)

Python Code Example

from openai import OpenAI
import os

# Get your CometAPI key from https://www.cometapi.com/console/token
COMETAPI_KEY = os.environ.get("COMETAPI_KEY") or "<YOUR_COMETAPI_KEY>"
BASE_URL = "https://api.cometapi.com/v1"

client = OpenAI(base_url=BASE_URL, api_key=COMETAPI_KEY)

completion = client.chat.completions.create(
    model="glm-5.1",
    messages=[{"role": "user", "content": "Hello! Tell me a short joke."}],
)

print(completion.choices[0].message.content)

JavaScript Code Example

import OpenAI from "openai";

// Get your CometAPI key from https://www.cometapi.com/console/token
const COMETAPI_KEY = process.env.COMETAPI_KEY || "<YOUR_COMETAPI_KEY>";
const BASE_URL = "https://api.cometapi.com/v1";

const client = new OpenAI({
  apiKey: COMETAPI_KEY,
  baseURL: BASE_URL,
});

const completion = await client.chat.completions.create({
  model: "glm-5.1",
  messages: [{ role: "user", content: "Hello! Tell me a short joke." }],
});

console.log(completion.choices[0].message.content);

Curl Code Example

#!/bin/bash

# Get your CometAPI key from https://www.cometapi.com/console/token
# Export it as: export COMETAPI_KEY="your-key-here"

response=$(curl -s https://api.cometapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -d '{
    "model": "glm-5.1",
    "messages": [
      {
        "role": "user",
        "content": "Hello! Tell me a short joke."
      }
    ]
  }')

printf '%s\n' "$response" | python -c 'import json, sys; print(json.load(sys.stdin)["choices"][0]["message"]["content"])'

More Models

A

Claude Opus 4.6

Input:$4/M
Output:$20/M
Claude Opus 4.6 is Anthropic’s “Opus”-class large language model, released February 2026. It is positioned as a workhorse for knowledge-work and research workflows — improving long-context reasoning, multi-step planning, tool use (including agentic software workflows), and computer-use tasks such as automated slide and spreadsheet generation.
A

Claude Sonnet 4.6

Input:$2.4/M
Output:$12/M
Claude Sonnet 4.6 is our most capable Sonnet model yet. It’s a full upgrade of the model’s skills across coding, computer use, long-context reasoning, agent planning, knowledge work, and design. Sonnet 4.6 also features a 1M token context window in beta.
O

GPT-5.4 nano

Input:$0.16/M
Output:$1/M
GPT-5.4 nano is designed for tasks where speed and cost matter most like classification, data extraction, ranking, and sub-agents.
O

GPT-5.4 mini

Input:$0.6/M
Output:$3.6/M
GPT-5.4 mini brings the strengths of GPT-5.4 to a faster, more efficient model designed for high-volume workloads.
A

Claude Opus 4.7

A

Claude Opus 4.7

Input:$4/M
Output:$20/M
Most intelligent model for agents and coding
Q

Qwen3.6-Plus

Q

Qwen3.6-Plus

Input:$0.32/M
Output:$1.92/M
Qwen 3.6-Plus is now available, featuring enhanced code development capabilities and improved efficiency in multimodal recognition and inference, making the Vibe Coding experience even better.