Preview images from Stable Diffusion and Dall-E in Insomnia (my new add-on)

An AI-generated painting of a cat in Van Gogh's style

Generative AI endpoints might return Base64-encoded images Recently, I explored the possibility of generating images using locally hosted Stable Diffusion models. Thanks to the AUTOMATIC1111 stable-diffusion-WebUI project, I got the local API working pretty quickly. However, one aspect of working with such APIs is that images come base64-encoded in a JSON property, and one can’t … Read more

OpenAI API: Structured Outputs – generate JSON schema from a class in C#

What problem does the Structured Outputs feature solve When using GPT models from the code, we developers don’t normally want the output to be in a natural language like in ChatGPT conversations. Instead, we want it to have some structure, and the lingua franca today for data interchange is JSON format. Until recently, reliably achieving … Read more

OpenAI JSON mode: wrong schema in the output (fix)

TL/DR: JSON mode remains available as an API feature, but the newest models include the Structured Outputs feature, which solves this problem 100% without workarounds needed. JSON Mode vs Structured Output When we integrate our applications with chatbot-like API, we often prefer to work with data in a structured format like JSON rather than natural … Read more

Running llama3.1 offline: my experiences

Meta AI logo

Discovering Llama: where does it stand compared with gpt-4o? Today, I was looking for an AI model that would perform best with a non-mainstream task: translating text between two Slavic languages. This was a good opportunity to use the LMSYS Chatbot Arena. The service allows you to perform a blind test of two random modern … Read more

OpenAI – using Batch API (with 50% discount) in C#

What is OpenAI Batch API? The pricing page for OpenAI services has an annotation that drew my attention recently: *Batch API pricing requires requests to be submitted as a batch. Responses will be returned within 24 hours for a 50% discount. I pretended not to see this option for a while because using batch jobs … Read more

ChatGPT seems signed out every time I visit – a fix

ChatGPT logo

Here’s a short hint that helped me resolve an annoying issue of ChatGPT signing me out very often. It’s a service I have bookmarked and I use frequently, yet it seemed to be more stubborn than most apps and I was signed out every day I opened it 😉 And especially if you use two-factor … Read more

ChatGPT API: remove JSON indentation to reduce your bills

Observing default behavior: JSON is indented, and we pay for it While working with ChatGPT API, I noticed that the JSON response I normally receive contains many whitespace characters used for indentation. Here’s a fragment of the response as an illustration: Output tokens still cost quite a lot in 2024 (assuming we process lots of … Read more

OpenAI Text To Speech (tts-1) and Polish language

Does OpenAI Text to Speech support languages other than English? OpenAI’s Text-to-Speech service transforms text into audio files with impressive quality when we consider English language. I haven’t performed a blind test, but based on a few samples I heard, I don’t think I could easily recognize if the audio were recorded by a real … Read more

DALL-E 3: comparison of Standard vs HD quality

What is the new quality parameter in DALL-E 3 API? DALL-E 3 introduced a new API parameter, quality. The documentation explains: quality (standard or hd. Defaults to standard) The quality of the image that will be generated. hd creates images with finer details and greater consistency across the image. This param is only supported for … Read more