Skip to content

When you interact with an LLM through its API, is the output still formatted in markdown?

Generation Details

Date LLM Access Method
Nov 2024 GPT-4 Web UI

Summary of Prompt: Daniel asked whether outputs from GPT are formatted in Markdown when accessed programmatically via the API, similar to the web UI.

Yes, when you interact with GPT models via the API, the outputs can include Markdown-formatted text, just like the web UI. The models can generate lists, code blocks, tables, and other markdown elements. The key difference is that, unlike the web UI, the API doesn't automatically render the Markdown—it's returned as plain text with Markdown syntax.

If you want the Markdown to be displayed properly (e.g., code blocks formatted correctly or links rendered), you need to ensure that your interface (like a web app) processes and renders the Markdown appropriately. For web interfaces, this typically involves using a Markdown parser or renderer (e.g., marked in JavaScript or markdown-it).

In short, the Markdown formatting is there, but you’ll need to handle the rendering yourself when using the API.


The above text was generated by a large language model (LLM) and its accuracy has not been validated. This page is part of 'LLMs-on-LLMs,' a Github repository by Daniel Rosehill which explores how curious humans can use LLMs to better their understanding of LLMs and AI. However, the information should not be regarded as authoritative and given the fast pace of evolution in LLM technology will eventually become deprecated. This footer was added at 16-Nov-2024.