how does openai api work