Skip to main content
Use the Python client in Python 3.9 or newer.

Install

pip install mixfont
View the package on PyPI.

Generate a font

import os
from mixfont import Mixfont

mixfont = Mixfont(api_key=os.environ["MIXFONT_API_KEY"])

generation = mixfont.generations.create(
    prompt="a cute and bubbly font",
    glyph_set="standard",
)

result = mixfont.generations.wait(generation["id"])

print(result["ttf_url"])

Create from an image

generation = mixfont.generations.create(
    image_url="https://images.example.com/reference-wordmark.png",
    glyph_set="standard",
)

Methods

MethodDescription
mixfont.generations.create(...)Starts a new generation and returns immediately.
mixfont.generations.get(generation_id)Fetches the current generation status.
mixfont.generations.wait(generation_id, ...)Polls until the generation succeeds, fails, is cancelled, or times out.

Create arguments

Provide exactly one of prompt or image_url.
ArgumentTypeDescription
promptstrText prompt for the generated font.
image_urlstrPublic HTTPS URL for a reference image.
glyph_set"standard" or "extended"Optional glyph set. Defaults to standard. standard generates 72 glyphs for English with basic letters, numbers, and punctuation. extended generates 319 glyphs for all Latin languages, including special characters.

Response

The Python client returns the API response as a dictionary with snake-case keys.
KeyTypeDescription
idstrGeneration id.
namestrGenerated font display name.
ttf_urlstr or NoneGenerated TTF download URL. None until the generation succeeds.
statusstrpreparing, queued, running, succeeded, cancelled, or failed.
input_typestrtext or image.
glyph_setstrSelected glyph set: standard or extended.
progress_percentfloatApproximate progress from 0 to 100.
poll_urlstrPresent on create responses.
errorstrPresent only when a generation fails and an error message is available.
created_atstrISO timestamp for when the generation was created.

Wait arguments

ArgumentTypeDescription
interval_secondsfloatPolling interval. Defaults to 5.0.
timeout_secondsfloatMaximum wait time. Defaults to 600.0.