The Intercepted Requests section will help you achieve this, but you might have to rewrite your cy.intercept() calls.
As stated, you need to use the routeHandler to apply a condition to stub or not you api calls.
cy.intercept('GET', '/yourEndpoint', (req) => {
if (Cypress.config('baseUrl') === 'prodUrl') {
req.continue();
} else {
req.reply(your stub here);
}
});
Edit: Example of cy.intercept() overwrite
I suppose you are using one of these cy.intercept() signatures:

In that case, you would need to use the Cypress.Commands.overwrite() to transform your staticResponse variable into a routeHandler callback to end up with one of these:

Here's an example with the second signature (method, url, staticResponse):
Cypress.Commands.overwrite('intercept', (originalFn, method, url, staticResponse) => {
originalFn(method, url, (req) => {
if (Cypress.config('baseUrl') === 'prodUrl') {
req.continue();
} else {
req.reply(staticResponse);
}
});
});
If you use multiple signatures, you would need a logic to accept 2 or 3 parameters and map them accordingly to originalFn().