Text generation: Gemini 3.6 Flash (native Gemini format)
curl --request POST \
--url https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent \
--header 'Content-Type: application/json' \
--header 'x-goog-api-key: <api-key>' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Introduce yourself in one sentence"
}
]
}
]
}
'import requests
url = "https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent"
payload = { "contents": [
{
"role": "user",
"parts": [{ "text": "Introduce yourself in one sentence" }]
}
] }
headers = {
"x-goog-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-goog-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contents: [{role: 'user', parts: [{text: 'Introduce yourself in one sentence'}]}]
})
};
fetch('https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contents' => [
[
'role' => 'user',
'parts' => [
[
'text' => 'Introduce yourself in one sentence'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-goog-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Introduce yourself in one sentence\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-goog-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent")
.header("x-goog-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Introduce yourself in one sentence\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-goog-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Introduce yourself in one sentence\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"candidates": [
{
"content": {
"role": "<string>",
"parts": [
{}
]
},
"finishReason": "<string>",
"groundingMetadata": {}
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"thoughtsTokenCount": 123,
"totalTokenCount": 123
},
"modelVersion": "<string>"
}Gemini 3.6 Flash
Gemini 3.6 Flash ネイティブ API リファレンス
Gemini 3.6 Flash のネイティブ generateContent API リファレンスとインタラクティブなプレイグラウンド: 公式のリクエスト形式、検索グラウンディング、コード実行、URL コンテキストツール付き。
POST
/
v1beta
/
models
/
gemini-3.6-flash:generateContent
Text generation: Gemini 3.6 Flash (native Gemini format)
curl --request POST \
--url https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent \
--header 'Content-Type: application/json' \
--header 'x-goog-api-key: <api-key>' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Introduce yourself in one sentence"
}
]
}
]
}
'import requests
url = "https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent"
payload = { "contents": [
{
"role": "user",
"parts": [{ "text": "Introduce yourself in one sentence" }]
}
] }
headers = {
"x-goog-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-goog-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contents: [{role: 'user', parts: [{text: 'Introduce yourself in one sentence'}]}]
})
};
fetch('https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contents' => [
[
'role' => 'user',
'parts' => [
[
'text' => 'Introduce yourself in one sentence'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-goog-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Introduce yourself in one sentence\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-goog-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent")
.header("x-goog-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Introduce yourself in one sentence\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1beta/models/gemini-3.6-flash:generateContent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-goog-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Introduce yourself in one sentence\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"candidates": [
{
"content": {
"role": "<string>",
"parts": [
{}
]
},
"finishReason": "<string>",
"groundingMetadata": {}
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"thoughtsTokenCount": 123,
"totalTokenCount": 123
},
"modelVersion": "<string>"
}右側のプレイグラウンドを使ってください:
sk-your-api-key(APIYI token です。Google キーは不要です)を x-goog-api-key に設定します。デフォルトの例では thinking が low に設定されています。send を押すと応答が表示されます。Thinking はデフォルトで有効です。 コストを重視する呼び出しでは、
thinkingConfig: {"thinkingLevel": "minimal"} または {"thinkingBudget": 0} を渡してください。Search grounding、コード実行、URL コンテキスト、Maps ツールは、このネイティブ エンドポイントでのみ動作します。機能、料金、測定済みの thinking レベル: Gemini 3.6 Flash の概要.- ストリーミングを行う場合は URL を
:streamGenerateContent?alt=sseに変更してください(プレイグラウンドでは非ストリーミングを示しています) - コード実行は動作しますが、
executableCode/codeExecutionResultフィールドは現在エコーされません — 結果はテキスト本文に表示されます :countTokensと明示的な cache API(cachedContents)は、まだプラットフォームで有効になっていません
パラメータ早見表
| パラメータ | 型 | 必須 | 備考 |
|---|---|---|---|
contents | array | ✓ | 会話内容。parts は text と inlineData(base64 画像/PDF/音声/動画)を混在できます |
systemInstruction | object | システム指示 | |
generationConfig.thinkingConfig.thinkingLevel | string | minimal / low / medium / high、0/403/487/837 の thinking token 数で計測 | |
generationConfig.thinkingConfig.includeThoughts | bool | 思考部分をエコー(thought: true) | |
generationConfig.responseMimeType + responseSchema | 構造化出力(JSON Schema) | ||
tools | array | google_search / url_context / codeExecution / google_maps / functionDeclarations |
Response notes
- 思考コストは
usageMetadata.thoughtsTokenCountに表示されます(出力として請求されます) - グラウンディングソースは
candidates[0].groundingMetadataに表示されます; URL コンテキストはurlContextMetadataに表示されます - 暗黙のキャッシュヒットは
usageMetadata.cachedContentTokenCountに表示されます(確率的なもので、頼りにしないでください)
承認
APIYI token, the sk- prefixed key
ボディ
application/json
Conversation contents; parts can mix modalities
Show child attributes
Show child attributes
System instruction
Show child attributes
Show child attributes
Generation config
Show child attributes
Show child attributes
Tools: google_search / url_context / codeExecution / functionDeclarations, etc.
このページは役に立ちましたか?
⌘I