> ## Documentation Index
> Fetch the complete documentation index at: https://ailabtools.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Age & Gender Swap

> Age & Gender Swap API edits portrait attributes to change age or gender and generate realistic face transformation effects.

export const FileStoragePolicy = ({uploadedFiles, responseType}) => {
  const responseFileData = {
    URL: {
      stored: "Yes",
      retention: "24 Hours",
      deletion: "Automatic"
    },
    BASE64: {
      stored: "No",
      retention: "N/A",
      deletion: "Immediate"
    }
  };
  if (!uploadedFiles && !responseType) return null;
  return <div>
      <table>
        <thead>
          <tr>
            <th>Data Type</th>
            <th>Stored</th>
            <th>Retention</th>
            <th>Training</th>
            <th>Deletion</th>
          </tr>
        </thead>
        <tbody>
          {uploadedFiles && <tr>
              <td>Uploaded Files</td>
              <td>No</td>
              <td>N/A</td>
              <td>No</td>
              <td>Immediate</td>
            </tr>}
          {responseType && responseFileData?.[responseType] && <tr>
              <td>Response Files ({responseType})</td>
              <td>{responseFileData[responseType]['stored']}</td>
              <td>{responseFileData[responseType]['retention']}</td>
              <td>No</td>
              <td>{responseFileData[responseType]['deletion']}</td>
            </tr>}
        </tbody>
      </table>

      <Tip>
        For more information, see the{" "}<a href="/docs/file-storage-policy">File Storage Policy</a> and{" "}<a href="https://www.ailabtools.com/privacy-policy" target="_blank">Privacy Policy</a>.
      </Tip>
    </div>;
};

export const BillingInstructions = ({creditsPerRequest = 1}) => {
  const creditUnitPrice = 0.0027;
  const billingTiers = [{
    price: 6,
    credits: 2000,
    costPerCredit: 0.003
  }, {
    price: 30,
    credits: 10000,
    costPerCredit: 0.003
  }, {
    price: 300,
    credits: 110000,
    costPerCredit: 0.0027
  }, {
    price: 1500,
    credits: 550000,
    costPerCredit: 0.0027
  }, {
    price: 2500,
    credits: 1000000,
    costPerCredit: 0.0025
  }];
  const formatCurrency = (value, fractionDigits = 2) => value.toLocaleString("en-US", {
    style: "currency",
    currency: "USD",
    minimumFractionDigits: fractionDigits,
    maximumFractionDigits: fractionDigits
  });
  const formatNumber = (value, fractionDigits = 0) => value.toLocaleString("en-US", {
    minimumFractionDigits: fractionDigits,
    maximumFractionDigits: fractionDigits
  });
  return <>
      <table>
        <thead>
          <tr>
            <th style={{
    textAlign: "right"
  }}>Price</th>
            <th style={{
    textAlign: "right"
  }}>Requests</th>
            <th style={{
    textAlign: "right"
  }}>Cost / Request</th>
          </tr>
        </thead>
        <tbody>
          {billingTiers.map(tier => {
    const requests = tier.credits / creditsPerRequest;
    const costPerRequest = tier.costPerCredit * creditsPerRequest;
    return <tr key={tier.credits}>
                <td style={{
      textAlign: "right"
    }}>{formatCurrency(tier.price)}</td>
                <td style={{
      textAlign: "right"
    }}>{formatNumber(requests)}</td>
                <td style={{
      textAlign: "right"
    }}>
                  {formatCurrency(costPerRequest, 4)}
                </td>
              </tr>;
  })}
        </tbody>
      </table>

      <Tip>
        Each successful API request consumes{" "}<strong>{creditsPerRequest} credits (≈{" "}{formatCurrency(creditUnitPrice * creditsPerRequest, 4)})</strong>. Failed requests are not billed.

        <ul>
          <li>
            View pricing on the{" "}<a href="https://www.ailabtools.com/price?tab=api" target="_blank">pricing page</a>{" "}or manage credits in the{" "}<a href="https://www.ailabtools.com/developer/billing" target="_blank">developer platform</a>.
          </li>
          <li>
            Need more credits or an enterprise plan? Contact{" "}<a href="mailto:business@ailabtools.com">business@ailabtools.com</a>.
          </li>
        </ul>
      </Tip>
    </>;
};

export const ExperienceLinks = ({onlineUrl, apiUrl}) => {
  return <Tip>
      Explore this API through the{" "}<a href={`https://www.ailabtools.com${onlineUrl}`} target="_blank">👉 Online Experience 👈</a>{" "}or integrate it using the{" "}<a href={apiUrl}>👉 Run with API 👈</a>.
    </Tip>;
};

## Renderings show

<div class="cm-border-2-solid-218221225100 cm-border-radius-8 cm-text-align-center">
  <div class="cm-grid-template-columns-3 cm-grid-gap-8 cm-padding-8 cm-border-bottom-2-solid-218221225100">
    <div class="cm-grid-column-2-span-1">
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/untreated-1-min.jpeg" alt="Original Image" />

      <div class="cm-margin cm-word-break-break-all">Original Image</div>
    </div>
  </div>

  <div class="cm-grid-template-columns-3 cm-grid-gap-8 cm-padding-8">
    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_OLD-1-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_OLD`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_KID-1-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_KID`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_FEMALE-1-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_FEMALE`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_MALE-1-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_MALE`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/V2_AGE-70-1-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`V2_AGE` <br /> `target`=`70`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/V2_GENDER-1-1-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`V2_GENDER` <br /> `target`=`0`</div>
    </div>
  </div>
</div>

<div class="cm-border-2-solid-218221225100 cm-border-radius-8 cm-text-align-center">
  <div class="cm-grid-template-columns-3 cm-grid-gap-8 cm-padding-8 cm-border-bottom-2-solid-218221225100">
    <div class="cm-grid-column-2-span-1">
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/untreated-2-min.jpeg" alt="Original Image" />

      <div class="cm-margin cm-word-break-break-all">Original Image</div>
    </div>
  </div>

  <div class="cm-grid-template-columns-3 cm-grid-gap-8 cm-padding-8">
    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_OLD-2-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_OLD`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_KID-2-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_KID`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_FEMALE-2-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_FEMALE`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/TO_MALE-2-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`TO_MALE`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/V2_AGE-70-2-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`V2_AGE` <br /> `target`=`70`</div>
    </div>

    <div>
      <img class="cm-w cm-border-radius-8" src="https://img.ailabtools.com/rapidapi/FaceAttributesedit/V2_GENDER-0-2-min.jpeg" alt />

      <div class="cm-margin cm-word-break-break-all">`action_type`=`V2_GENDER` <br /> `target`=`1`</div>
    </div>
  </div>
</div>

<ExperienceLinks onlineUrl="/age-gender-swap" apiUrl="/docs/ai-portrait/effects/face-attribute-editing/api" />

## Billing Instructions

<BillingInstructions creditsPerRequest={8} />

## File Storage Policy

<FileStoragePolicy uploadedFiles responseType="BASE64" />

## Application Scenarios

* **Fun social**: In the social field, you can use the face attribute editing ability to create creative social activities and fun ideas to form pop-up activities through community fission.
* **Short video**: Realize the production of short video with fun face attribute editing, which is fun and at the same time can meet the user's demand for cognition and display of their own image.
* **Marketing**: Apply face attribute editing effects to produce creative content, allowing users to experience "fun" technology while independently spreading marketing activities or advertising to achieve the effect of brand promotion.

## Featured Advantages

* **Key point positioning**: The algorithm accurately includes eyes, eyebrows, lips, nose and face contour, providing 72 high-precision key points FDDB official measurement.
* **Fast response time**: Using advanced neural portrait editing technology, the single image feature extraction speed (GPU), on average, reaches 100 ms, enabling fast response to face attribute transformation and generating a new face with the desired attributes.
* **Excellent effect**: the output face's expression, angle, background and other attributes are highly compatible with the input face, generating a unique artificial intelligence face effect with high image generation quality to meet the demand for visual effects.
