AI Headshot Generation API — Professional Profile Photos Programmatically
An HR onboarding tool that needs a consistent, professional-looking headshot for every new hire's directory profile can't rely on employees submitting a studio photo — remote hires rarely have one, and asking them to book a photographer adds friction to onboarding. Generating a polished headshot from a casual selfie via API removes that dependency entirely.
Direct answer: a reference-guided image generation API can take one casual photo of a person and output a professional-style headshot — consistent lighting, neutral background, business attire — without a photo studio, by passing the source image alongside a style prompt.
How Does an API Turn a Selfie Into a Professional Headshot?
Reference-guided generation takes an uploaded photo as an image input and a text prompt describing the target style, then produces a new image that preserves the subject's likeness while applying the requested lighting, background, and framing changes. This differs from pure text-to-image, which has no source photo to anchor facial identity — headshot generation specifically needs a model that supports image-plus-prompt input, not text-only generation.
The output is a new image, not an edited version of the original file — the model recomposes the scene around the reference face rather than applying filters on top of the existing background.
Which Model Fits Headshot Generation Best?
Nano Banana Pro's reference-guided mode is the stronger fit for headshots because it's built to hold facial identity consistent while changing background, lighting, and attire around it; GPT-image-2 works for simpler instruction-based touch-ups on an existing headshot rather than a full studio-style regeneration.
| Model | Mode | Resolution / price | Facial consistency | Best for |
|---|---|---|---|---|
| Nano Banana Pro | Reference-guided | 1K $0.030 / 2K $0.030 / 4K $0.042 | High | Selfie-to-professional-headshot generation |
| Nano Banana 2 | Reference-guided | 1K $0.020 / 4K $0.036 | Moderate | Lower-cost draft headshots at volume |
| GPT-image-2 | Instruction editing | $0.014/image | N/A (edits existing photo) | Background swap or lighting touch-up on an existing headshot |
For a directory of hundreds of employee photos where identity accuracy matters more than unit cost, Nano Banana Pro is the safer default. For a quick background cleanup on a photo that's already headshot-quality, GPT-image-2's edit mode is cheaper per call.
How Do I Generate a Headshot From a Reference Photo?
Submit the reference image URL along with a prompt describing the target studio style — lighting, background, and attire — and the model returns a new image built around the subject's face.
import requests
API_KEY = "YOUR_GENRELAY_KEY"
BASE_URL = "https://genrelay.ai/v1"
def generate_headshot(reference_image_url, style_prompt, resolution="2K"):
r = requests.post(
f"{BASE_URL}/images/generations",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "nano-banana-pro",
"mode": "reference-guided",
"reference_image_url": reference_image_url,
"prompt": style_prompt,
"resolution": resolution,
},
timeout=60,
)
return r.json()["output_url"]
headshot_url = generate_headshot(
"https://cdn.example.com/hr/new-hire-selfie.jpg",
"Professional corporate headshot, soft studio lighting, neutral gray background, "
"business casual attire, direct eye contact, shoulders-up framing",
)
print(headshot_url)
How Do I Generate Headshots for an Entire Team in One Batch?
Loop the same reference-guided call over a list of employee photos with a shared style prompt so every headshot in the directory matches the same lighting and background treatment.
from concurrent.futures import ThreadPoolExecutor
STYLE_PROMPT = (
"Professional corporate headshot, soft studio lighting, neutral gray background, "
"business casual attire, shoulders-up framing"
)
NEW_HIRES = [
("emp-1042", "https://cdn.example.com/hr/emp-1042-selfie.jpg"),
("emp-1043", "https://cdn.example.com/hr/emp-1043-selfie.jpg"),
("emp-1044", "https://cdn.example.com/hr/emp-1044-selfie.jpg"),
]
def process(entry):
emp_id, photo_url = entry
return emp_id, generate_headshot(photo_url, STYLE_PROMPT)
with ThreadPoolExecutor(max_workers=4) as pool:
results = list(pool.map(process, NEW_HIRES))
for emp_id, url in results:
print(f"{emp_id}: {url}")
See the guide to consistent AI-generated images for prompt patterns that keep style uniform across a larger batch.
What Does Generating Headshots at Scale Cost?
As of September 2026, GenRelay pricing: Nano Banana Pro is $0.030 per image at 2K resolution, and Nano Banana 2 is $0.020 per image at 1K.
A directory refresh for 200 employees at 2K via Nano Banana Pro costs 200 × $0.030 = $6.00. Running a lower-cost draft pass first with Nano Banana 2 at 1K — to let each employee pick a preferred variant before the final render — adds 200 × $0.020 = $4.00 for a first round, bringing the two-pass total to $10.00 for 200 headshots.
| Approach | Volume | Cost |
|---|---|---|
| Direct 2K generation (Nano Banana Pro) | 200 employees | $6.00 |
| Draft pass (Nano Banana 2, 1K) + final (Nano Banana Pro, 2K) | 200 employees | $10.00 |
| Single re-generation for 20 unsatisfied results | 20 employees | $0.60 |
At that cost, generating headshots for an entire company directory remains cheaper than a single half-day photography session for a mid-sized team.
Internal Links
- Nano Banana Pro on GenRelay
- AI avatar generation API
- How to maintain visual consistency in AI-generated images via API
FAQ
Does the API guarantee the output looks exactly like the reference photo?
No. Reference-guided generation preserves the subject's general likeness closely but is not a pixel-level edit — expect close resemblance, not an identical face pasted into a new scene, and budget for a manual review step before publishing to a public directory.
Can it remove glasses or change hairstyle from the reference photo?
Yes, if requested explicitly in the prompt, though results vary — test a small batch before committing to a full-team rollout with any single instruction.
What image formats and sizes does the reference photo need to be?
Standard JPEG or PNG at typical selfie resolution works; the API does not require pre-cropping or specific aspect ratios before submission.
Is there a free tier to test headshot quality before rolling out to a team?
Yes. GenRelay includes free credits on signup, enough to generate and compare several sample headshots before running a full-team batch.
How does this differ from a generic background removal tool?
Background removal tools cut out the existing background from a photo; this API regenerates the entire scene — lighting, background, and often attire — around the subject's face using a text prompt.
As of September 2026. Pricing subject to change — verify current rates at genrelay.ai.