Can I get the `max tokens` information from openai api

I want to include different models in my project, but each model has its own limit for max tokens . Although I have read the API documentation, I couldn’t find any way to retrieve this information through API calls.
Currently, my approach is to manually read the API documentation and hard code this information in my project. Is there an easier way to get this information?

3 Likes