Official Python client for the Mixfont API.
Project description
Mixfont Python client
A Python client for the Mixfont 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.
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.
Installation
Install it from PyPI:
pip install mixfont
Usage
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
standardwhen comparing directions, then useextendedonce you have a candidate worth testing more deeply. - Store the generation
id, original prompt or image URL, andglyph_setwith 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
Publishing
See PUBLISHING.md.
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.0.tar.gz.
File metadata
- Download URL: mixfont-0.1.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eff580bb77a44237db5b77c09431eaa23370c183372f70747ccc88819e5df20b
|
|
| MD5 |
06ca8bb02e93ad5bfe9d6e326cc29324
|
|
| BLAKE2b-256 |
08260cf1b33ce328552daaa4ccebebc66c1be802ff1571c808e793300563bca6
|
Provenance
The following attestation bundles were made for mixfont-0.1.0.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.0.tar.gz -
Subject digest:
eff580bb77a44237db5b77c09431eaa23370c183372f70747ccc88819e5df20b - Sigstore transparency entry: 1713047829
- Sigstore integration time:
-
Permalink:
mixfont/mixfont-python@edb6b6d7301e2581cb7cdb132c53d550e7a40dae -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mixfont
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edb6b6d7301e2581cb7cdb132c53d550e7a40dae -
Trigger Event:
release
-
Statement type:
File details
Details for the file mixfont-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mixfont-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.6 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 |
bce082d72cc093034a518bd7e000c2fb07d653f4b34481f097c578a44d83564e
|
|
| MD5 |
9302ccd9d41d522586f210f150522848
|
|
| BLAKE2b-256 |
3155c47ef1df743342bd72e5646bfe1b591444814af0989ad3dd4568ac4f1fcd
|
Provenance
The following attestation bundles were made for mixfont-0.1.0-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.0-py3-none-any.whl -
Subject digest:
bce082d72cc093034a518bd7e000c2fb07d653f4b34481f097c578a44d83564e - Sigstore transparency entry: 1713047839
- Sigstore integration time:
-
Permalink:
mixfont/mixfont-python@edb6b6d7301e2581cb7cdb132c53d550e7a40dae -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mixfont
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edb6b6d7301e2581cb7cdb132c53d550e7a40dae -
Trigger Event:
release
-
Statement type: