Gemini 3.1 Pro
복잡한 프로그래밍 과제, 방대한 자료 분석, 정확한 다단계 도구 작업을 위한 Google 멀티모달 모델입니다.
- Ailoot · Anthropic Messages
POST /v1/messagesgemini-3.1-pro - Ailoot · Gemini generateContent
POST /v1beta/models/{model}:generateContentgemini-3.1-pro
모델 소개
이 설명은 모델의 기능을 다룹니다. Ailoot에서 사용할 수 있는 입력, 출력 및 옵션은 아래에 선택한 메서드별로 표시됩니다.
Gemini 3.1 Pro Preview는 복잡한 자료와 여러 차례의 순차적인 판단이 필요한 과제를 위한 모델입니다. Google은 소프트웨어 엔지니어링, 도구 사용, 사실적 응답의 일관성을 강조합니다. 모델은 큰 데이터셋, 전체 소프트웨어 저장소, 텍스트와 시각 또는 오디오 자료가 결합된 과제의 분석을 돕습니다.
모델이 이해하는 자료
Google 사양에는 텍스트, 이미지, 동영상, 오디오, PDF가 나열되어 있습니다. 현재 Ailoot API 카탈로그의 텍스트 호출 방식에는 텍스트와 이미지 입력, 텍스트 출력이 명시되어 있습니다. 동영상, 오디오, PDF는 이 입력 구성에 포함되지 않습니다. 긴 컨텍스트에는 최대 1 048 576 입력 토큰, 텍스트 응답에는 최대 65 536 출력 토큰이 들어갑니다. 이미지와 오디오의 이해가 이들의 생성을 뜻하지는 않습니다. 이 버전의 출력은 텍스트입니다.
추론과 단계별 작업
Thinking은 내부 추론에 추가적인 노력을 배정할 수 있게 합니다. Google이 설명한 기본 모델 모드의 기본 수준은 high이며, low, medium, high를 사용할 수 있습니다. 이러한 값은 Google의 기본 모델을 설명합니다. Ailoot API를 통한 모드와 제어의 이용 가능 여부는 선택한 호출 방식과 모델 변형에 따라 달라집니다. 주요 활용 사례에는 복잡한 프로그래밍, 알고리즘 개발, 전략적 계획, 단계적인 해결책 개선이 있습니다. 서로 관련된 여러 요구 사항을 고려하고 중간 결과를 다시 검토해야 할 때 특히 유용합니다.
모델의 기능에는 함수 호출, 코드 실행, 구조화 응답이 있습니다. 컨텍스트 캐싱, 검색 기반 그라운딩, Google Maps, 웹 주소의 내용 활용을 지원하며 배치 처리도 제공합니다. 이런 구성을 통해 모델이 데이터를 분석하고, 다음 도구를 선택하며, 최종 결과를 구성하는 과정을 만들 수 있습니다. 각 도구의 실제 이용 가능 여부는 모델을 사용하는 호출 방식에 따라 달라집니다.
버전과 특성
카드는 프리뷰 버전 gemini-3.1-pro-preview에 해당합니다. 기반 모델은 Gemini 3 Pro입니다. 개발사는 명령 셸과 사용자 정의 도구를 사용하는 과정에 초점을 맞춘 gemini-3.1-pro-preview-customtools를 별도 변형으로 명시합니다. 도구 선택 우선순위와 동작 특성은 일반 Preview 버전의 특성이 아닙니다.
기본 제품군의 공통적인 한계가 유지됩니다. 응답에는 허구의 정보가 포함될 수 있고, 개별 요청은 느리게 처리되거나 타임아웃으로 끝날 수 있습니다. 여러 단계의 추론, 큰 컨텍스트, 데이터 접근은 복잡한 과제를 처리하는 데 도움이 되지만, 생성된 모든 결론을 검증된 사실로 만드는 것은 아닙니다.
실제 활용 과제
실제 활용 과제
영어 기술 예제
Schedule dependent engineering work
Plan these tasks with two engineers, one task per engineer at a time: A takes 2 days; B takes 3 days after A; C takes 2 days after A; D takes 1 day after both B and C. No task may be split. Give a day-by-day allocation, earliest finish and dependency check.예상 결과
A two-engineer schedule, total elapsed days and a concise check that every prerequisite is satisfied.결과 확인
Neither B nor C starts before A ends, and D waits for both; recompute the claimed finish from the allocation.Ailoot · Anthropic Messages POST /v1/messages gemini-3.1-pro
gemini-3.1-pro시작하기
복잡한 프로그래밍 과제, 방대한 자료 분석, 정확한 다단계 도구 작업을 위한 Google 멀티모달 모델입니다.
- 허용 입력
- 텍스트 · 이미지
- 결과
- 텍스트
Ailoot에서 사용 가능 · 입력 및 메서드
Ailoot · Anthropic Messages POST /v1/messages
- 입력
text,image- 출력
text- 컨텍스트
- 1,048,576 tokens
- 최대 출력
- 65,536 tokens
- 출력 형식
- json 또는 SSE
| 필드 | 유형 | 요건 | 값과 한도 | 기본값 |
|---|---|---|---|---|
필드model | 유형string | 요건필수 | 값과 한도 gemini-3.1-pro | 기본값— |
필드messages | 유형message[] | 요건필수 | 값과 한도 최소 항목 수: 1 | 기본값— |
필드messages[].role | 유형string | 요건필수 | 값과 한도 user, assistant | 기본값— |
필드messages[].content | 유형string|content_block[] | 요건필수 | 값과 한도 | 기본값— |
필드system | 유형string|content_block[] | 요건선택 사항 | 값과 한도 | 기본값— |
필드max_tokens | 유형integer | 요건필수 | 값과 한도 최솟값: 1 한도 적용 대상: 선택한 모델/카드의 정확한 상한 | 기본값— |
필드stream | 유형boolean | 요건선택 사항 | 값과 한도 | 기본값false |
필드temperature | 유형number | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드top_p | 유형number | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드stop_sequences | 유형string[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드tools | 유형tool[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드tools[].name | 유형string | 요건선택 사항 | 값과 한도 적용 조건: 도구 지정됨 | 기본값— |
필드tools[].description | 유형string | 요건선택 사항 | 값과 한도 | 기본값— |
필드tools[].input_schema | 유형JSON_schema | 요건선택 사항 | 값과 한도 | 기본값— |
필드tool_choice | 유형object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드thinking.type | 유형string | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드thinking.budget_tokens | 유형integer | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드output_config.effort | 유형string | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드metadata | 유형object | 요건선택 사항 | 값과 한도 | 기본값— |
필드cache_control | 유형object | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
입력 자료 조합
텍스트 · UTF8 텍스트
messages[].content 또는 type=text 블록
텍스트 + 이미지
{type:image,source:{type:base64,media_type,data}} 또는 type=url인 소스
메서드 매개변수와 수명 주기
| 매개변수 | 명세 |
|---|---|
매개변수material_types | 명세text, image |
매개변수required | 명세model, messages, max_tokens |
매개변수optional_controls | 명세null |
매개변수content_type | 명세application/json |
매개변수text_file_material | 명세실제 UTF-8 콘텐츠를 텍스트로 삽입합니다. 파일 ID/URLs에는 별도의 정확한 지원이 필요합니다 |
수명 주기: exact retained published method
메서드 형식과 ID는 정확합니다. 공급자의 기능 지원과 요청 수락은 별개입니다.
요금
Ailoot 메서드 요금
POST /v1/messages- 입력
- US$0.002 / 1K
- 출력
- US$0.012 / 1K
- 캐시 읽기
- US$0.0002 / 1K
요청 길이별 가격 · Anthropic Messages
| 요청 크기 (토큰) | 입력 | 출력 | 캐시 읽기 | 캐시 쓰기 | 5분 캐시 | 1시간 캐시 |
|---|---|---|---|---|---|---|
| 요청 크기 (토큰)(0; 200,000] | 입력US$0.002 | 출력US$0.012 | 캐시 읽기US$0.0002 | 캐시 쓰기기본 요율: — | 5분 캐시기본 요율: — | 1시간 캐시기본 요율: — |
| 요청 크기 (토큰)(200,000; ∞) | 입력US$0.004 | 출력US$0.018 | 캐시 읽기US$0.0004 | 캐시 쓰기기본 요율: — | 5분 캐시기본 요율: — | 1시간 캐시기본 요율: — |
요금 단위는 1K 토큰당 USD입니다. 요금이 설정되지 않으면 이 메서드의 기본 요금을 상속합니다. «—»는 기본 요금이 설정되지 않았음을 뜻합니다.
Ailoot는 요청 전에 예상 금액을 미리 확보합니다. 결과를 받은 뒤 측정된 사용량을 기준으로 최종 요금을 정산합니다. 스트리밍 정산에는 최종 사용량 기록을 사용합니다. 금액 확보와 정산 방식 →
요청 예제
Ailoot · Anthropic Messages
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gemini-3.1-pro", "max_tokens": 1024, "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
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/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
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gemini-3.1-pro", "max_tokens": 1024, "messages": [{"role": "user", "content": [{"type": "text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["messages"][0]["content"].append({"type":"image","source":{"type":"base64","media_type":mime,"data":b64}})
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/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
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
import anthropic
import os
if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = anthropic.Anthropic(base_url="https://api.ailoot.ai", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
msg = client.messages.create(
model="gemini-3.1-pro",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis 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(msg.to_dict(mode="json"))
import Anthropic from "@anthropic-ai/sdk";
if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new Anthropic({ baseURL: "https://api.ailoot.ai", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const msg = await client.messages.create({
model: "gemini-3.1-pro",
max_tokens: 1024,
messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";
function saveResult(data, stem = "result") {
writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
console.log(JSON.stringify(data, null, 2));
const saveBlob = (encoded, suffix, label) => {
const raw = Buffer.from(encoded, "base64");
const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
const file = `${stem}-${label}.${ext}`;
writeFileSync(file, raw); console.log("Saved", file);
};
for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
for (const [i, item] of (data.output || []).entries()) {
console.log("Output", i, JSON.stringify(item));
if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
}
for (const [ci, candidate] of (data.candidates || []).entries()) {
for (const [pi, part] of (candidate.content?.parts || []).entries()) {
console.log("Candidate/part", ci, pi, JSON.stringify(part));
const blob = part.inlineData || part.inline_data;
if (blob?.data) {
const mime = blob.mimeType || blob.mime_type;
const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
}
}
}
}
saveResult(msg);
import anthropic,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=anthropic.Anthropic(base_url="https://api.ailoot.ai",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.messages.stream(model='gemini-3.1-pro',max_tokens=1024,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_message()
save_result(final.to_dict(mode="json"),"stream-result")
결과 수신 및 저장
Ailoot · 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 gemini-3.1-pro
메서드 경로 별칭
위에 표시된 메서드 경로를 사용하세요.
관련 호출용 ID
Ailoot · Gemini generateContent POST /v1beta/models/{model}:generateContent gemini-3.1-pro
gemini-3.1-pro시작하기
복잡한 프로그래밍 과제, 방대한 자료 분석, 정확한 다단계 도구 작업을 위한 Google 멀티모달 모델입니다.
- 허용 입력
- 텍스트 · 이미지
- 결과
- 텍스트
Ailoot에서 사용 가능 · 입력 및 메서드
Ailoot · Gemini generateContent POST /v1beta/models/{model}:generateContent
- 입력
text,image- 출력
text- 컨텍스트
- 1,048,576 tokens
- 최대 출력
- 65,536 tokens
- 출력 형식
- json 또는 지원되는 스트리밍
| 필드 | 유형 | 요건 | 값과 한도 | 기본값 |
|---|---|---|---|---|
필드path.model | 유형string | 요건필수 | 값과 한도 gemini-3.1-pro | 기본값— |
필드contents | 유형content[] | 요건필수 | 값과 한도 최소 항목 수: 1 | 기본값— |
필드contents[].role | 유형string | 요건선택 사항 | 값과 한도 user, model | 기본값— |
필드contents[].parts | 유형part[] | 요건필수 | 값과 한도 | 기본값— |
필드systemInstruction | 유형content | 요건선택 사항 | 값과 한도 | 기본값— |
필드generationConfig.maxOutputTokens | 유형integer | 요건선택 사항 | 값과 한도 최솟값: 1 모델에 따라 다름 | 기본값— |
필드generationConfig.temperature | 유형number | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드generationConfig.topP | 유형number | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드generationConfig.topK | 유형integer | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드generationConfig.stopSequences | 유형string[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드generationConfig.thinkingConfig.includeThoughts | 유형boolean | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드generationConfig.thinkingConfig.thinkingBudget | 유형integer | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드tools[].functionDeclarations | 유형function_declaration[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드toolConfig.functionCallingConfig.mode | 유형string | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드safetySettings | 유형object[] | 요건선택 사항 | 값과 한도 모델에 따라 다름 | 기본값— |
필드sessionId | 유형string | 요건선택 사항 | 값과 한도 | 기본값— |
입력 자료 조합
텍스트 · UTF8 텍스트
contents[].parts[].text
텍스트 + 이미지
parts[].inlineData={mimeType,data}
메서드 매개변수와 수명 주기
| 매개변수 | 명세 |
|---|---|
매개변수material_types | 명세text, image |
매개변수required | 명세contents |
매개변수optional_controls | 명세null |
매개변수content_type | 명세application/json |
매개변수text_file_material | 명세실제 UTF-8 콘텐츠를 텍스트로 삽입합니다. 파일 ID/URLs에는 별도의 정확한 지원이 필요합니다 |
수명 주기: exact retained published method
메서드 형식과 ID는 정확합니다. 공급자의 기능 지원과 요청 수락은 별개입니다.
요금
Ailoot 메서드 요금
POST /v1beta/models/{model}:generateContent- 입력
- US$0.002 / 1K
- 출력
- US$0.012 / 1K
- 캐시 읽기
- US$0.0002 / 1K
요청 길이별 가격 · Gemini generateContent
| 요청 크기 (토큰) | 입력 | 출력 | 캐시 읽기 | 캐시 쓰기 | 5분 캐시 | 1시간 캐시 |
|---|---|---|---|---|---|---|
| 요청 크기 (토큰)(0; 200,000] | 입력US$0.002 | 출력US$0.012 | 캐시 읽기US$0.0002 | 캐시 쓰기기본 요율: — | 5분 캐시기본 요율: — | 1시간 캐시기본 요율: — |
| 요청 크기 (토큰)(200,000; ∞) | 입력US$0.004 | 출력US$0.018 | 캐시 읽기US$0.0004 | 캐시 쓰기기본 요율: — | 5분 캐시기본 요율: — | 1시간 캐시기본 요율: — |
요금 단위는 1K 토큰당 USD입니다. 요금이 설정되지 않으면 이 메서드의 기본 요금을 상속합니다. «—»는 기본 요금이 설정되지 않았음을 뜻합니다.
Ailoot는 요청 전에 예상 금액을 미리 확보합니다. 결과를 받은 뒤 측정된 사용량을 기준으로 최종 요금을 정산합니다. 스트리밍 정산에는 최종 사용량 기록을 사용합니다. 금액 확보와 정산 방식 →
요청 예제
Ailoot · Gemini generateContent
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"contents": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["contents"]=[{"role":"user","parts":[{"text":"Summarize this material and quote supporting source passages.\n\n"+text}]}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1beta/models/gemini-3.1-pro:generateContent \
-H "x-goog-api-key: $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
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(json.loads(Path("result.json").read_text(encoding="utf-8")))
PY_RESULT
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"contents": [{"role": "user", "parts": [{"text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["contents"][0]["parts"].append({"inlineData":{"mimeType":mime,"data":b64}})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1beta/models/gemini-3.1-pro:generateContent \
-H "x-goog-api-key: $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
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(json.loads(Path("result.json").read_text(encoding="utf-8")))
PY_RESULT
from google import genai
from google.genai import types
import os
if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = genai.Client(
api_key=os.environ["AILOOT_API_KEY"],
http_options=types.HttpOptions(base_url="https://api.ailoot.ai"),
)
resp = client.models.generate_content(model="gemini-3.1-pro", contents="Explain the difference between an observation and a hypothesis 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(resp.to_json_dict())
import { GoogleGenAI } from "@google/genai";
if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const ai = new GoogleGenAI({ apiKey: process.env.AILOOT_API_KEY, httpOptions: { baseUrl: "https://api.ailoot.ai" } });
const resp = await ai.models.generateContent({ model: "gemini-3.1-pro", contents: "Explain the difference between an observation and a hypothesis in three sentences." });
import { writeFileSync } from "node:fs";
function saveResult(data, stem = "result") {
writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
console.log(JSON.stringify(data, null, 2));
const saveBlob = (encoded, suffix, label) => {
const raw = Buffer.from(encoded, "base64");
const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
const file = `${stem}-${label}.${ext}`;
writeFileSync(file, raw); console.log("Saved", file);
};
for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
for (const [i, item] of (data.output || []).entries()) {
console.log("Output", i, JSON.stringify(item));
if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
}
for (const [ci, candidate] of (data.candidates || []).entries()) {
for (const [pi, part] of (candidate.content?.parts || []).entries()) {
console.log("Candidate/part", ci, pi, JSON.stringify(part));
const blob = part.inlineData || part.inline_data;
if (blob?.data) {
const mime = blob.mimeType || blob.mime_type;
const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
}
}
}
}
saveResult(resp);
from google import genai
from google.genai import types
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=genai.Client(api_key=os.environ["AILOOT_API_KEY"],http_options=types.HttpOptions(base_url="https://api.ailoot.ai"))
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))
count=0
with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
for chunk in client.models.generate_content_stream(model='gemini-3.1-pro',contents="Explain observations and hypotheses in three sentences."):
payload=chunk.to_json_dict()
log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
save_result(payload,"stream-chunk-"+str(count))
count+=1
결과 수신 및 저장
Ailoot · Gemini generateContent
json 또는 지원되는 스트리밍
완료된 결과 모두 보관
반환된 완전한 응답, 파일, 콘텐츠 부분을 모두 보관하세요.
함수 호출, 사고 서명, 사용량을 포함한 모든 후보와 파트를 보존하세요. 스트림 청크를 순서대로 조합하세요.
원래 응답을 확인해야 할 경우
요청/응답 ID와 헤더를 보존하세요. 텍스트 작업을 조회하는 범용 URL은 제공되지 않습니다.
응답 필드
| 필드 | 유형 |
|---|---|
필드responseId | 유형string |
필드modelVersion | 유형string |
필드candidates[].content.parts[] | 유형text|inlineData|functionCall|other part |
필드candidates[].finishReason | 유형string |
필드usageMetadata | 유형object |
오류와 다음 단계
| 응답 | 조건 | 다음 단계 |
|---|---|---|
응답400 · invalid_request_error | 조건필수 필드, 자료 표현 방식 또는 파라미터 값이 올바르지 않음 | 다음 단계새 생성 요청 전에 표시된 필드를 수정하세요. |
별칭
모델 별칭
Ailoot gemini-3.1-pro
메서드 경로 별칭
위에 표시된 메서드 경로를 사용하세요.
관련 호출용 ID
FAQ · Gemini 3.1 Pro
- 어떤 입력과 결과를 사용할 수 있나요?
POST /v1/messages·gemini-3.1-pro:text,image→textPOST /v1beta/models/{model}:generateContent·gemini-3.1-pro:text,image→text- 요청은 어떤 필드를 사용하나요?
POST /v1/messages·gemini-3.1-pro:model,messages,system,max_tokens,stream,metadataPOST /v1beta/models/{model}:generateContent·gemini-3.1-pro:contents,systemInstruction,sessionId- 어떤 제한이 적용되나요?
POST /v1/messages·gemini-3.1-pro:ctx:1048576;max_out:65536;messages.min_items:1;max_tokens.minimum:1POST /v1beta/models/{model}:generateContent·gemini-3.1-pro:ctx:1048576;max_out:65536;contents.min_items:1