Quick guide to staying at peace with AI: works up to Deity
There are 2 options to stay at peace with the AI.
1) Maintain the largest army. You can tell how large your army is relatively from the demographics screen. This is rather expensive, and can be impossible on higher difficulties.
2) Small army, lots of diplomatic manipulation.
In this method you must keep your neighbors perpetually in 1 of 2 states:
A) In a Pact of Cooperation with you.
or
B) At war with another AI (preferably another neighbor to kill 2 birds w/ 1 stone)
For A), it's hard not to provoke the AI, since there are a lot of things that can piss it off. Try to maintain at least one neighbor that you avoid angering at all costs.
For B), this will cost you quite a bit of gold, and will take some practice to get working. Bribes can cost between as little as 100 to over 1000 gold: you must set aside part of your budget for them. Closely monitor the progress of the wars, see when they're about to end (stalemate wars where nothing happens usually end in 10-20 turns), and be ready with another war bribe as soon as they are at peace.
Tips:
-Try to establish 1 or 2 villains that everyone else hates. Sign pacts of secrecy against them with everyone etc. Early in the game try to identify who an AI already dislikes (they will come to you asking for a PoS) and decide who is the best target.
-The early game is the most crucial and most difficult part. You don't have much money or resources to bribe people early on. The amount of time you can wait depends on your neighbors, but usually the critical window where you have to get the AI fighting each other is turns 55-75 (in my experience). If you have a super aggressive neighbor like Japan though, they will often attack before that.
-If you don't have the cash for a bribe on hand, try GPT deals.
-Block their settlers so they don't settle near you. More of an advanced tactic. A wall of 3 guys can block a settler forever if you can guess where they're going.
-Be proactive! Being passive and hoping nobody attacks you is the surest way to get killed off. My most common mistake when learning how to do this was thinking "I'll spend this 500 gold on a city state instead of keeping Bismarck at war, maybe he'll leave me alone for a little while". Of course he wasn't going to leave me alone.
Anyways, this should be possible in most but not all starting conditions. At the most extreme I played an OCC game in the middle of a pangea map and stayed at peace through the whole game despite an army of 2 scouts and a warrior.