Flux Ultra Resolution

Ngā atahanga kounga teitei rawa atu me te taipitopito me te whakatau tino nui.

✓ Whakatau 4K

✓ Taipitopito tino nui

✓ Kounga RAW

✓ Hua ngaio

Whakamotuhēhē

Hei uru atu ki a Flux Ultra mā te API o Doitong, whakamahia tō kī API Doitong. Whauruhia ki te mutation GraphQL, ki ngā pane API REST rānei.

He Mea Nui: Tiakina pai tō kī API Doitong, kaua rawa e whakaaturia ki te waehere taha-kiritaki (client-side). Me kōkiri ngā karanga API katoa mai i tō tūmau tuara (backend).
// GraphQL Header
{
  "Authorization": "Bearer YOUR_API_KEY"
}

// REST Header
"X-API-Key": "YOUR_API_KEY"

Tīmata Tere

Tīmatahia te whakamahi i a Flux Ultra API i roto i te iti noa o te wā. Whāia ēnei takahanga māmā hei whakaputa i tō text to image tuatahi.

Takahanga 1: Tikina tō Kī API

Waitohu ki tētahi pūkete Doitong, ka haere ki tō papatohu hei whakaputa i tētahi kī API.

Takahanga 2: Kōkirihia tō Tono Tuatahi

Whakamahia tētahi o ngā tauira waehere i raro nei hei kōkiri i tō karanga API tuatahi.

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"
    }
  }
}

Utu

E whakamahi ana a Flux Ultra API i tētahi tauira utu i runga i te whiwhinga (credit). Ka pau ngā whiwhinga i runga i te uaua me te roa o te ihirangi ka whakaputaina.

Āhuatanga Whiwhinga Whakaahuatanga
Whakatau Paerewa 10-20 Whiwhinga 512x512 ki te 1024x1024 pika
Whakatau Teitei 30-50 Whiwhinga 2048x2048 pika, neke atu rānei

Ngā Pae API

E wātea ana a Flux Ultra API mā tō mātou pae GraphQL kōmitimiti.

Pae GraphQL

POST https://api.doitong.com/graphql

Pae REST

POST https://api.doitong.com/v1/text_to_image

Ngā Tawhā

Ngā tawhā e wātea ana mō ngā tono Flux Ultra API:

Tawhā Momo Me mātua whai Whakaahuatanga
service Pūāhua Yes Kaitohu Ratonga: "flux-ultra"
prompt Pūāhua Yes He whakaahuatanga tuhi o te mea hei whakaputa
width Tauoti No Te whānui o te atahanga i roto i te pika (taunoa: 1024)
height Tauoti No Te teitei o te atahanga i roto i te pika (taunoa: 1024)
version Pūāhua No Model version: "flux-pro-1.1-ultra"
webhookUrl Pūāhua No Te URL hei whiwhi whakamōhiotanga ina oti

Hōputu Whakahoki

He rite tonu te hōputu o ngā whakahoki API katoa:

Whakahoki Angitu

{
  "data": {
    "generateimage": {
      "id": "abc123xyz",
      "status": "processing",
      "url": null,
      "webhookUrl": "https://your-webhook.com/callback",
      "createdAt": "2024-01-01T00:00:00Z"
    }
  }
}

Whakahoki Kua Oti

{
  "data": {
    "generateimage": {
      "id": "abc123xyz",
      "status": "completed",
      "url": "https://cdn.doitong.com/outputs/abc123xyz.jpg",
      "duration": null,
      "createdAt": "2024-01-01T00:00:00Z"
    }
  }
}

Whakahaere Hapa

E whakamahi ana te API i ngā waehere tūnga HTTP paerewa, ā, ka whakahokia mai he karere hapa taipitopito.

Ngā Waehere Hapa Noa

Waehere Tūnga Momo Hapa Whakaahuatanga
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

Hōputu Whakahoki Hapa

{
  "errors": [
    {
      "message": "Insufficient credits for this operation",
      "extensions": {
        "code": "INSUFFICIENT_CREDITS",
        "creditsRequired": 100,
        "creditsAvailable": 50
      }
    }
  ]
}

Matau Tukutuku

Whiwhi whakamōhiotanga hāora-tūturu ina oti te whakaputa i tō text to image.

Whakarite Matau Tukutuku

Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.

Raraunga Matau Tukutuku

{
  "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
  }
}

Haumarutanga Matau Tukutuku

Kei roto i ngā tono matau tukutuku katoa he pane waitohu hei whakamana:

X-Doitong-Signature: sha256=abc123...

Ngā Tepe Tere

Hei whakarite i te whakamahinga tika me te pūmautanga o te pūnaha, ka whai mana ēnei tepe tere:

Mahere Tono/Meneti Mahi Tukutahi Tepe ia Rā
Koreutu 10 1 100
Tīmata 30 3 1,000
Pro 60 10 10,000
Taurima Whaiaro Whaiaro Mutunga Kore
Ngā Pane Tepe Tere: Tirohia ngā pane whakahoki mō te tūnga tepe o tēnei wā:
  • X-RateLimit-Limit: Maximum requests per window
  • X-RateLimit-Remaining: Requests remaining
  • X-RateLimit-Reset: Window reset timestamp

Ngā Tikanga Pai

1. Whakapai ake i ō Tono (Prompts)

Tuhia he tono mārama, he tono whakaahua hoki kia whiwhi ai i ngā hua pai rawa atu:

  • Be specific about visual elements, style, and mood
  • Include details about lighting, camera angles, and composition
  • Avoid contradictory or impossible requests

2. Whakahaerehia te Tukatuka Tukutahi-kore (Async)

He tukutahi-kore te mahi whakaputa. Whakaritea he pūnaha tirotiro (polling), he matau tukutuku rānei:

// 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. Whakaora Hapa

Whakaritea he arorau ngana-anō me te whakaroa haere (exponential backoff):

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. Aroturuki i te Whakamahinga Whiwhinga

Aroturukihia tō whakapau whiwhinga kia kore ai e haukotia te mahi:

  • Check credit balance before large batch operations
  • Set up alerts for low credit thresholds
  • Implement credit-aware request queuing

Kua reri ki te tīmata?

Hono atu ki ngā mano tini kaiwhakawhanake e whakamahi ana i a Flux Ultra API ki te hanga ihirangi mīharo

Tikina te Kī API Tirohia ngā Utu