There are really only a few ways to design a project. In your case, the project includes sizing various structural elements (including the posts which you inquire about), beams, joists, rafters, that type of piece. So you can develop your design at least five different ways:
1. Follow code. Simple, generally conservative, recommended.
2. Develop element sizes using engineering principles. Requires advanced structural knowledge, generally results in a less expensive structure than simply following code, however you have to pay for the design if you can't do it yourself.
3. Copy a design from another project that worked out acceptably. Downside is you have no idea if the design is any good or is cost effective. Advantage is you don't have to pay for plans.
4. Use rules of thumb. Effective for simple elements, works if the rules of thumb are adequate. Downside is you rarely get the most cost effective design, and you have no real idea how strong the structure will be.
5. Guess at the right size. Not recommended, but surprisingly common.
6. Solicit help from someone who has built something similar. This can work out well, but again you don't know how good the design is.
7. Get help from an internet chat forum. May be OK, hard to evaluate the quality of the advice you get.
In your case, I recommend you discuss the project with the local building inspector, they may be willing to direct you to code section specifying post size. There are on line calculators that may be used to estimate post capacity, if you know how to estimate vertical load on your structure, you can calculate the load on the posts, and figure the minimum post size. Make sure you check your post for buckling, that normally controls. Also understand that you have to get all the pieces to lock together, so you may need to notch posts to accept beams.