Imagen4-Fast 画像生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/imagen4-fast \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "a serene mountain landscape",
"aspect_ratio": "16:9",
"negative_prompt": "blurry, low quality",
"num_images": 1,
"seed": 0
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/imagen4-fast"
payload = {
"prompt": "a serene mountain landscape",
"aspect_ratio": "16:9",
"negative_prompt": "blurry, low quality",
"num_images": 1,
"seed": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'a serene mountain landscape',
aspect_ratio: '16:9',
negative_prompt: 'blurry, low quality',
num_images: 1,
seed: 0
})
};
fetch('https://api.sinancode.com/v1/generate/k/imagen4-fast', 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.sinancode.com/v1/generate/k/imagen4-fast",
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([
'prompt' => 'a serene mountain landscape',
'aspect_ratio' => '16:9',
'negative_prompt' => 'blurry, low quality',
'num_images' => 1,
'seed' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.sinancode.com/v1/generate/k/imagen4-fast"
payload := strings.NewReader("{\n \"prompt\": \"a serene mountain landscape\",\n \"aspect_ratio\": \"16:9\",\n \"negative_prompt\": \"blurry, low quality\",\n \"num_images\": 1,\n \"seed\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sinancode.com/v1/generate/k/imagen4-fast")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"a serene mountain landscape\",\n \"aspect_ratio\": \"16:9\",\n \"negative_prompt\": \"blurry, low quality\",\n \"num_images\": 1,\n \"seed\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/imagen4-fast")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"a serene mountain landscape\",\n \"aspect_ratio\": \"16:9\",\n \"negative_prompt\": \"blurry, low quality\",\n \"num_images\": 1,\n \"seed\": 0\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}画像生成 - Imagen
Imagen 4 Fast
Imagen4-Fast モデルを使用して画像を高速生成します(非同期)
POST
/
generate
/
k
/
imagen4-fast
Imagen4-Fast 画像生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/imagen4-fast \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "a serene mountain landscape",
"aspect_ratio": "16:9",
"negative_prompt": "blurry, low quality",
"num_images": 1,
"seed": 0
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/imagen4-fast"
payload = {
"prompt": "a serene mountain landscape",
"aspect_ratio": "16:9",
"negative_prompt": "blurry, low quality",
"num_images": 1,
"seed": 0
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'a serene mountain landscape',
aspect_ratio: '16:9',
negative_prompt: 'blurry, low quality',
num_images: 1,
seed: 0
})
};
fetch('https://api.sinancode.com/v1/generate/k/imagen4-fast', 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.sinancode.com/v1/generate/k/imagen4-fast",
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([
'prompt' => 'a serene mountain landscape',
'aspect_ratio' => '16:9',
'negative_prompt' => 'blurry, low quality',
'num_images' => 1,
'seed' => 0
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.sinancode.com/v1/generate/k/imagen4-fast"
payload := strings.NewReader("{\n \"prompt\": \"a serene mountain landscape\",\n \"aspect_ratio\": \"16:9\",\n \"negative_prompt\": \"blurry, low quality\",\n \"num_images\": 1,\n \"seed\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sinancode.com/v1/generate/k/imagen4-fast")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"a serene mountain landscape\",\n \"aspect_ratio\": \"16:9\",\n \"negative_prompt\": \"blurry, low quality\",\n \"num_images\": 1,\n \"seed\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/imagen4-fast")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"a serene mountain landscape\",\n \"aspect_ratio\": \"16:9\",\n \"negative_prompt\": \"blurry, low quality\",\n \"num_images\": 1,\n \"seed\": 0\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}Google DeepMind の Imagen 4 Fast モデルを使用して高速に画像を生成します。
主な特徴:
- 高速生成 - 標準 Imagen 4 より高速な生成
- 効率的 - 低レイテンシーアプリケーションに最適化
承認
API Tokenを使用して認証を行ってください
ボディ
application/json
タスクパラメータ
プロンプト(必須、最大5000文字)
Required string length:
1 - 5000例:
"a serene mountain landscape"
アスペクト比(オプション、デフォルト 16:9)
利用可能なオプション:
1:1, 16:9, 9:16, 3:4, 4:3 例:
"16:9"
ネガティブプロンプト(オプション)
例:
"blurry, low quality"
生成画像数(オプション、1-4枚、デフォルト1)
必須範囲:
1 <= x <= 4例:
1
シード値(オプション、整数型)
例:
0
レスポンス
OK
タスクID
例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I