Skip to content

API Reference

hsr

Modules:

  • character –
  • endgame –
  • enemy_groups –
  • light_cone –
  • monster –
  • new –
  • relic –

Classes:

ApocBuff pydantic-model

Represents the fixed global buff in Apocalyptic Shadow.

Attributes:

  • name (str) –

    Name of the buff.

  • desc (str) –

    Description of the effect.

Fields:

Validators:

  • __format_fields
  • __handle_missing_fields → name, desc

desc pydantic-field

desc: str = ''

name pydantic-field

name: str = ''

ApocDetail pydantic-model

Apocalyptic Shadow event details.

Attributes:

Fields:

Validators:

Character pydantic-model

Represent an HSR character.

Attributes:

Fields:

Validators:

  • __format_fields
  • __convert_icon → icon
  • __convert_rarity → rarity
  • __convert_description → description
  • __transform_names

description pydantic-field

description: str

element pydantic-field

element: HSRElement

icon pydantic-field

icon: str

id pydantic-field

id: int

name pydantic-field

name: str = ''

names pydantic-field

names: dict[Literal['en', 'zh', 'ko', 'ja'], str]

path pydantic-field

path: HSRPath

rarity pydantic-field

rarity: Literal[4, 5]

CharacterDetail pydantic-model

Represent an HSR character detail.

Attributes:

Fields:

Validators:

  • __format_fields
  • __convert_rarity → rarity
  • __convert_description → description
  • __remove_invalid_skills → skills
  • __extract_id

ascension_stats pydantic-field

ascension_stats: dict[str, dict[str, Any]]

description pydantic-field

description: str

eidolons pydantic-field

eidolons: dict[str, Eidolon]

gacha_art property

gacha_art: str

Get the character's gacha art URL.

icon property

icon: str

Get the character's icon URL.

id pydantic-field

id: int

name pydantic-field

name: str

rarity pydantic-field

rarity: Literal[4, 5]

skills pydantic-field

skills: dict[str, Skill]

ChildMonster pydantic-model

Represent the specific details of a monster type.

Attributes:

Fields:

Validators:

  • __format_fields

attack_modify_ratio pydantic-field

attack_modify_ratio: float = 1

damage_type_resistances pydantic-field

damage_type_resistances: list[DamageTypeResistance]

defence_modify_ratio pydantic-field

defence_modify_ratio: float = 1

elite_group pydantic-field

elite_group: int = 1

hard_level_group pydantic-field

hard_level_group: int = 1

hp_modify_ratio pydantic-field

hp_modify_ratio: float = 1

id pydantic-field

id: int

skills pydantic-field

spd_modify_ratio pydantic-field

spd_modify_ratio: float = 1

spd_modify_value pydantic-field

spd_modify_value: float | None = None

stance_modify_fixed_value pydantic-field

stance_modify_fixed_value: float | None = None

stance_modify_value pydantic-field

stance_modify_value: float = 1

stance_weak_list pydantic-field

stance_weak_list: list[HSRElement]

DamageTypeResistance pydantic-model

Represent the damage resistance of an enemy in HSR.

Attributes:

Fields:

Validators:

  • __format_fields

element pydantic-field

element: HSRElement

value pydantic-field

value: float

Eidolon pydantic-model

Represent a character's eidolon.

Attributes:

Fields:

Validators:

  • __format_fields

description pydantic-field

description: str

id pydantic-field

id: int

image property

image: str

Get the eidolon's image URL.

name pydantic-field

name: str

parameters pydantic-field

parameters: list[float]

EliteGroup pydantic-model

Represent an EliteGroup in HSR.

All enemies in HSR follow the following formula for ATK, DEF, HP, and SPD: Base x BaseModifyRatio x EliteGroup Ratio x HardLevelGroup(Level) Ratio x (1 + HPMultiplier)

Attributes:

Fields:

Validators:

attack_ratio pydantic-field

attack_ratio: float = 0

defence_ratio pydantic-field

defence_ratio: float = 0

hp_ratio pydantic-field

hp_ratio: float = 0

id pydantic-field

id: int

spd_ratio pydantic-field

spd_ratio: float = 0

stance_ratio pydantic-field

stance_ratio: float = 0

handle_missing_fields pydantic-validator

handle_missing_fields(value: Any) -> float

EndgameBaseModel pydantic-model

Abstract base class for all HSR endgame modes.

Attributes:

Fields:

Validators:

begin_time pydantic-field

begin_time: str = ''

end_time pydantic-field

end_time: str = ''

id pydantic-field

id: int

name pydantic-field

name: str = ''

stages pydantic-field

stages: list[EndgameStage]

EndgameBuffOptions pydantic-model

Represents a selectable buff modifier in endgame.

Attributes:

  • name (str) –

    Name of the buff.

  • desc (str) –

    Description of the buff effect.

  • params (list[float]) –

    List of parameters applied by the buff.

Fields:

Validators:

  • __format_fields

desc pydantic-field

desc: str

name pydantic-field

name: str

params pydantic-field

params: list[float]

EndgameChallenge pydantic-model

Represents a star requirement of an endgame stage.

Attributes:

  • name (str) –

    The formatted requirement text.

  • param (int) –

    The value substituted into the requirement text.

Fields:

Validators:

  • __format_fields
  • __format_name

name pydantic-field

name: str

param pydantic-field

param: int = 0

EndgameCorrosion pydantic-model

Represents the corrosion (invasion) mechanic applied to an endgame half.

Attributes:

Fields:

Validators:

  • __format_fields

buff_id pydantic-field

buff_id: int

buff_params pydantic-field

buff_params: list[float]

description pydantic-field

description: str = ''

level pydantic-field

level: int

monster_params pydantic-field

monster_params: list[float]

monsters pydantic-field

EndgameCorrosionMonster pydantic-model

Represents an enemy affected by corrosion.

Attributes:

  • id (int) –

    The monster ID, may include a variant suffix.

  • params (list[float]) –

    Per-monster corrosion parameters.

Fields:

Validators:

  • __format_fields

id pydantic-field

id: int

params pydantic-field

params: list[float]

EndgameHalf pydantic-model

Represents one half of an endgame stage (first or second).

Attributes:

Fields:

Validators:

  • __format_fields

corrosion pydantic-field

corrosion: EndgameCorrosion | None = None

eg_id pydantic-field

eg_id: int = 1

hlg_id pydantic-field

hlg_id: int = 1

hlg_level pydantic-field

hlg_level: int = 1

waves pydantic-field

waves: list[EndgameWave]

EndgameStage pydantic-model

Represents a stage in an endgame mode.

A stage with pre_id set is the single-half extra node that follows the stage with that ID (e.g. node 3 of the last Memory of Chaos stage).

Attributes:

Fields:

Validators:

  • __format_fields
  • __handle_missing_name → name
  • __unwrap_event_lists

challenges pydantic-field

challenges: list[EndgameChallenge]

cycle_limit pydantic-field

cycle_limit: int | None = None

first_half pydantic-field

first_half: EndgameHalf

first_half_weaknesses pydantic-field

first_half_weaknesses: list[HSRElement]

id pydantic-field

id: int

name pydantic-field

name: str = ''

pre_id pydantic-field

pre_id: int | None = None

second_half pydantic-field

second_half: EndgameHalf | None

second_half_weaknesses pydantic-field

second_half_weaknesses: list[HSRElement]

special_challenge pydantic-field

special_challenge: EndgameChallenge | None = None

EndgameSummary pydantic-model

Summary metadata for an HSR endgame event.

Attributes:

  • id (int) –

    ID of the endgame.

  • type (HSREndgameType) –

    The type/category of the endgame.

  • names (dict[Literal['en', 'zh', 'ko', 'ja'], str]) –

    Dictionary containing localized names in English (en), Chinese (cn), Korean (kr), and Japanese (jp).

  • name (str) –

    The selected name to display (populated during post-processing).

  • begin (str) –

    Event start timestamp.

  • end (str) –

    Event end timestamp.

Fields:

Validators:

  • __format_fields
  • __transform_names

begin pydantic-field

begin: str = ''

end pydantic-field

end: str = ''

id pydantic-field

id: int

name pydantic-field

name: str = ''

names pydantic-field

names: dict[Literal['en', 'zh', 'ko', 'ja'], str]

type pydantic-field

EndgameWave pydantic-model

Represents a wave of enemies in an endgame half.

Attributes:

Fields:

Validators:

  • __format_fields
  • __handle_missing_hp → hp_multiplier
  • __extract_monster_ids

enemies pydantic-field

enemies: list[int]

hp_multiplier pydantic-field

hp_multiplier: float = 0

FullApocDetail pydantic-model

Apocalyptic Shadow event details with processed enemies.

Attributes:

Fields:

Validators:

FullEndgameBaseModel pydantic-model

Endgame base model with processed enemies.

Attributes:

Fields:

Validators:

stages pydantic-field

FullEndgameHalf pydantic-model

Represents one half of an endgame stage (first or second) with processed enemies.

Attributes:

  • hlg_id (int) –

    ID of the HardLevelGroup used to determine difficulty scaling.

  • hlg_level (int) –

    Level of the HardLevelGroup (affects enemy stats).

  • eg_id (int) –

    ID of the EliteGroup (affects enemy traits).

  • waves (list[FullEndgameWave]) –

    List of enemy waves in this half with processed enemies.

Fields:

Validators:

  • __format_fields

waves pydantic-field

FullEndgameStage pydantic-model

Represents a stage in an endgame mode with processed enemies.

Attributes:

Fields:

Validators:

  • __format_fields
  • __handle_missing_name → name
  • __unwrap_event_lists

first_half pydantic-field

first_half: FullEndgameHalf

second_half pydantic-field

second_half: FullEndgameHalf | None

FullEndgameWave pydantic-model

Represents a wave of processed enemies in an endgame half.

Attributes:

Fields:

Validators:

  • __format_fields
  • __handle_missing_hp → hp_multiplier
  • __extract_monster_ids

enemies pydantic-field

enemies: list[ProcessedEnemy]

FullMOCDetail pydantic-model

Memory of Chaos event details with processed enemies.

Attributes:

  • memory_turbulence (str) –

    Global modifier for the current MoC rotation.

Fields:

Validators:

FullPFDetail pydantic-model

Pure Fiction event details with processed enemies.

Attributes:

Fields:

Validators:

HSREnemySkill pydantic-model

Represents an enemy skill's information.

Attributes:

Fields:

Validators:

damage_type pydantic-field

damage_type: HSRElement | None = None

desc pydantic-field

desc: str = ''

extra_effects pydantic-field

extra_effects: dict[int, HSREnemySkillEffect]

id pydantic-field

id: int

name pydantic-field

name: str = ''

sp_hit_base pydantic-field

sp_hit_base: int | None = None

default_empty_string pydantic-validator

default_empty_string(value: str | None) -> str

empty_string_to_none pydantic-validator

empty_string_to_none(
    v: str | int | None,
) -> str | int | None

HSREnemySkillEffect pydantic-model

Represent an extra effect referenced by an enemy skill.

Attributes:

  • name (str) –

    The name of the effect.

  • desc (str) –

    The description of the effect.

  • params (list[Any]) –

    The parameter values interpolated into the description.

Fields:

Validators:

  • __format_fields

desc pydantic-field

desc: str = ''

name pydantic-field

name: str = ''

params pydantic-field

params: list[Any]

HardLevelGroup pydantic-model

Represent a HardLevelGroup in HSR.

All enemies in HSR follow the following formula for ATK, DEF, HP, and SPD: Base x BaseModifyRatio x EliteGroup Ratio x HardLevelGroup(Level) Ratio x (1 + HPMultiplier)

Attributes:

Fields:

Validators:

attack_ratio pydantic-field

attack_ratio: float = 0

defence_ratio pydantic-field

defence_ratio: float = 0

hp_ratio pydantic-field

hp_ratio: float = 0

id pydantic-field

id: int

level pydantic-field

level: int

spd_ratio pydantic-field

spd_ratio: float = 0

stance_ratio pydantic-field

stance_ratio: float = 0

status_resistance pydantic-field

status_resistance: float = 0

handle_missing_fields pydantic-validator

handle_missing_fields(value: Any) -> float

LightCone pydantic-model

Represent an HSR light cone.

Attributes:

  • id (int) –

    The ID of the light cone.

  • rarity (Literal[3, 4, 5]) –

    The rarity of the light cone.

  • description (str) –

    The description of the light cone.

  • path (HSRPath) –

    The path of the light cone.

  • names (dict[Literal['en', 'zh', 'ko', 'ja'], str]) –

    A dictionary of names in different languages.

  • name (str) –

    The name of the light cone.

Fields:

Validators:

  • __format_fields
  • __handle_null_value → description
  • __convert_icon → icon
  • __convert_rarity → rarity
  • __transform_names

description pydantic-field

description: str

icon property

icon: str

Get the light cone's icon URL.

id pydantic-field

id: int

name pydantic-field

name: str = ''

names pydantic-field

names: dict[Literal['en', 'zh', 'ko', 'ja'], str]

path pydantic-field

path: HSRPath

rarity pydantic-field

rarity: Literal[3, 4, 5]

LightConeDetail pydantic-model

Represent an HSR light cone detail.

Attributes:

Fields:

Validators:

  • __format_fields
  • __convert_rarity → rarity
  • __extract_id

ascension_stats pydantic-field

ascension_stats: list[dict[str, Any]]

description pydantic-field

description: str | None = None

icon property

icon: str

Get the light cone's icon URL.

id pydantic-field

id: int

image property

image: str

Get the light cone's image URL.

name pydantic-field

name: str

path pydantic-field

path: HSRPath

rarity pydantic-field

rarity: Literal[3, 4, 5]

superimpose_info pydantic-field

superimpose_info: SuperimposeInfo

MOCDetail pydantic-model

Memory of Chaos event details.

Attributes:

  • memory_turbulence (str) –

    Global modifier for the current MoC rotation.

Fields:

Validators:

Monster pydantic-model

Represent an enemy monster in HSR.

Attributes:

  • id (int) –

    The ID of the monster.

  • icon (str) –

    The icon URL of the monster.

  • children (list[int]) –

    A list of child monster IDs associated with this monster.

  • weaknesses (list[HSRElement]) –

    List of elements that this monster is weak to (used for breaking toughness).

  • names (dict[Literal['en', 'zh', 'ko', 'ja'], str]) –

    A dictionary of names in different languages.

  • description (str) –

    The English description of the monster.

  • name (str) –

    The English name of the monster.

Fields:

Validators:

children pydantic-field

children: list[int]

description pydantic-field

description: str = ''

icon pydantic-field

icon: str

id pydantic-field

id: int

name pydantic-field

name: str = ''

names pydantic-field

names: dict[Literal['en', 'zh', 'ko', 'ja'], str]

weaknesses pydantic-field

weaknesses: list[HSRElement]

default_empty_string_listing pydantic-validator

default_empty_string_listing(value: str | None) -> str

MonsterDetail pydantic-model

Represent an enemy monster with details in HSR.

Attributes:

Fields:

Validators:

attack_base pydantic-field

attack_base: float = 0

camp_id pydantic-field

camp_id: int | None = None

critical_damage_base pydantic-field

critical_damage_base: float = 0

defence_base pydantic-field

defence_base: float = 0

description pydantic-field

description: str = ''

drops pydantic-field

drops: list[MonsterDrop]

hp_base pydantic-field

hp_base: float = 0

icon pydantic-field

icon: str

id pydantic-field

id: int

initial_delay_ratio pydantic-field

initial_delay_ratio: float | None = None

max_phase pydantic-field

max_phase: int = 1

minimum_fatigue_ratio pydantic-field

minimum_fatigue_ratio: float = 0

monster_types pydantic-field

monster_types: list[ChildMonster]

name pydantic-field

name: str = ''

phases pydantic-field

phases: list[MonsterPhase]

rank pydantic-field

rank: str

skills property

Get the unique skills across all monster variants, deduplicated by ID.

spd_base pydantic-field

spd_base: float = 0

stance_base pydantic-field

stance_base: float = 0

stance_count pydantic-field

stance_count: int = 0

status_resistance_base pydantic-field

status_resistance_base: float = 0

default_empty_string pydantic-validator

default_empty_string(value: str | None) -> str

default_zero_if_none pydantic-validator

default_zero_if_none(
    value: int | float | None,
) -> int | float

MonsterDrop pydantic-model

Represent the rewards dropped by a monster at a specific world level.

Attributes:

Fields:

Validators:

  • __format_fields
  • __extract_item_ids → item_ids

avatar_exp_reward pydantic-field

avatar_exp_reward: int = 0

item_ids pydantic-field

item_ids: list[int]

monster_template_id pydantic-field

monster_template_id: int

world_level pydantic-field

world_level: int = 0

MonsterPhase pydantic-model

Represent one phase of a multi-phase monster.

Attributes:

  • num (int) –

    The number of the phase.

  • max_hp_ratio (float) –

    The ratio of the monster's max HP allotted to this phase.

Fields:

Validators:

  • __format_fields

max_hp_ratio pydantic-field

max_hp_ratio: float

num pydantic-field

num: int

New pydantic-model

Represent new Honkai Star Rail data.

Attributes:

Fields:

Validators:

  • __format_fields

character_ids pydantic-field

character_ids: list[int]

item_ids pydantic-field

item_ids: list[int]

light_cone_ids pydantic-field

light_cone_ids: list[int]

monster_ids pydantic-field

monster_ids: list[int]

relic_set_ids pydantic-field

relic_set_ids: list[int]

version pydantic-field

version: str

PFDetail pydantic-model

Pure Fiction event details.

Attributes:

Fields:

Validators:

ProcessedEnemy pydantic-model

Represents a processed enemy instance in a HSR endgame stage.

Attributes:

  • id (int) –

    The unique monster ID.

  • name (str) –

    The name of the enemy.

  • weaknesses (list[HSRElement]) –

    A list of elements this enemy is weak to.

  • level (int) –

    The level of the enemy.

  • base_hp (int) –

    The calculated HP of the enemy after all multipliers.

  • speed (int | None) –

    The calculated speed value.

  • toughness (int | None) –

    The calculated toughness value.

  • effect_res (float | None) –

    Total status effect resistance value.

  • max_phase (int) –

    The number of HP bars (phases) the enemy has, each with base_hp.

Fields:

Validators:

  • __format_fields

base_hp pydantic-field

base_hp: int

effect_res pydantic-field

effect_res: float | None

id pydantic-field

id: int

level pydantic-field

level: int

max_phase pydantic-field

max_phase: int = 1

name pydantic-field

name: str = ''

speed pydantic-field

speed: int | None

toughness pydantic-field

toughness: int | None

weaknesses pydantic-field

weaknesses: list[HSRElement]

Relic pydantic-model

Represent an HSR relic.

Attributes:

  • id (int) –

    The ID of the relic.

  • name (str) –

    The name of the relic.

  • description (str | None) –

    The description of the relic.

  • story (str | None) –

    The story of the relic.

Fields:

Validators:

  • __format_fields

description pydantic-field

description: str | None = None

icon property

icon: str

Get the relic's icon URL.

id pydantic-field

id: int = 0

name pydantic-field

name: str

story pydantic-field

story: str | None = None

RelicSet pydantic-model

Represent an HSR relic set.

Attributes:

Fields:

Validators:

  • __format_fields
  • __convert_icon → icon
  • __assign_set_effect → set_effect
  • __assign_names

icon pydantic-field

icon: str

id pydantic-field

id: int

name pydantic-field

name: str = ''

names pydantic-field

names: dict[Literal['en', 'zh', 'ko', 'ja'], str]

set_effect pydantic-field

set_effect: RelicSetEffects

RelicSetDetail pydantic-model

Represent an HSR relic set detail.

Attributes:

Fields:

Validators:

  • __format_fields
  • __convert_icon → icon
  • __assign_set_effects → set_effects
  • __convert_parts → parts

icon pydantic-field

icon: str

name pydantic-field

name: str

parts pydantic-field

parts: dict[str, Relic]

set_effects pydantic-field

set_effects: SetDetailSetEffects

RelicSetEffect pydantic-model

Represent a relic set effect.

Attributes:

Fields:

Validators:

  • __format_fields
  • __assign_descriptions

description pydantic-field

description: str = ''

descriptions pydantic-field

descriptions: dict[Literal['en', 'zh', 'ko', 'ja'], str]

parameters pydantic-field

parameters: list[float]

RelicSetEffects pydantic-model

Represent a relic set's set effects.

Attributes:

Fields:

Validators:

  • __format_fields

four_piece pydantic-field

four_piece: RelicSetEffect | None = None

two_piece pydantic-field

two_piece: RelicSetEffect

SetDetailSetEffect pydantic-model

Represent a relic set detail's set effect.

Attributes:

Fields:

Validators:

  • __format_fields
  • __format_parameters

description pydantic-field

description: str

parameters pydantic-field

parameters: list[float]

SetDetailSetEffects pydantic-model

Represent relic set detail's set effects.

Attributes:

Fields:

Validators:

  • __format_fields

four_piece pydantic-field

four_piece: SetDetailSetEffect | None = None

two_piece pydantic-field

two_piece: SetDetailSetEffect

Skill pydantic-model

Represent a character's skill.

Attributes:

Fields:

Validators:

  • __format_fields

description pydantic-field

description: str | None = None

energy_generation pydantic-field

energy_generation: int | None = None

level_info pydantic-field

level_info: dict[str, SkillLevelInfo]

max_level property

max_level: int

Get the skill's maximum level.

name pydantic-field

name: str

tag pydantic-field

tag: str

type pydantic-field

type: str | None = None

SkillLevelInfo pydantic-model

Represent a skill's level information.

Attributes:

Fields:

Validators:

  • __format_fields

level pydantic-field

level: int

parameters pydantic-field

parameters: list[float]

SuperimposeInfo pydantic-model

Represent a light cone's superimpose information.

Attributes:

Fields:

Validators:

  • __format_fields
  • __flatten_parameters

description pydantic-field

description: str

name pydantic-field

name: str

parameters pydantic-field

parameters: dict[str, list[float]]