NikoVonLas beware of performance issues.
As we discussed on Discord with Drillbert (I don't think you are thr same person ?), a single request could include many users. For example an API call for the list of discussions could contain discussion author and last reply author. In normal case I think 20 results are asked, so up to 40 users possible. The API allows up to 50 discussions requested at once, so up to 100 users.
This means a lot of database queries in a single API request.
The ideal solution would employ Eloquent relationships to load all of the data at once, but it requires adding code in multiple other places of the Flarum API. Another solution would be to cache the display names so fetching does not require a database query every time.
Maybe I'm over-thinking and your performance is fine, I'm curious to know how it performs for you.