302.AIでは、glm-for-codingを使用することで、智譜モデルの3割引を享受できます。Claude Codeのインストールが完了したら、以下の方法でGLM For Codingモデルを使用するための環境変数を設定してください。macOS と Linux#
Windows#
価格:
入力: 0.086 PTC/1Mトークン
出力: 0.343 PTC/1Mトークン Request
Body Params application/json
{
"model": "glm-for-coding",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}
Request Code Samples
curl --location --request POST 'https://api.302.ai/v1/messages' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "glm-for-coding",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}'
Responses
application/json {
"id": "msg_202601261024413c3ec5f4e8ee4d94",
"type": "message",
"role": "assistant",
"model": "glm-for-coding",
"content": [
{
"type": "text",
"text": "你好!很高兴见到你。有什么我可以帮忙的吗?"
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 8,
"output_tokens": 12,
"cache_read_input_tokens": 0,
"server_tool_use": {
"web_search_requests": 0
},
"service_tier": "standard"
}
}
Modified at 2025-12-22 06:37:28