Guide · Open source
How to use mihomo: Python client for Honkai: Star Rail data
Updated · written with AI from the project's own documentation and checked against our catalogue data
mihomo is a small Python package that fetches Honkai: Star Rail player data from the Mihomo API and returns it as Pydantic models, so your code editor can suggest field names as you type. This guide covers installing it, fetching a player by UID, reading character data and icon URLs, and saving the results. It is written for developers who already work in Python; the package is used only through code.
Quick start
- 1Install the package. Run the README's pip command: pip install -U git+https://github.com/KT-Yeh/mihomo.git.
- 2Create a client. Import MihomoAPI and Language from mihomo, then create client = MihomoAPI(language=Language.EN).
- 3Pick a data format. Use client.fetch_user_v1(UID) for V1 or client.fetch_user(UID) for V2.
- 4Fetch a player by UID. Call the fetch method with a Honkai: Star Rail UID inside an async function, using await.
- 5Read the fields. Access data.player, data.player_details and data.characters, and use client.get_icon_url or replace_icon_name_with_url for images.
- 6Save the result. Use data.json(by_alias=True, ensure_ascii=False) for JSON or pickle with zlib for a binary copy.
What mihomo does and what it does not do
mihomo is a Python package for Honkai: Star Rail. Its README describes it as a simple Pydantic model with type hints and autocompletion support for parsed data from the Mihomo API. It is a library you import into your own code, not a standalone app.
The README covers only Honkai: Star Rail. It does not describe a graphical interface or a command-line tool.
- Fetches player data by UID from the Mihomo API
- Returns typed Pydantic models you can autocomplete
- Can give you asset URLs for character icons
- Covers only Honkai: Star Rail
Install mihomo with pip
You need Python and pip. The README does not state a minimum Python version, so check the package's own metadata or try a current release of Python. The README's install command pulls the package directly from a GitHub repository using pip.
The README links to the KT-Yeh fork for installation, while the repository name in our listing is MetaCubeX/mihomo. Use the command the README gives and confirm you are installing the package you expect.
- Prerequisites: Python and pip
- The README does not give a Python version
pip install -U git+https://github.com/KT-Yeh/mihomo.gitFetch a player by UID with V1 or V2 data
The README describes two parsed data formats. V1 is fetched with client.fetch_user_v1 and uses the mihomo.models.v1.StarrailInfoParsedV1 model. V2 is fetched with client.fetch_user and uses the mihomo.models.StarrailInfoParsed model.
Both formats use the Mihomo API URL pattern https://api.mihomo.me/sr_info_parsed/{UID}?lang={LANG}. The README example uses UID 800333171 and sets the language with Language.EN.
- V1: client.fetch_user_v1(UID), model mihomo.models.v1.StarrailInfoParsedV1
- V2: client.fetch_user(UID), model mihomo.models.StarrailInfoParsed
client = MihomoAPI(language=Language.EN)
data = await client.fetch_user(800333171)Read player data and character icon URLs
Once you have the data, you access fields such as the player name, level, signature and the list of characters. In V1, you convert icon names to URLs with client.get_icon_url. If you do not want to call that each time, the README says you can pass replace_icon_name_with_url=True to fetch_user to get asset URLs in the parsed data.
The README example prints the player name, level, signature, and each character's name, rarity and level in V1, and portrait URLs in V2.
- V1 icon fields (icon, preview, portrait) use client.get_icon_url
- V2 can return asset URLs directly with replace_icon_name_with_url=True
data = await client.fetch_user(800333171, replace_icon_name_with_url=True)Clean up and merge character data with tools
The tools module is imported with from mihomo import tools. The README shows two helpers. remove_duplicate_character removes duplicate characters from fetched data. merge_character_data merges a new fetch into an older one, which is useful when you want to keep data for characters that have changed in game between fetches.
The README notes that after changing characters in game you must wait for the API to refresh before fetching again.
- tools.remove_duplicate_character(data)
- tools.merge_character_data(new_data, old_data)
data = tools.remove_duplicate_character(data)Save parsed data as JSON or pickle
The README shows saving data in two ways. For JSON, it calls data.json(by_alias=True, ensure_ascii=False) and loads it back with StarrailInfoParsed.parse_raw. For pickle, it uses pickle.dumps with zlib.compress and restores with pickle.loads and zlib.decompress.
Pickle files are tied to Python and to the code that created them. JSON is easier to read and share, so use it if the data needs to leave your Python code.
- JSON: data.json(by_alias=True, ensure_ascii=False)
- Pickle with zlib compression: zlib.compress(pickle.dumps(data))
json_data = data.json(by_alias=True, ensure_ascii=False)
data_from_json = StarrailInfoParsed.parse_raw(json_data)What people use it for
- A fan dashboard that shows a player's level, signature and character list
- A tool that pulls character portrait or avatar URLs for a website
- A script that saves snapshots of player data as JSON over time
- A script that merges older and newer fetches to track character changes
Frequently asked questions
Is mihomo free to use?
The source lists the license as MIT. The README does not mention pricing, so the MIT license is the main licensing information available in the source.
What do I need to install mihomo?
You need Python and pip. The README does not state a minimum Python version. Install with pip install -U git+https://github.com/KT-Yeh/mihomo.git as shown in the README.
Is mihomo a proxy or Clash kernel?
No. The README describes a Python Pydantic model for Honkai: Star Rail data from the Mihomo API. The repository name and listed release files refer to different software, and the README does not explain that link, so check the source before assuming anything else.
Does mihomo work with games other than Honkai: Star Rail?
The README covers only Honkai: Star Rail. Nothing in the source says it supports other games.
What is the difference between V1 and V2 in mihomo?
The README lists two parsed formats. V1 uses fetch_user_v1 and the mihomo.models.v1 models. V2 uses fetch_user and the mihomo.models models. Both are fetched by UID from the Mihomo API.
How do I get character images with mihomo?
Use client.get_icon_url on icon fields in V1, or pass replace_icon_name_with_url=True to fetch_user to get asset URLs directly, as the README describes.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use mihomo if you are a Python developer building a Honkai: Star Rail fan tool and want typed, autocompleting player data. Pick a different tool if you need a graphical app, a command-line tool, or any game other than Honkai: Star Rail, and note that the repository name in our listing does not match the README's package description.
Install options & downloads