Official Python client for the Mixfont AI font generation API.
Project description
State-of-the-art AI Font Generation Model
Official Mixfont Python SDK
Examples | Supported platforms | How it works | Model inputs | Usage
The official Python SDK for the Mixfont AI font generation API. It lets you create AI-generated font files from Python applications and scripts.
Mixfont is a frontier AI lab developing generative AI for fonts. The Mixfont font generation model creates complete, web-safe TTF font files from a natural-language prompt or a public reference image, so applications can turn generated lettering, sketches, logos, or visual references into editable type instead of a flat image. Fonts generated via the API are unique and licensed for commercial use.
For more information, see the Mixfont website and the full Mixfont documentation.
Examples
These examples show prompt and image inputs paired with generated font files from Mixfont.
| Input | Generated font preview |
|---|---|
| generate a font for a soccer team logo. Make the letterforms soccer themed, bold, and unique. |
Download Cipher-Striker-Ultra.ttf |
|
|
Download Wuthering-Heights-Display.ttf |
|
|
Download Gossamer-Editorial-Serif.ttf |
|
|
Download Dystopian-Brush-Stroke-Display.ttf |
|
|
Download Dissonant-Wave-Sans.ttf |
|
|
Download Zephyr-Ink-Script.ttf |
Supported platforms
- Python >= 3.9
- Standard CPython environments with network access
How font generation works
Font generation is asynchronous. Start a generation with exactly one input:
prompt: a text description of the font to generate.image_url: a public HTTPS reference image for the style you want the model to follow.
The create call returns a generation id and, when available, a polling URL. Use mixfont.generations.wait(...) for built-in polling, or call mixfont.generations.get(...) yourself until the status reaches succeeded, failed, or cancelled. When a job succeeds, ttf_url contains the generated TTF download URL.
Model inputs and outputs
Use text generation when you can describe the type direction, such as category, style, use case, spacing, contrast, or distinctive details. Use image generation when a visual reference is the clearest source of truth, such as a sketch, sign, logo, poster, screenshot, or existing design mockup.
Reference images should be publicly reachable HTTPS URLs that point to JPEG, PNG, or WebP files up to 20 MB. Clear images with readable letterforms, strong contrast, clean edges, and cropped text regions generally produce better results.
Generated font files are returned as TTFs. Download or persist the returned ttf_url after the job succeeds, then rehost the file in your own storage before using it in production. Returned TTF URLs are temporary and will be deleted within 24 hours.
Create an API key
To start making calls to the API you'll need an API key. If you don't already have a Mixfont account, visit Mixfont and sign in.
Go to the Developer Console to create your first API key. When calling the API, include the key in the x-api-key header for each request.
Make sure to copy the API key to a safe place. The API key will only be visible in the dashboard once. If you lose your key, you'll have to create a new one.
Installation
Install it from PyPI:
pip install mixfont
Usage
For the full API documentation, see Mixfont docs.
Import the package:
from mixfont import Mixfont
Instantiate the client:
import os
mixfont = Mixfont(api_key=os.environ["MIXFONT_API_KEY"])
Create a font generation:
generation = mixfont.generations.create(
prompt="A condensed sci-fi display font",
glyph_set="standard",
)
print(generation["id"])
Fetch the generation later:
generation = mixfont.generations.get("generation_id")
print(generation["status"], generation["progress_percent"])
Or wait for the generation to finish:
result = mixfont.generations.wait(generation["id"])
print(result["ttf_url"])
Create a generation from a reference image:
generation = mixfont.generations.create(
image_url="https://example.com/reference.png",
)
API
Constructor
mixfont = Mixfont(api_key, timeout=30.0)
| Argument | Type | Description |
|---|---|---|
api_key |
str |
Required. Mixfont API key. |
timeout |
float |
Optional request timeout in seconds. Defaults to 30.0. |
mixfont.generations.create(...)
Starts a new font generation and returns immediately.
| Argument | Type | Description |
|---|---|---|
prompt |
str |
Text prompt for the generated font. |
image_url |
str |
Public HTTPS URL for a JPEG, PNG, or WebP reference image up to 20 MB. |
glyph_set |
"standard" or "extended" |
Optional glyph set. Defaults to standard. |
Provide exactly one of prompt or image_url.
Glyph sets
| Glyph set | Best for | Glyphs | Typical timing |
|---|---|---|---|
standard |
English concepting, prototypes, headings, and logos | 72 | Around 25 seconds on average |
extended |
Production candidates for Latin-language text beyond English | 319 | 2-3 minutes |
standard includes English letters, numbers, and basic punctuation. extended supports all Latin languages, including special characters, and costs more API credits.
mixfont.generations.get(generation_id)
Fetches the current status of a generation.
mixfont.generations.wait(generation_id, ...)
Checks the generation until it reaches a terminal status.
| Argument | Type | Description |
|---|---|---|
interval_seconds |
float |
Polling interval. Defaults to 5.0. |
timeout_seconds |
float |
Maximum wait time. Defaults to 600.0. |
wait returns the completed generation when it succeeds. It raises an error if
the generation fails, is cancelled, or times out.
Best practices
Write specific prompts that describe the type category, visual style, intended use case, and distinctive details.
Start with standard when comparing directions, then use extended once you have a candidate worth testing more deeply.
Store the generation id, original prompt or image URL, and glyph_set with each result so your team can compare outputs later.
Test generated fonts in real content, including headings, numbers, punctuation, labels, and the longest strings your product needs to support.
Keep your API key on the server and read it from an environment variable such as MIXFONT_API_KEY.
Development
PYTHONPATH=src python3 -m unittest discover -s tests
python3 -m build
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mixfont-0.1.1.tar.gz.
File metadata
- Download URL: mixfont-0.1.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec62992c4ca2fc65a9207c8ab36f9f50e163ae446f92972016f24f589ba7d5d
|
|
| MD5 |
6dc2cc8f0942c3b7f1ed72e632d2b80c
|
|
| BLAKE2b-256 |
6b91914b61c7aa1929480d8066f8aac41bd01ee985c63c40119cf2d6a5ff4878
|
Provenance
The following attestation bundles were made for mixfont-0.1.1.tar.gz:
Publisher:
publish.yml on mixfont/mixfont-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mixfont-0.1.1.tar.gz -
Subject digest:
9ec62992c4ca2fc65a9207c8ab36f9f50e163ae446f92972016f24f589ba7d5d - Sigstore transparency entry: 1715283949
- Sigstore integration time:
-
Permalink:
mixfont/mixfont-python@e1ff9b75d24f9095a4b51dd413acacbc3c575d4d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mixfont
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e1ff9b75d24f9095a4b51dd413acacbc3c575d4d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mixfont-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mixfont-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f01617ad210295ef0d9c0d900beac4cd2e78813f9f12e6abe50289ab667ed4b
|
|
| MD5 |
8f72be285e86d844c163d47447aaa840
|
|
| BLAKE2b-256 |
74d10664fe41eef670ca4d46728dbf2c4747ae8a94e9cfb2b0727a7767e45036
|
Provenance
The following attestation bundles were made for mixfont-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on mixfont/mixfont-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mixfont-0.1.1-py3-none-any.whl -
Subject digest:
1f01617ad210295ef0d9c0d900beac4cd2e78813f9f12e6abe50289ab667ed4b - Sigstore transparency entry: 1715284027
- Sigstore integration time:
-
Permalink:
mixfont/mixfont-python@e1ff9b75d24f9095a4b51dd413acacbc3c575d4d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mixfont
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e1ff9b75d24f9095a4b51dd413acacbc3c575d4d -
Trigger Event:
workflow_dispatch
-
Statement type: