I have been working on my own API (Application Programmer Interface) for the Alpha Framework for a few years now. It is a difficult thing to get right, because invariably you will write it to your taste, which may be at odds with the expected behaviour of the consumers of your API.
Joshua Bloch, author of the seminal Effective Java and several of that language's core APIs gives an excellent presentation on API design principals to his colleagues at Google:
Joshua believes that at some stage, all programmers will write an API whether they realize it or not, but if like me you are deliberately writing an API via a framework implementation, this video is particularly worth watching.
The only disappointment is that the sound is not synced with the video correctly :-(
Updated 2021 : note that the above post is from 2008, but is left here for archival purposes. I have embedded the correct video, but sadly it is only available at 240p resolution.