# What is the context window of the the new GPT 3.5 Turbo model (gpt-3.5-turbo-0125)?

**URL:** <https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532>\
**Category:** API\
**Created:** [February 1, 2024, 12:40am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532 "2024-02-01T00:40:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathancardoso](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jonathancardoso](https://community.openai.com/u/jonathancardoso)\
**Post date:** [February 1, 2024, 12:40am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/1 "2024-02-01T00:40:19Z")

</div>

[The recent announcement](https://openai.com/blog/new-embedding-models-and-api-updates) mentioned a new GPT 3.5 Turbo model (gpt-3.5-turbo-0125). Qs:

- Is it a replacement for gpt-3.5-turbo-1106?
- Does it have 16k context window?

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [February 1, 2024, 3:51am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/2 "2024-02-01T03:51:13Z")

</div>

It is supposed to be a replacement for the flaws encountered in writing functions, multilingual encoding, poor instruction following, denials, and general inability to fulfill tasks in this model:

| Model | Description | Context window | Training data |
| --- | --- | --- | --- |
| gpt-3.5-turbo-1106 | The latest GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. [Learn more](https://openai.com/blog/new-models-and-developer-products-announced-at-devday). | 16,385 tokens | Up to Sep 2021 |

So the specifications are expected to be the same.

---

<div class="post-metadata">

**Author:** ![SomebodySysop](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/somebodysysop/32/17613_2.png) [@SomebodySysop](https://community.openai.com/u/SomebodySysop)\
**Post date:** [February 3, 2024, 12:37pm UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/3 "2024-02-03T12:37:47Z")

</div>

You sure about that? With gpt-3.5-turbo alias I am getting: “Error occurred (getChatCompletionOpenAI): This model’s maximum context length is 4097 tokens. However, your messages resulted in 4140 tokens. Please reduce the length of the messages.”

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [February 3, 2024, 12:44pm UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/4 "2024-02-03T12:44:26Z")

</div>

> [@SomebodySysop](#):
>
> gpt-3.5-turbo alias

`gpt-3.5-turbo` as an alias has never left being directed to `gpt-3.5-turbo-0613` as the stable model.

The schedule for re-pointing to -0125 is “two weeks after release” according to the blog.

The API return will tell you what model you are getting the response from.

The error will tell you what input context length you exceeded.

> openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “This model’s maximum context length is 16385 tokens. However, your messages resulted in 18565 tokens (18478 in the messages, 87 in the functions). Please reduce the length of the messages or functions.”, ‘type’: ‘invalid\_request\_error’, ‘param’: ‘messages’, ‘code’: ‘context\_length\_exceeded’}}

or what output limitations have been placed making it not a -16k model replacement:

> openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘max\_tokens is too large: 4500. This model supports at most 4096 completion tokens, whereas you provided 4500.’, ‘type’: ‘invalid\_request\_error’, ‘param’: ‘max\_tokens’, ‘code’: None}}

---

<div class="post-metadata">

**Author:** ![BackCode](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@BackCode](https://community.openai.com/u/BackCode)\
**Post date:** [February 10, 2024, 2:51am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/5 "2024-02-10T02:51:34Z")

</div>

I explicitly set the model to ‘gpt-3.5-turbo-0125’ and on the page you show ([https://platform.openai.com/docs/models/gpt-3-5-turbo](https://platform.openai.com/docs/models/gpt-3-5-turbo)) , the docs quote a 16k window, but it will only accept 4k tokens.  
🙁

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [February 10, 2024, 4:53am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/6 "2024-02-10T04:53:47Z")

</div>

> [@BackCode](#):
>
> but it will only accept 4k tokens

Solution: set max\_tokens to 2000. Not a big number.

The API parameter max\_tokens sets the maximum **response length**. It is the parameter that I set to 4500 tokens to get the second error shown. OpenAI doesn’t let the newest AI models write more than that.

max\_tokens reserves part of the model context length solely for the output (by formula). It does not have anything to do with the total amount you can send to the remaining context window length.

---

<div class="post-metadata">

**Author:** ![BackCode](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@BackCode](https://community.openai.com/u/BackCode)\
**Post date:** [February 11, 2024, 12:21am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/7 "2024-02-11T00:21:56Z")

</div>

So unlike the gpt-3.5-turbo-16k model, I have to set max\_tokens in my api call - to something less than what the model already knows is the max tokens? I have a large input, and don’t generate much for the output in my use case. I’ve never explicitly set max\_tokens when using the -16k models - thus my confusion I think.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [February 11, 2024, 2:04am UTC](https://community.openai.com/t/what-is-the-context-window-of-the-the-new-gpt-3-5-turbo-model-gpt-3-5-turbo-0125/609532/8 "2024-02-11T02:04:25Z")

</div>

I’ll make it really clear, in code you can run also in Python 3.8-3.11 with `openai` library:

```auto
from openai import OpenAI
client = OpenAI()

params = {
  "model":"gpt-3.5-turbo-0125", "max_tokens":1,
  "messages":[{"role": "system", "content": "Say hello back."}]
  }

for _ in range(80): # add assistant + user 80 times
    params['messages'].extend([
        {"role": "assistant", "content": "@!" * 45},
        {"role": "user", "content": "Hello!"},
        ]) # 100 tokens total

completion = client.chat.completions.create(**params)

print(completion.choices[0].message.content)
print(completion.usage.model_dump())

```

### Response:

```auto
Hello
{'completion_tokens': 1, 'prompt_tokens': 8011, 'total_tokens': 8012}

```

### Analysis

- I sent 8000 tokens besides the system message and its overhead.

- I got a report back showing the `prompt tokens` of my input.

- I got a report back showing the response was truncated at just 1 token, the output limit I set with `max_tokens`.

- Conclusion: I can send the big input without error to `gpt-3.5-turbo-0125`.

> **(Actually I had to work around OpenAI being a jerk about testing)**
>
> openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “Sorry! We’ve encountered an issue with repetitive patterns in your prompt. Please try again with a different prompt.”, ‘type’: ‘invalid\_request\_error’, ‘param’: ‘prompt’, ‘code’: None}}

The AI model context length is 16384.

If I set the response to `max_tokens: 1000`, that would be plenty of room for the AI to write the rest of its “how can I help you today?” without it being cut off at the first token.

I would then only have 15384 tokens remaining to send input because max\_tokens also “reserves” the amount from the context length.
