GLM 4 32B 0414
GLM-4-32B-0414는 엔지니어링 코드, 대화형 HTML/SVG 결과물, 검색 기반 보고서, JSON 함수 호출을 위한 Z.ai의 고정된 텍스트 버전입니다. 모델 카드는 구체적인 개발 워크플로와 애플리케이션이 제어하는 도구 루프를 보여 줍니다.
- Ailoot Ultra · OpenAI Chat
POST /v1/chat/completionsTHUDM/GLM-4-32B-0414 - Ailoot Ultra · Anthropic Messages
POST /v1/messagesTHUDM/GLM-4-32B-0414
모델 소개
이 설명은 모델의 기능을 다룹니다. Ailoot에서 사용할 수 있는 입력, 출력 및 옵션은 아래에 선택한 메서드별로 표시됩니다.
소개
GLM-4-32B-0414는 Z.ai의 GLM-4-0414 시리즈에 속하는 고정된 32B급 텍스트 버전입니다. 기반 모델은 합성 추론 자료를 포함한 15조 토큰으로 사전 학습되었습니다. 사후 학습은 대화 선호 정렬, 거부 샘플링, 강화 학습을 결합하여 지시 이행, 엔지니어링 코드, 함수 호출 역량을 개발합니다. 명시된 작업에는 소프트웨어 과제, 텍스트 결과물, 검색 기반 질문과 보고서가 포함됩니다. 입력과 출력은 텍스트이며, 생성 코드는 애플리케이션이 저장하고 실행할 때 실행 가능하거나 렌더링된 결과물이 됩니다.
추론 중심 GLM-Z1-32B-0414와 조사 중심 Rumination 모델은 별도로 명명된 버전입니다. 이 항목은 다른 릴리스의 사고 규칙을 대입하지 않고 GLM-4 모델 자체의 더 폭넓은 코드·도구 예시를 따릅니다.
활용 예시: 애니메이션 생성
제조사는 회전하는 육각형 안에서 움직이는 공을 프로그래밍하는 예시를 보여 줍니다. GLM-4-32B-0414 예시는 HTML을 사용하고 움직임, 충돌, 물리적 가정을 설명합니다. 이는 시뮬레이션용 코드이며 영상 생성 모드가 아닙니다. 비슷한 작업을 준비하려면 장면, 움직임 규칙, 충돌 동작, 목표 런타임을 제공하고 독립 실행 가능한 구현과 가정에 대한 설명을 요청하세요. 애플리케이션이 해당 코드를 실행하여 결과를 확인합니다.
활용 예시: 웹 디자인
예시에는 함수를 추가·제거하고 색상을 지정할 수 있는 사용자 정의 함수 그래프 그리기 인터페이스가 포함됩니다. 다른 예시는 학습 작업, 저장 공간 관리, 차트를 포함한 개인 통계를 HTML 페이지에 배치한 모바일 머신러닝 인터페이스를 구축합니다. 이는 컨트롤과 상태가 명시된 구체적인 프런트엔드 작업입니다.
유용한 출력을 얻으려면 각 컨트롤이 지원해야 할 동작과 화면에 표시할 데이터를 설명하세요. 인터페이스 요청에서는 페이지 코드와 함께 입력, 표시 상태, 결과 간의 관계를 요청할 수 있습니다. 다음 대화에서는 관찰된 렌더링 결과를 제공하고 명시된 동작을 보존하면서 특정 변경을 요청할 수 있습니다.
활용 예시: SVG 생성
제조사는 풍경과 언어 모델 학습 과정에 대한 설명을 포함한 SVG 일러스트레이션도 보여 줍니다. SVG는 구조화된 텍스트이므로 애플리케이션이 편집 가능한 벡터 결과물로 저장할 수 있습니다. 주제, 라벨, 레이아웃, 필요한 시각적 관계를 제공하세요. 일러스트레이션 코드를 무관한 긴 설명과 섞지 말고 SVG 마크업을 독립된 결과물로 요청하세요.
검색 기반 글쓰기
조사 글쓰기를 위해 카드는 검색 결과를 관찰 내용으로 제공하고 이를 복사하는 대신 구성하고 해석하도록 모델에 요청합니다. 지시는 관련 결과와 무관한 결과를 구분하고, 근거가 허용할 때 의미 있는 세부 사항을 우선하며, 읽기 쉬운 구조를 사용하고 사용자의 언어로 답하도록 안내합니다. 예시는 서사 기법, 주제, 그 효과를 다루는 아동문학 분석 보고서를 생성합니다.
실제 작업에서는 이름을 붙인 발췌문을 제공하고 명확한 질문을 중심으로 구성한 보고서를 요청할 수 있으며, 각 결론을 뒷받침하는 자료와 연결하도록 할 수 있습니다. 검색과 자료 수집은 주변 애플리케이션에서 이루어지고, 반환된 지문은 모델의 근거가 됩니다. 이는 문서를 비교하거나 제공한 조사 자료 모음으로 설명을 준비할 때도 유용합니다.
함수 호출
GLM-4-32B-0414는 JSON 인수를 사용하는 외부 도구 호출을 지원합니다. 모델이 함수와 인수를 지정하면 애플리케이션이 실행하고 결과를 관찰 내용으로 반환합니다. 제조사의 시연은 최종 응답을 생성할 때까지 이 루프를 반복합니다. 각 도구의 목적과 필수 필드를 설명하고 도구의 관찰 결과를 사용자의 지시와 구분하세요. 따라서 조회를 통해 후속 비교용 데이터를 제공할 수 있으며, 모델이 독립적으로 실시간 정보를 얻었다고 가장할 필요가 없습니다.
컨텍스트와 결과 계획하기
공개 설정은 max_position_embeddings를 32,768로 지정하며 rope_scaling 항목을 포함하지 않습니다. 제조사의 예시는 요청별 생성 길이를 사용하며 카드는 보편적인 출력 상한을 제시하지 않습니다. 관련 코드, 검색한 지문, 대화를 사용 중인 컨텍스트 안에 유지하고 최종 결과가 HTML, SVG, 코드 조각, JSON 인수, 보고서 중 무엇이어야 하는지 명시하세요. 이는 설명한 작업을 위해 생성한 텍스트 표현이며, 실행, 파일 생성, 외부 데이터 접근은 애플리케이션의 동작입니다.
실제 활용 과제
실제 활용 과제
영어 기술 예제
Generate an editable process diagram
Create self-contained SVG markup for a left-to-right process: Receive -> Validate -> Store. Use three labelled rectangles and two arrows; all labels must remain readable in a 720 by 180 viewBox. Use no scripts, external fonts or external images. Return SVG code and a brief explanation of how the arrows encode the required order.예상 결과
A standalone editable SVG code block with three named nodes and two directional arrows, followed by a short order explanation.결과 확인
Render the SVG locally and check the exact labels, arrow direction and absence of clipped text or external dependencies.Ailoot Ultra · OpenAI Chat POST /v1/chat/completions THUDM/GLM-4-32B-0414
THUDM/GLM-4-32B-0414시작하기
GLM-4-32B-0414는 엔지니어링 코드, 대화형 HTML/SVG 결과물, 검색 기반 보고서, JSON 함수 호출을 위한 Z.ai의 고정된 텍스트 버전입니다. 모델 카드는 구체적인 개발 워크플로와 애플리케이션이 제어하는 도구 루프를 보여 줍니다.
- 허용 입력
- 텍스트
- 결과
- 텍스트
Ailoot에서 사용 가능 · 입력 및 메서드
Ailoot Ultra · OpenAI Chat POST /v1/chat/completions
- 입력
text- 출력
text- 출력 형식
- json 또는 SSE
| 필드 | 유형 | 요건 | 값과 한도 | 기본값 |
|---|---|---|---|---|
필드model | 유형string | 요건필수 | 값과 한도 THUDM/GLM-4-32B-0414 | 기본값— |
필드messages | 유형message[] | 요건필수 | 값과 한도 최소 항목 수: 1 | 기본값— |
필드messages[].role | 유형string | 요건필수 | 값과 한도 예시: system, user, assistant, tool, function 조건: 이 역할들은 소스 코드의 호환 타입에 명시적으로 표현됩니다. 정확한 모델 역할 집합은 모델별로 다릅니다. 모델에 따라 다름 | 기본값— |
필드messages[].content | 유형string|content_part[]|null | 요건선택 사항 | 값과 한도 | 기본값— |
필드messages[].tool_calls | 유형tool_call[] | 요건선택 사항 | 값과 한도 | 기본값— |
필드messages[].tool_call_id | 유형string | 요건선택 사항 | 값과 한도 적용 조건: role=tool. 실제 반환된 ID를 사용하세요 | 기본값— |
필드messages[].name | 유형string | 요건선택 사항 | 값과 한도 | 기본값— |
필드messages[].reasoning_content | 유형string | 요건선택 사항 | 값과 한도 적용 조건: 이 모델이 추론을 사용하는 경우 실제 반환된 추론을 그대로 다음 요청에 다시 전달하세요 | 기본값— |
필드messages[].reasoning_details | 유형object|array | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드max_tokens | 유형integer | 요건선택 사항 | 값과 한도 최솟값: 1 모델에 따라 다름 | 기본값— |
필드max_completion_tokens | 유형integer | 요건선택 사항 | 값과 한도 최솟값: 1 모델에 따라 다름 | 기본값— |
필드stream | 유형boolean | 요건선택 사항 | 값과 한도 | 기본값false |
필드stream_options.include_usage | 유형boolean | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드temperature | 유형number | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드top_p | 유형number | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드stop | 유형string|string[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드tools | 유형function_tool[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드tools[].type | 유형string | 요건선택 사항 | 값과 한도 function 모델에 따라 다름 | 기본값— |
필드tools[].function.name | 유형string | 요건필수 | 값과 한도 적용 조건: 함수 도구 지정됨 | 기본값— |
필드tools[].function.description | 유형string | 요건선택 사항 | 값과 한도 | 기본값— |
필드tools[].function.parameters | 유형JSON_schema | 요건선택 사항 | 값과 한도 | 기본값— |
필드tool_choice | 유형string|object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드parallel_tool_calls | 유형boolean | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드response_format | 유형object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드reasoning_effort | 유형string | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드reasoning | 유형object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드service_tier | 유형string | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드instructions | 유형string | 요건선택 사항 | 값과 한도 호환성 필드 | 기본값— |
필드functions | 유형function[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드function_call | 유형string|object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드prompt_cache_options | 유형object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드modalities | 유형string[] | 요건선택 사항 | 값과 한도 text | 기본값— |
필드provider | 유형object | 요건선택 사항 | 값과 한도 조건: 이 Ultra 텍스트 경로에서는 provider.options가 거부됩니다 | 기본값— |
필드cache_control.ttl | 유형string | 요건선택 사항 | 값과 한도 조건: 실제 프롬프트 캐시 지정 위치에서는 1h가 거부됩니다 | 기본값— |
입력 자료 조합
텍스트 · UTF8 텍스트
messages[].content
메서드 매개변수와 수명 주기
| 매개변수 | 명세 |
|---|---|
매개변수content_type | 명세application/json |
매개변수required | 명세model, messages |
매개변수material_types | 명세text |
매개변수messages | 명세role/content 형식의 메시지 배열 |
매개변수file_material | 명세실제 UTF-8 문서를 텍스트로 그대로 삽입합니다. 파일 ID는 추정하지 않습니다 |
매개변수optional_controls | 명세stream, temperature, top_p, stop, max_tokens, max_completion_tokens, reasoning, response_format, tools, tool_choice |
매개변수control_scope | 명세모델별로 다름. 사용자 함수 도구와 호스팅 도구는 서로 다릅니다 |
매개변수output_modalities | 명세text |
매개변수hosted_operations | 명세false |
매개변수multimodal_input_binding | 명세null |
수명 주기: synchronous_or_streamed
정확한 모델 ID를 messages와 함께 보내세요.
컨텍스트 길이는 출력 상한이 아닙니다.
텍스트 파일은 텍스트를 그대로 제공할 수 있습니다. 이미지/오디오/파일 객체 입력에는 정확한 바인딩이 필요합니다.
요금
요금 정보는 요청 옵션을 추가하지 않습니다. 지원되는 매개변수는 선택한 메서드에 표시됩니다.
- 빠른 모드
- 미지정 빠른 모드를 선택한 경우
- Flex 모드
- 미지정 flex 모드를 선택한 경우
- 최대 추론 수준
- 미지정 최대 추론 수준에 default 조정값을 적용하는 경우
Ailoot 요금
설정별 가격
| 설정 | 요금표 | 요금 |
|---|---|---|
| 설정토큰의 기본 단가 | 요금표기본 요금 | 요금 입력 · 입력 토큰 $0.00014 / 1K 토큰 출력 · 출력 토큰 $0.00014 / 1K 토큰 입력 · 캐시 읽기 $0 / 1K 토큰 입력 · 캐시 쓰기 $0 / 1K 토큰 입력 · 캐시 쓰기, 1시간 — / 1K 토큰 |
Ailoot는 요청 전에 예상 금액을 미리 확보합니다. 결과를 받은 뒤 측정된 사용량을 기준으로 최종 요금을 정산합니다. 스트리밍 정산에는 최종 사용량 기록을 사용합니다. 금액 확보와 정산 방식 →
요청 예제
Ailoot Ultra · OpenAI Chat
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "THUDM/GLM-4-32B-0414", "messages": [{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}]}')
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
r=json.loads(Path("result.json").read_text())
for x in r.get("choices",[]):
if x.get("message",{}).get("content"): print(x["message"]["content"])
PY_RESULT
from openai import OpenAI
import os
if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.chat.completions.create(model='THUDM/GLM-4-32B-0414',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}])
import base64, json
from pathlib import Path
def save_result(data, stem="result"):
# Keep every field, including usage, IDs, reasoning and tool requests.
Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
print(json.dumps(data, ensure_ascii=False, indent=2))
def save_blob(encoded, suffix, label):
raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
file = Path(stem + "-" + label + "." + ext)
file.write_bytes(raw)
print("Saved", file)
for index, block in enumerate(data.get("content") or []):
print("Content", index, json.dumps(block, ensure_ascii=False))
for choice in data.get("choices") or []:
print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
for index, item in enumerate(data.get("output") or []):
print("Output", index, json.dumps(item, ensure_ascii=False))
if item.get("type") == "image_generation_call" and item.get("result"):
save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
for ci, candidate in enumerate(data.get("candidates") or []):
for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
blob = part.get("inlineData") or part.get("inline_data")
if blob and blob.get("data"):
mime = blob.get("mimeType") or blob.get("mime_type")
suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))
save_result(result.to_dict(mode="json"))
from openai import OpenAI
import os
from pathlib import Path
if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path
def save_result(data, stem="result"):
# Keep every field, including usage, IDs, reasoning and tool requests.
Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
print(json.dumps(data, ensure_ascii=False, indent=2))
def save_blob(encoded, suffix, label):
raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
file = Path(stem + "-" + label + "." + ext)
file.write_bytes(raw)
print("Saved", file)
for index, block in enumerate(data.get("content") or []):
print("Content", index, json.dumps(block, ensure_ascii=False))
for choice in data.get("choices") or []:
print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
for index, item in enumerate(data.get("output") or []):
print("Output", index, json.dumps(item, ensure_ascii=False))
if item.get("type") == "image_generation_call" and item.get("result"):
save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
for ci, candidate in enumerate(data.get("candidates") or []):
for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
blob = part.get("inlineData") or part.get("inline_data")
if blob and blob.get("data"):
mime = blob.get("mimeType") or blob.get("mime_type")
suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))
with client.chat.completions.stream(model='THUDM/GLM-4-32B-0414',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
for event in stream:
payload=event.to_dict(mode="json")
log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
print(json.dumps(payload,ensure_ascii=False))
final=stream.get_final_completion()
save_result(final.to_dict(mode="json"),"stream-result")
결과 수신 및 저장
Ailoot Ultra · OpenAI Chat
json 또는 SSE
완료된 결과 모두 보관
반환된 완전한 응답, 파일, 콘텐츠 부분을 모두 보관하세요.
각 선택지와 그 콘텐츠·도구 호출·추론을 모두 보존하세요. SSE에서는 선택지/도구 인덱스별로 증분을 조합하고 최종 종료 사유와 사용량을 유지하세요.
원래 응답을 확인해야 할 경우
요청/응답 ID와 헤더를 보존하세요. 텍스트 작업을 조회하는 범용 URL은 제공되지 않습니다.
응답 필드
| 필드 | 유형 |
|---|---|
필드choices[].index | 유형integer |
필드choices[].message.content | 유형string|null |
필드choices[].message.tool_calls | 유형tool_call[] |
필드choices[].message.reasoning_content | 유형string |
필드choices[].message.reasoning_details | 유형object|array |
필드choices[].finish_reason | 유형string|null |
필드usage | 유형object |
오류와 다음 단계
| 응답 | 조건 | 다음 단계 |
|---|---|---|
응답400 · invalid_request_error | 조건필수 필드, 자료 표현 방식 또는 파라미터 값이 올바르지 않음 | 다음 단계새 생성 요청 전에 표시된 필드를 수정하세요. |
별칭
모델 별칭
Ailoot Ultra THUDM/GLM-4-32B-0414
메서드 경로 별칭
위에 표시된 메서드 경로를 사용하세요.
관련 호출용 ID
Ailoot Ultra · Anthropic Messages POST /v1/messages THUDM/GLM-4-32B-0414
THUDM/GLM-4-32B-0414시작하기
GLM-4-32B-0414는 엔지니어링 코드, 대화형 HTML/SVG 결과물, 검색 기반 보고서, JSON 함수 호출을 위한 Z.ai의 고정된 텍스트 버전입니다. 모델 카드는 구체적인 개발 워크플로와 애플리케이션이 제어하는 도구 루프를 보여 줍니다.
- 허용 입력
- 텍스트
- 결과
- json · sse
Ailoot에서 사용 가능 · 입력 및 메서드
Ailoot Ultra · Anthropic Messages POST /v1/messages
- 입력
text- 출력
json,sse- 출력 형식
- JSON 또는 SSE
| 필드 | 유형 | 요건 | 값과 한도 | 기본값 |
|---|---|---|---|---|
필드model | 유형string | 요건필수 | 값과 한도 THUDM/GLM-4-32B-0414 | 기본값— |
필드messages | 유형message[] | 요건필수 | 값과 한도 | 기본값— |
필드messages[].role | 유형string | 요건필수 | 값과 한도 user, assistant | 기본값— |
필드messages[].content | 유형string | 요건필수 | 값과 한도 | 기본값— |
필드max_tokens | 유형integer | 요건필수 | 값과 한도 | 기본값— |
필드stream | 유형boolean | 요건선택 사항 | 값과 한도 | 기본값false |
입력 자료 조합
텍스트 · UTF-8 텍스트
messages[].content 문자열
메서드 매개변수와 수명 주기
| 매개변수 | 명세 |
|---|---|
매개변수content_type | 명세application/json |
매개변수required | 명세model, messages, max_tokens |
매개변수optional_controls | 명세stream |
매개변수material_types | 명세text |
매개변수text_file_material | 명세실제 UTF-8 문서를 읽고 그 텍스트를 지정된 입력 또는 메시지 콘텐츠 문자열에 넣으세요. |
수명 주기: synchronous_or_streamed
요금
요금 정보는 요청 옵션을 추가하지 않습니다. 지원되는 매개변수는 선택한 메서드에 표시됩니다.
- 빠른 모드
- 미지정 빠른 모드를 선택한 경우
- Flex 모드
- 미지정 flex 모드를 선택한 경우
- 최대 추론 수준
- 미지정 최대 추론 수준에 default 조정값을 적용하는 경우
Ailoot 요금
설정별 가격
| 설정 | 요금표 | 요금 |
|---|---|---|
| 설정토큰의 기본 단가 | 요금표기본 요금 | 요금 입력 · 입력 토큰 $0.00014 / 1K 토큰 출력 · 출력 토큰 $0.00014 / 1K 토큰 입력 · 캐시 읽기 $0 / 1K 토큰 입력 · 캐시 쓰기 $0 / 1K 토큰 입력 · 캐시 쓰기, 1시간 — / 1K 토큰 |
Ailoot는 요청 전에 예상 금액을 미리 확보합니다. 결과를 받은 뒤 측정된 사용량을 기준으로 최종 요금을 정산합니다. 스트리밍 정산에는 최종 사용량 기록을 사용합니다. 금액 확보와 정산 방식 →
요청 예제
Ailoot Ultra · Anthropic Messages
{
"model": "THUDM/GLM-4-32B-0414",
"max_tokens": 128,
"messages": [
{
"role": "user",
"content": "Summarize the incident report."
}
],
"stream": false
}set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 document}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json, os
from pathlib import Path
source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
raise SystemExit('Choose a document containing text')
payload = {'model': 'THUDM/GLM-4-32B-0414', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
Path('request.json').write_text(json.dumps(payload, ensure_ascii=False), encoding='utf-8')
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
-H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
PY_RESULT
import json, os
from pathlib import Path
source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
raise SystemExit('Choose a document containing text')
payload = {'model': 'THUDM/GLM-4-32B-0414', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
from urllib.request import Request, urlopen
from urllib.error import HTTPError
api_key = os.environ['AILOOT_API_KEY']
if not api_key.strip():
raise SystemExit('Set AILOOT_API_KEY before making a request')
headers = {'x-api-key': 'PLACEHOLDER_KEY', 'anthropic-version': '2023-06-01', 'Content-Type': 'application/json'}
headers['x-api-key'] = api_key
request = Request('https://api.ailoot.ai/v1/messages', data=json.dumps(payload, ensure_ascii=False).encode('utf-8'), headers=headers, method='POST')
try:
with urlopen(request, timeout=120) as response:
raw = response.read()
Path('response-headers.txt').write_text(str(response.headers), encoding='utf-8')
except HTTPError as error:
Path('result.json').write_bytes(error.read())
Path('response-headers.txt').write_text(str(error.headers), encoding='utf-8')
raise
Path('result.json').write_bytes(raw)
import json
from pathlib import Path
result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
결과 수신 및 저장
Ailoot Ultra · Anthropic Messages
JSON 또는 SSE
완료된 결과 모두 보관
반환된 완전한 응답, 파일, 콘텐츠 부분을 모두 보관하세요.
모든 콘텐츠 블록, 사고 서명, 실제 도구 사용 ID를 보존하세요. 모든 SSE 블록 증분을 조합하세요. 첫 텍스트 블록이 전체 출력은 아닙니다.
원래 응답을 확인해야 할 경우
요청/응답 ID와 헤더를 보존하세요. 텍스트 작업을 조회하는 범용 URL은 제공되지 않습니다.
응답 필드
| 필드 | 유형 |
|---|---|
필드id | 유형string |
필드model | 유형string |
필드content[] | 유형text|thinking|tool_use|other content block |
필드stop_reason | 유형string|null |
필드usage | 유형object |
오류와 다음 단계
| 응답 | 조건 | 다음 단계 |
|---|---|---|
응답400 · invalid_request_error | 조건필수 필드, 자료 표현 방식 또는 파라미터 값이 올바르지 않음 | 다음 단계새 생성 요청 전에 표시된 필드를 수정하세요. |
별칭
모델 별칭
Ailoot Ultra THUDM/GLM-4-32B-0414
메서드 경로 별칭
위에 표시된 메서드 경로를 사용하세요.
관련 호출용 ID
FAQ · THUDM/GLM-4-32B-0414
- 어떤 입력과 결과를 사용할 수 있나요?
POST /v1/chat/completions·THUDM/GLM-4-32B-0414:text→textPOST /v1/messages·THUDM/GLM-4-32B-0414:text→json,sse- 요청은 어떤 필드를 사용하나요?
POST /v1/chat/completions·THUDM/GLM-4-32B-0414:model,messages,stream,modalities,providerPOST /v1/messages·THUDM/GLM-4-32B-0414:model,messages,max_tokens,stream- 어떤 제한이 적용되나요?
POST /v1/chat/completions·THUDM/GLM-4-32B-0414:messages.min_items:1