> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Word Completion vs Chat Completion

> This article explains the differences between word completion and chat completion in OpenAIs GPT-3.5 Turbo model.

Before integrating a chatbot into your application, it’s essential to understand the difference between **word completion** and **chat completion**. Although both use the same underlying GPT-3.5-Turbo model, their usage patterns—and the way they manage context—are very different.

## What Is Word Completion?

Word completion is a **stateless** API call. You send a single prompt, and the model returns a continuation without retaining any memory of previous interactions.

Key characteristics:

* Single-shot responses
* No conversation history
* Simpler, lower token usage

<Frame>
  ![The image compares "Word Completion" and "Chat Completion," highlighting that word completion doesn't need memory, while chat completion expects context from previous conversations.](https://kodekloud.com/kk-media/image/upload/v1752881500/notes-assets/images/Mastering-Generative-AI-with-OpenAI-Word-Completion-vs-Chat-Completion/word-completion-vs-chat-completion.jpg)
</Frame>

## What Is Chat Completion?

Chat completion is **stateful**. You maintain a record of all messages in a `messages` array, allowing the model to build on past user and assistant exchanges.

### How Chat Completion Works

1. You create an ordered `messages` list.
2. Each entry has a `role`: **system**, **user**, or **assistant**.
3. You submit the full history each time you call the API.
4. The model returns a response that accounts for all previous context.

### Roles in the `messages` Array

| Role      | Description                                                      | Example                                                          |
| --------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
| system    | Sets global instructions or persona                              | “You are a physics professor.”                                   |
| user      | Represents the human’s input at each turn                        | “Explain quantum mechanics in simple terms.”                     |
| assistant | Model-generated responses that continue the conversation context | “Quantum mechanics is the study of matter at very small scales…” |

<Frame>
  ![The image illustrates the difference between word completion and chat completion, showing a user interacting with a system and an LLM (Large Language Model) using chat history as a message parameter.](https://kodekloud.com/kk-media/image/upload/v1752881501/notes-assets/images/Mastering-Generative-AI-with-OpenAI-Word-Completion-vs-Chat-Completion/word-completion-vs-chat-completion-llm.jpg)
</Frame>

<Callout icon="lightbulb" color="#1CB2FE">
  * Use **word completion** for simple text continuations, code generation, or single-turn tasks.
  * Use **chat completion** for multi-turn conversations, contextual assistants, and applications that require stateful interaction.
</Callout>

## Sample Chat Completion Request

```json theme={null}
POST https://api.openai.com/v1/chat/completions
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
  "model": "gpt-3.5-turbo",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user",   "content": "Explain photosynthesis." }
  ]
}
```

## Comparison at a Glance

| Feature           | Word Completion       | Chat Completion                  |
| ----------------- | --------------------- | -------------------------------- |
| Context Handling  | Stateless             | Stateful via `messages` array    |
| Best for          | Single-turn prompts   | Multi-turn conversations         |
| Token Efficiency  | Fewer overhead tokens | More overhead tokens for history |
| Recommended Model | GPT-3.5-Turbo         | GPT-3.5-Turbo                    |

## Further Reading and References

* [OpenAI Chat Completion API Reference](https://platform.openai.com/docs/guides/chat)
* [OpenAI Completion API Reference](https://platform.openai.com/docs/api-reference/completions)
* [Kubernetes Basics](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/)
* [Terraform Registry](https://registry.terraform.io/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/mastering-generative-ai-with-openai/module/36c56a19-11f6-4db1-8bd7-bd6a96c82268/lesson/e97354a8-5b4c-44a6-b50b-4c5d38d8b729" />
</CardGroup>
