Gemini 3.8 Flash High
長期にわたるソフトウェアエンジニアリング、自律的なエージェント、知識を扱う複雑な作業に向けたGoogleのマルチモーダルモデルです。
- Ailoot · Anthropic メッセージ
POST /v1/messagesgemini-3.8-flash-high - Ailoot · Gemini generateContent
POST /v1beta/models/{model}:generateContentgemini-3.8-flash-high
モデルについて
この説明はモデルの機能を紹介するものです。Ailootで利用できる入力、出力、オプションは、選択したメソッドごとに以下に記載されています。
Gemini 3.8 Flashは、長いソフトウェアエンジニアリングのタスク、エージェントの処理、知識を扱う複雑な作業に向けられています。Googleは、Gemini 3.7 Flashを発展させ、一度の応答で終わらない処理を重視したモデルと説明しています。モデルは素材に戻り、ツールを使い、一連の手順を続けます。
分析できる素材
Googleが示す入力は、テキスト、画像、動画、音声、PDFです。現在のAiloot APIのカタログで、テキストのメソッドに公表されているのは、入力のテキストと画像と、テキストの出力です。動画、音声、PDFは、この入力範囲には含まれません。入力の上限は1 048 576トークン、出力は65 536トークンです。プログラムコードや構造化データを含むテキストの結果を生成します。画像や音声の作成は、このバージョンの機能には含まれません。
推論とツール
Thinkingのlow、medium、highに対応しています。Googleが説明する基本モデルのモードでは、標準のレベルはmediumです。これらの値はGoogleの基本モデルについての説明です。Ailoot APIでのモードと制御の利用可否は、選択したメソッドとモデルのバリエーションによって決まります。minimalには対応しておらず、指定するとエラーになります。推論の強度の調整は、段階の複雑さに合わせてモードを選ぶのに役立ちます。ただし、推論の強度が高い設定では、タスクの実行により多くのトークンを使う場合があります。
機能には、関数呼び出し、コードの実行、構造化された応答、コンテキストのキャッシュがあります。ファイル検索、検索による裏付け、Google Maps、ウェブアドレスの内容の読み取りを利用できます。バッチ処理に対応しています。コンピュータのインターフェースの制御はプレビュー機能です。モデルへのあらゆるアクセス方法が、完全なコンピュータ操作機能になるわけではありません。
用途と制限
メーカーは、ソフトウェアエンジニアリング、エージェントのタスク、情報を扱う複雑な処理を特徴として挙げています。長いコンテキストで大量の素材を渡し、ツールの機能で複数の関連する段階を構成できます。これらの特性はモデルの機能を説明するものです。具体的な機能や入力データは、対応する呼び出しメソッドによって決まります。
このバージョンは、2026年九月に安定版として公開されています。公称の知識の基準時点は2026年三月ですが、一部の分野では情報が2025年一月の水準にとどまる場合があります。架空の事実、遅延、タイムアウトが起こり得ます。推論量を増やしても誤りがなくなるわけではなく、推論の強度が低い設定も、一定の応答時間を約束するものではありません。
実用タスク
実用タスク
英語の技術例
Plan a safe field-renaming migration
A service stores customer.full_name; old clients send full_name and new clients send display_name. Plan a gradual migration that keeps old clients working while storage changes. Provide stages, rollback conditions and integration tests for mixed clients. Assume no migration tools or live database access; return the design and test scenarios only.期待される結果
A staged migration design with compatibility rules, rollback conditions and mixed-version test cases.結果の確認
Each stage specifies which field is read and written, including behavior when both fields are supplied.Ailoot · Anthropic メッセージ POST /v1/messages gemini-3.8-flash-high
gemini-3.8-flash-highはじめに
長期にわたるソフトウェアエンジニアリング、自律的なエージェント、知識を扱う複雑な作業に向けたGoogleのマルチモーダルモデルです。
- 対応する入力
- テキスト · 画像
- 結果
- テキスト
Ailootで利用可能 · 入力とメソッド
Ailoot · Anthropic メッセージ POST /v1/messages
- 入力の種類
text,image- 出力の種類
text- コンテキスト
- 1,048,576 tokens
- 最大出力
- 65,536 tokens
- 出力形式
- jsonまたはSSE
| フィールド | 種類 | 要件 | 値と制限 | デフォルト |
|---|---|---|---|---|
フィールドmodel | 種類string | 要件必須 | 値と制限 gemini-3.8-flash-high | デフォルト— |
フィールド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- 入力
- $0.00075 / 1K
- 出力
- $0.00375 / 1K
- キャッシュ読み取り
- $0.000075 / 1K
Ailootはリクエスト前に見積額を確保します。結果の取得後、実測使用量に基づいて最終料金を精算します。ストリーミング時の精算には最終の使用量記録を使用します。金額の確保と精算の仕組み →
リクエスト例
Ailoot · Anthropic メッセージ
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.8-flash-high", "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.8-flash-high", "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.8-flash-high",
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.8-flash-high",
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.8-flash-high',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 メッセージ
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.8-flash-high
メソッドパスのエイリアス
上記に表示されたメソッドパスを使用してください。
関連する呼び出し用ID
Ailoot · Gemini generateContent POST /v1beta/models/{model}:generateContent gemini-3.8-flash-high
gemini-3.8-flash-highはじめに
長期にわたるソフトウェアエンジニアリング、自律的なエージェント、知識を扱う複雑な作業に向けたGoogleのマルチモーダルモデルです。
- 対応する入力
- テキスト · 画像
- 結果
- テキスト
Ailootで利用可能 · 入力とメソッド
Ailoot · Gemini generateContent POST /v1beta/models/{model}:generateContent
- 入力の種類
text,image- 出力の種類
text- 出力形式
- jsonまたは対応するストリーミング
| フィールド | 種類 | 要件 | 値と制限 | デフォルト |
|---|---|---|---|---|
フィールドpath.model | 種類string | 要件必須 | 値と制限 gemini-3.8-flash-high | デフォルト— |
フィールド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- 入力
- $0.00075 / 1K
- 出力
- $0.00375 / 1K
- キャッシュ読み取り
- $0.000075 / 1K
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.8-flash-high: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.8-flash-high: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.8-flash-high", 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.8-flash-high", 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.8-flash-high',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.8-flash-high
メソッドパスのエイリアス
上記に表示されたメソッドパスを使用してください。
関連する呼び出し用ID
FAQ · Gemini 3.8 Flash High
- 利用できる入力と結果は何ですか?
POST /v1/messages·gemini-3.8-flash-high:text,image→textPOST /v1beta/models/{model}:generateContent·gemini-3.8-flash-high:text,image→text- リクエストはどの項目を使用しますか?
POST /v1/messages·gemini-3.8-flash-high:model,messages,system,max_tokens,stream,metadataPOST /v1beta/models/{model}:generateContent·gemini-3.8-flash-high:contents,systemInstruction,sessionId- どの制限が適用されますか?
POST /v1/messages·gemini-3.8-flash-high:ctx:1048576;max_out:65536;messages.min_items:1;max_tokens.minimum:1POST /v1beta/models/{model}:generateContent·gemini-3.8-flash-high:contents.min_items:1