Flux ウルトラ解像度
極限のディテールと解像度を備えた最高品質の画像生成。
✓ 4K解像度
✓ 極限のディテール
✓ RAW品質
✓ プロフェッショナル出力
認証
Doitong APIを通じてFlux Ultraにアクセスするには、Doitong APIキーを使用してください。GraphQLミューテーションまたはREST APIのヘッダーに含める必要があります。
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
クイックスタート
わずか数分でFlux Ultra APIを使い始めることができます。以下の手順に従って、最初のtext to imageを生成しましょう。
ステップ1:APIキーの取得
Doitongアカウントを登録し、ダッシュボードからAPIキーを発行します。
ステップ2:最初のリクエストを実行
以下のコード例を使用して、最初のAPI呼び出しを行います。
curl -X POST https://api.doitong.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "mutation Generate($input: GenerateInput!) { generate(input: $input) { id status type provider url metadata creditCost } }",
"variables": {
"input": {
"type": "IMAGE",
"provider": "flux-ultra",
"input": {
"text": "A futuristic city with flying cars and neon lights"
},
"options": {
"width": 1024,
"height": 1024
}
}
}
}'
const response = await fetch('https://api.doitong.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
query: `
mutation GenerateImage($input: ImageGenerationInput!) {
generateImage(input: $input) {
id
url
width
height
}
}
`,
variables: {
input: {
service: 'flux-ultra',
prompt: 'A futuristic city with flying cars and neon lights',
width: 1024,
height: 1024
}
}
})
});
const data = await response.json();
console.log('Image:', data.data.generateImage);
import requests
import json
url = "https://api.doitong.com/graphql"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
query = """
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
}
}
"""
variables = {
"input": {
"type": "IMAGE",
"provider": "flux-ultra",
"input": {
"text": "A futuristic city with flying cars and neon lights"
},
"options": {
"width": 1024,
"height": 1024
}
}
}
response = requests.post(url, json={
"query": query,
"variables": variables
}, headers=headers)
data = response.json()
print("Result:", data["data"]["generate"])
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
createdAt
}
}
# Variables
{
"input": {
"type": "IMAGE",
"provider": "flux-ultra",
"input": {
"text": "A futuristic city with flying cars and neon lights"
},
"options": {
"width": 1024,
"height": 1024,
"version": "flux-pro-1.1-ultra",
"quality": "high"
}
}
}
料金体系
Flux Ultra APIはクレジット制の料金モデルを採用しています。クレジットは、生成されるコンテンツの複雑さや長さに応じて消費されます。
| 機能 | クレジット | 説明 |
|---|---|---|
| 標準解像度 | 10-20 クレジット | 512x512 〜 1024x1024 ピクセル |
| 高解像度 | 30-50 クレジット | 2048x2048 ピクセル以上 |
APIエンドポイント
Flux Ultra APIは、統合されたGraphQLエンドポイントから利用可能です。
GraphQLエンドポイント
POST https://api.doitong.com/graphql
RESTエンドポイント
POST https://api.doitong.com/v1/text_to_image
パラメータ
Flux Ultra APIのリクエストで使用可能なパラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
service |
文字列 | Yes | サービス識別子: "flux-ultra" |
prompt |
文字列 | Yes | 生成内容のテキスト説明 |
width |
整数 | No | 画像の幅(ピクセル単位、デフォルト:1024) |
height |
整数 | No | 画像の高さ(ピクセル単位、デフォルト:1024) |
version |
文字列 | No | Model version: "flux-pro-1.1-ultra" |
webhookUrl |
文字列 | No | 完了通知を受け取るためのURL |
レスポンス形式
すべてのAPIレスポンスは、一貫した形式で返されます:
成功レスポンス
{
"data": {
"generateimage": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
完了レスポンス
{
"data": {
"generateimage": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.jpg",
"duration": null,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
エラーハンドリング
APIは標準的なHTTPステータスコードを使用し、詳細なエラーメッセージを返します。
一般的なエラーコード
| ステータスコード | エラータイプ | 説明 |
|---|---|---|
| 400 | Bad Request | Invalid parameters or malformed request |
| 401 | Unauthorized | Missing or invalid API key |
| 402 | Payment Required | Insufficient credits |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error, please retry |
エラーレスポンス形式
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhook
text to imageの生成が完了した際に、リアルタイムで通知を受け取ることができます。
Webhookの設定
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Webhookペイロード
{
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.jpg",
"service": "flux-ultra",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": null,
"width": 1920,
"height": 1080
}
}
Webhookのセキュリティ
すべてのWebhookリクエストには、検証用の署名ヘッダーが含まれています:
X-Doitong-Signature: sha256=abc123...
レート制限
公平な利用とシステムの安定性を確保するため、以下のレート制限が適用されます:
| プラン | リクエスト数/分 | 同時実行ジョブ数 | 1日あたりの制限 |
|---|---|---|---|
| 無料 | 10 | 1 | 100 |
| スターター | 30 | 3 | 1,000 |
| プロ | 60 | 10 | 10,000 |
| エンタープライズ | カスタム | カスタム | 無制限 |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
ベストプラクティス
1. プロンプトの最適化
最高の結果を得るために、明確で具体的なプロンプトを作成してください:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. 非同期処理のハンドリング
生成は非同期で行われます。適切なポーリングまたはWebhookを実装してください:
// Polling example
async function pollStatus(jobId) {
let status = 'processing';
while (status === 'processing') {
await sleep(2000); // Wait 2 seconds
const result = await checkJobStatus(jobId);
status = result.status;
}
return result;
}
3. エラーリカバリ
指数バックオフを用いたリトライロジックを実装してください:
async function retryWithBackoff(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
await sleep(Math.pow(2, i) * 1000);
}
}
}
4. クレジット使用状況の監視
サービスの中断を避けるため、クレジットの消費状況を追跡してください:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
今すぐ始めましょう
数千人の開発者がFlux Ultra APIを使用して素晴らしいコンテンツを作成しています