ModelRefs / Text Completion — AI Glossary

Text Completion — AI Glossary

A legacy LLM API endpoint accepting a raw text prompt and returning a continuation; superseded by the chat completion format.

Overview

Text completion (POST /v1/completions) was the original GPT-3 API interface. It accepts a plain text prompt and returns a completion string. No role structure—suitable for base model prompting and fine-tuned classification models. Deprecated by OpenAI for most use cases in favor of chat completions. Still used for legacy integrations and raw base model access.

Reference details

Topicecosystem
Last reviewed2026-06-24

How it works

  1. The request carries a single string and the response carries its continuation, with no message array and no role structure anywhere in the exchange.
  2. That shape matches what a base language model actually does, which is extend a token sequence, so nothing in the interface implies a conversation.
  3. Because there are no role delimiters, the prompt is exactly the tokens the model receives, which makes few-shot formatting fully explicit and fully the caller's responsibility.
  4. Stop sequences do the work that a turn boundary does in a chat interface, terminating generation when a caller-specified string appears.
  5. Instruction following is not assumed: a base model served this way continues the pattern it was given rather than responding to a request.
  6. Chat interfaces are built on top of this behaviour, serialising a message array into exactly such a string using the delimiter tokens the model was tuned on.

Example: Where the framing overhead is worth avoiding, and where it vanishes

Chat serialisation adds role delimiters around each message, on the order of 4 tokens per message, so a three-message request carries roughly 12 tokens of framing. What that costs depends entirely on the prompt it is added to. On a 50-token classification prompt it is 12 / 50 = 24% overhead; on a 2,000-token prompt it is 12 / 2,000 = 0.6%, which is to say nothing. Priced out on the short case: a 45-token prompt returning a single token costs 0.000045 x $3 + 0.000001 x $15 = $0.00015 raw, and 57 input tokens after framing give 0.000057 x $3 + 0.000001 x $15 = $0.000186, a ratio of about 1.24. Across 50,000,000 classifications that is $7,500 against $9,300, a difference of $1,800. Whether $1,800 justifies maintaining a deprecated code path is a real question with a defensible answer either way, and it is not the main reason the endpoint persists. The structural reason is access: a chat interface wraps the prompt in delimiters the model was instruction-tuned on, so it cannot present a base model with a raw sequence. For base-model research, for log-probability work over exact token strings, and for fine-tuned classifiers that were trained on unwrapped prompts, the completion interface is not a cheaper option but the only one that sends what was intended.

Commonly confused with

Text completion is not a worse chat completion, and treating it as a deprecated predecessor misses what it is for. The two interfaces expose different things: chat exposes an instruction-tuned model through the role structure it was trained on, while completion exposes raw continuation. For an instruction-tuned model the chat interface is strictly better, since matching the training format is what produces good behaviour. For a base model there is no equivalent, because wrapping a raw sequence in chat delimiters changes the input. The second confusion is with the completion of a chat turn, sometimes called prefilling, where an assistant message is begun and the model continues it. That is a chat-interface feature using the role structure, not a use of this endpoint.

When to use it

Reach for it when:

  • For base-model access, where chat delimiters would alter the sequence being sent.
  • On fine-tuned models trained on unwrapped prompts, which expect exactly the format they were tuned on.
  • For log-probability work over an exact token string, where any added framing changes the measurement.
  • On very short high-volume prompts, where framing was 24% overhead against 0.6% on a long one.

Reach for something else when:

  • With instruction-tuned models, which behave best through the role structure they were trained on.
  • For anything multi-turn, where the caller would be reimplementing conversation state the chat interface maintains.
  • For tool use or structured output, which are expressed through the message and role structure this interface lacks.
  • As a cost optimisation on long prompts, where the framing overhead was 0.6% and not worth a deprecated code path.

Continue your research

Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Text Completion — AI Glossary.

Frequently asked questions

What is Text Completion?

A legacy LLM API endpoint accepting a raw text prompt and returning a continuation; superseded by the chat completion format.

What concepts are related to Text Completion?

Closely related concepts include chat completion, few shot, prompt template.