glm-5.1 API
Use glm-5.1 on APISea for text generation and multi-turn chat with prompt-cache reads.
glm-5.1تسعير API لنموذج glm-5.1
جميع الأسعار بالدولار الأمريكي (USD). مقارنة أسعار APISea بالسعر الرسمي المعلن للوحدة نفسها.
| نوع الـ token | APISea | رسمي | وفّر |
|---|---|---|---|
| الإدخال لكل 1M رمز | $1.23 | $1.40 | −12% |
| الإدخال المخزّن مؤقتًا لكل 1M رمز | $0.2288 | $0.26 | −12% |
| الإخراج لكل 1M رمز | $3.87 | $4.40 | −12% |
ما هو glm-5.1؟
glm-5.1 is a Zhipu AI chat model in the GLM family, available through APISea for text generation and multi-turn conversations. Send messages with user, assistant, and system roles to provide instructions and conversation history. The model accepts up to 200,000 input tokens and generates up to 128,000 output tokens. APISea's OpenAI-compatible chat interface provides controls for output length, randomness, sampling, and stop sequences, with streaming or complete-response delivery.
Call it by setting the model parameter to glm-5.1 using your APISea key and the base URL https://api.apisea.ai/v1. Billing is pay-as-you-go and applies only to successful requests: input costs $1.23 per 1M tokens, cached input reads cost $0.2288 per 1M tokens, and output costs $3.87 per 1M tokens. The default configuration is about 12% below the provider list price, and prompt-cache reads offer a separate rate for cached input.
أبرز مزايا glm-5.1
Large Input Allowance
Provide up to 200,000 input tokens for text-generation and chat requests.
Long Output Allowance
Generate up to 128,000 output tokens. Use max_tokens to set a smaller generation cap for individual requests.
Prompt Cache Reads
The model supports prompt-cache reads, billed at $0.2288 per 1M tokens on APISea.
Configurable Chat Responses
The chat interface exposes temperature, top_p, and stop controls. Choose streaming output or receive the complete response at once.
كيفية استدعاء API الخاص بـ glm-5.1 في 4 خطوات
- 01
احصل على API key
سجّل الدخول إلى APISea، واشحن رصيدك بدءًا من $50، وأنشئ مفتاح sk-sea من وحدة التحكم.
- 02
اضبط عنوان URL الأساسي
استخدم https://api.apisea.ai/v1 عنوانًا أساسيًا في SDK أو عميل HTTP.
- 03
أرسل الطلب
استدعِ POST /v1/chat/completions مع "model": "glm-5.1" والمعلمات أدناه.
- 04
تعامل مع الاستجابة
اقرأ الاستجابة (أو استقبل الـ tokens بالتدفق باستخدام stream: true). يظهر الاستخدام والتكلفة في وحدة التحكم.
أمثلة على الطلبات
الوثائق: General Chat API (Default Streaming)curl https://api.apisea.ai/v1/chat/completions \
-H "Authorization: Bearer $APISEA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.1",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain what an AI API gateway does in two sentences."}
],
"stream": false
}'المعلمات
| المعلمة | النوع | مطلوب | افتراضي | الوصف |
|---|---|---|---|---|
model | string | مطلوب | gpt-5 | Model name |
messages | array | مطلوب | — | List of conversation messages |
role | string | مطلوب | user | Role type |
content | string | مطلوب | — | Message content |
temperature | number | اختياري | — | Controls output randomness, range 0-2 |
max_tokens | integer | اختياري | — | Maximum number of tokens to generate |
stream | boolean | اختياري | — | Whether to use streaming output |
top_p | number | اختياري | — | Nucleus sampling parameter, range 0-1 |
frequency_penalty | number | اختياري | — | Frequency penalty, range -2.0 to 2.0 |
presence_penalty | number | اختياري | — | Presence penalty, range -2.0 to 2.0 |
stop | string or array | اختياري | — | Stop sequences |
n | integer | اختياري | — | Number of completions to generate |
ما الذي يمكنك إنشاؤه باستخدام glm-5.1
Document-Based Assistance
Build a chat workflow that supplies document text alongside a user's question, within the 200,000-token input limit.
Multi-Turn Support Chat
Include prior user and assistant messages to maintain conversation context, and use a system message to define the assistant's role.
Long-Form Drafting
Request reports, guides, or other extended text drafts, with max_tokens set to match the desired output budget.
Internal Text Workflows
Create tools for summarizing, rewriting, or answering questions about supplied text through the same OpenAI-compatible chat interface.
نصائح للحصول على نتائج أفضل
- 01
Set the Model Explicitly
Set the model parameter to
glm-5.1rather than relying on the chat endpoint's default model. - 02
Cap Generated Tokens
Use max_tokens to bound response length and manage output-token spending. Keep the requested cap within the 128,000-token output limit.
- 03
Tune One Sampling Control
Start with temperature or top_p rather than adjusting both. Lower temperature values make output more deterministic; higher values increase randomness.
- 04
Budget Cache Reads Separately
Account for cached input reads at $0.2288 per 1M tokens instead of the standard input rate of $1.23 per 1M tokens. Check your integration's cache behavior rather than assuming every repeated prompt is a cache hit.
القيود ومعلومات مهمة
Input is limited to 200,000 tokens per request.
Output is limited to 128,000 tokens per request.
Generation can end at the configured token cap; inspect finish_reason for length-limited responses.
الأسئلة الشائعة حول API الخاص بـ glm-5.1
How much does glm-5.1 cost on APISea?
Input costs $1.23 per 1M tokens, cached input reads cost $0.2288 per 1M tokens, and output costs $3.87 per 1M tokens. APISea uses pay-as-you-go billing and bills only successful requests.
Is APISea's glm-5.1 price below the provider list price?
The default configuration is about 12% below the provider list price. Provider list rates are $1.40 per 1M tokens for input, $0.26 per 1M tokens for cached input reads, and $4.40 per 1M tokens for output.
How do I call glm-5.1 through the API?
Use https://api.apisea.ai/v1 as your OpenAI-compatible base URL and send a POST request to /chat/completions. Authenticate with your APISea key as a Bearer token, set model to glm-5.1, and supply a messages array.
Which generation parameters can I use?
The documented chat interface includes temperature, top_p, max_tokens, stream, frequency_penalty, presence_penalty, stop, and n. Set stream explicitly to choose streaming delivery or a complete response.
What are glm-5.1's token limits, and does it support caching?
The maximum input is 200,000 tokens, and the maximum output is 128,000 tokens. The model supports prompt-cache reads with a separate cached-input rate.
Can I use glm-5.1 commercially?
Commercial use is subject to the provider's terms. Review the applicable Zhipu AI terms and APISea terms before deploying it in a commercial product.
نماذج ذات صلة
glm-5
glm-5.2
glm-5.3
glm-5.3-flash
qwen-turbo
qwen3.6-flash
qwen3.6-plus
qwen3.7-flash
ابدأ التطوير باستخدام glm-5.1
مفتاح واحد، وادفع حسب الاستخدام بدءًا من $50؛ ولا تُحتسب الرسوم إلا على الطلبات الناجحة.