Unfortunately, that's just not directly possible. Once a DML operation has started, you can't perform a callout in the same transaction. This limitation is in place for two reasons: atomicity and limiting database contention.
For atomicity, imagine you were allowed to perform a callout with an in-flight DML operation. Your callout could make permanent modifications to an external system (the callout occurs) and then the DML operation could fail later for some reason, and the external system wouldn't know the transaction rolled back. This limitation prevents that scenario from happening.
For database contention, it's important to note that all databases that use record locking for DML operations risk running into a scenario where multiple transactions try to update the same record at the same time, which can cause some updates to fail as records are locked for too long. To minimize this risk, the engineers designed this limitation to reduce the maximum possible time the database can be locked.
There's a number of possible options for the UI, though. You could use a Flow, Visualforce, Aura, or Lightning Web Component to call the third-party API before saving the record. If you need this behavior from an actual Salesforce API call, you'd have to use a
webservice method or
@RestResource class, and force users to use this custom SOAP/REST endpoint instead of the standard API.