An electric media gap machine (10) for a compressor and/or a turbine, having a shaft (5) which is rotatably mounted in a housing (6) and on which a rotor (11) is arranged in a rotationally fixed fashion, having a stator (12) which is fixed to the housing and which has at least one multi-phase drive winding (16) for generating a drive magnetic field and a plurality of stator teeth (15) which protrude radially inward, and having a device (17) which is fixed to the stator and has the purpose of optimizing the flow for a medium which flows through the media gap machine, wherein the device (17) has a cover cap (18) which covers at least the rotor (11) upstream, wherein an inner sleeve (19) adjoins the cover cap (18) and completely surrounds the rotor (11) circumferentially and axially, at least in certain sections, and wherein the device (17) has an outer sleeve (23) which is arranged coaxially with respect to the inner sleeve (19), so that the only flow path for the medium between the inner sleeve (19) and the outer sleeve (23) is formed only through the stator (12) of the media gap machine.