OpenAI
- ai
- in current work
OpenAI was my way into LLMs. When ChatGPT came out I was curious like everyone else, but it was the API that changed how I work: a model I could call from my own code.
I used it first in the Companies Summary Generator at the end of 2022, summarising thousands of company websites. Then came the Wine Sommelier, where its embeddings search a catalogue of 30,000+ wines and GPT-4o writes the recommendations and pairings; the Funding News Automation; the PDF Data Extractor, where the model fills a fixed schema instead of writing free text; and the LMS Whitelabel, where it sits behind one interface with Anthropic.
I've since moved the writing-heavy work to Claude, but OpenAI is still the API I've logged the most hours with, and when something just has to work across a wide range of tasks, it's still the one I reach for first.
const completion = await client.chat.completions.create({
model: model,
messages: [
{ role: 'system', content: systemMessage },
{ role: 'user', content: userMessage },
],
temperature: 0.9,
max_tokens: 1500,
response_format: { type: 'json_object' },
});
// Safely access the response content
const content = completion.choices[0]?.message?.content;
if (!content) {
throw new Error('GPT response content is empty.');
}
return JSON.parse(content.trim());