How to structure reusable response models in FastAPI for multiple content formats?
07:44 20 Apr 2026

I’m working on a FastAPI backend that generates different types of content (social posts, blogs, emails).

Many responses share common fields (id, metadata, generated text), but each format also has some unique fields.

Right now I’ve created separate response models for each type, but there’s a lot of duplication.

I’m considering:

- using a base model and extending it

- or keeping separate models for clarity

What’s the recommended way to structure response models in FastAPI for this kind of use case?

model backend fastapi content-management-system field