how to use 100% of my balanced before placing an order?

Hello to all!

I am just getting started with API.
Currently I am using the unofficial PHP library
(GitHub - jaggedsoft/php-binance-api: PHP Binance API is an asynchronous PHP library for the Binance API designed to be easy to use. https://github.com/binance-exchange/php-binance-api)
that interacts with the API.

Here is my question:
Whenever I am placing an order be it (buy/sell) does the comission(fee) is calculates
automatically or I need to calculate it myself?

Example:
Qoute balance: 10000.00 USDT
Base asset BTC price: 5000.00 USDT

When I am placing an order with comission(fee) 0.001

So I am placing a buy order and do I need to substract the fee which is 10.00 USDT
or I need to put quantity of 2 BTC or 1.998 BTC (adjusted with fee)

the same goes with sell order - do i need to just put all of my BTC balance and place an order or
i need to calculate first the fee then place an order?

Or simple said: how to use 100% of my balanced before placing an order?

You can set your quantity and after a trade is complete, the fee will be automatically calculated from it and paid in the base asset for buys or in quote asset for sells.

So in my example i need to put all of my balance in the order (10000.00 USDT)?

If you want to use all your balance and the quote asset is USDT, then yes, you can put quoteOrderQty=10000 USDT.