What libraries and APIs does DiceBear offer for developers?
Updated
DiceBear offers one HTTP API plus official libraries for JavaScript, PHP, Python, Rust, Go, Dart, and C#, along with a CLI for command-line generation. All of them share the same core behavior: you pass a style and a seed, and you get back a deterministic avatar. If you only need an image URL, use the HTTP API. If you want to generate avatars inside your own codebase, pick the library that matches your language.
The HTTP API
The API is the lowest-friction integration. You construct a URL from a version, a style name, a format, and a seed:
https://api.dicebear.com/10.x/lorelei/svg?seed=Felix
10.xis the API versionloreleiis the stylesvgis the output formatseed=Felixis any string you choose
Because the avatar is derived from the seed, the same URL always returns the same image. That makes the API suitable for user profile pictures where you want a stable avatar tied to a username, email, or ID without storing an image file.
Official libraries by language
DiceBear publishes libraries across a wide range of ecosystems. The pattern is consistent: load a style definition, create an avatar with a seed, then render it.
| Language | Package / import | Style source |
|---|---|---|
| JavaScript | @dicebear/core + @dicebear/styles |
@dicebear/styles/lorelei.json |
| Python | dicebear |
dicebear_styles resource file |
| Rust | dicebear_core + dicebear_styles |
dicebear_styles::LORELEI |
| Go | github.com/dicebear/dicebear-go/v10 + styles module |
styles.Lorelei |
| Dart | dicebear_core + dicebear_styles |
lorelei.dart |
| C# | DiceBear |
Styles.Lorelei |
JavaScript example
import { Style, Avatar } from '@dicebear/core';
import definition from '@dicebear/styles/lorelei.json' with { type: 'json' };
const style = new Style(definition);
const avatar = new Avatar(style, { seed: 'Felix' });
Python example
from importlib.resources import files
from dicebear import Avatar, Style
style = Style.from_json(
files("dicebear_styles").joinpath("lorelei.json").read_text("utf-8")
)
avatar = Avatar(style, { "seed": "Felix" })
Rust example
use dicebear_core::{Avatar, Style};
use serde_json::json;
let style = Style::from_str(dicebear_styles::LORELEI)?;
let avatar = Avatar::new(&style, json!({ "seed": "Felix" }))?;
Go example
import (
dicebear "github.com/dicebear/dicebear-go/v10"
"github.com/dicebear/styles/v10"
)
style, _ := dicebear.NewStyle([]byte(styles.Lorelei))
avatar, _ := dicebear.NewAvatar(style, map[string]any{
"seed": "Felix",
})
Dart example
import 'package:dicebear_core/dicebear_core.dart';
import 'package:dicebear_styles/lorelei.dart';
final style = Style.parse(lorelei);
final avatar = Avatar(style, {
'seed': 'Felix',
});
C# example
using System.Text.Json.Nodes;
using DiceBear;
var style = Style.Parse(Styles.Lorelei);
var avatar = new Avatar(style, new JsonObject {
["seed"] = "Felix",
});
In every case the inputs are the same — a style definition and a seed — and the output is the avatar for that combination.
The CLI
If you want avatars without writing integration code, the CLI generates them directly:
npx dicebear lorelei --seed 'Felix'
This is useful for build scripts, asset generation, or one-off exports where pulling in a full library would be overkill.
How to choose
- Only need image URLs in HTML or a frontend? Use the HTTP API — no dependency to install.
- Generating avatars server-side in an existing app? Use the library for your language so generation stays in-process.
- Producing avatar files in a pipeline or script? Use the CLI.
- Self-hosting or privacy-sensitive work? The project is open source and self-hostable, so you can run generation on your own infrastructure instead of calling the public API.
What stays the same across all options
Regardless of which entry point you pick, two things are constant:
- Determinism. The same seed with the same style produces the identical avatar every time, across platforms and languages.
- Style coverage. All integrations draw from the same set of 61 avatar styles, ranging from hand-drawn characters to abstract patterns, pixel art, and detailed illustrations. Some styles come from independent artists and others are designed in-house; for example, the Lorelei style is a remix of work by Lisa Wischofsky licensed under CC0 1.0.
That shared foundation means you can prototype with the API or Playground and later move to a library or CLI without changing the visual result.