Styling for dynamic data in CM6

I am doing something similar and I have used a simple custom stream language. Hopefully this will help you.

export const yourLang = StreamLanguage.define({
token(stream: StringStream) {

// say, this returns array of token object with value and style tag info
const tokens = callMyApi(stream.string);

for (const tkn of tokens) {
  if (stream.match(tkn.value)) return tkn.styleTag;
}
stream.next();
return null;

},
});

Style tags are defined here
or you can define your own tags
or you can use mark decorations as completely custom solution.