# chatGPT-4 context lengths

**URL:** <https://community.openai.com/t/chatgpt-4-context-lengths/114919>\
**Category:** API\
**Created:** [March 23, 2023, 8:56am UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919 "2023-03-23T08:56:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![navjordj](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/navjordj/32/53256_2.png) [@navjordj](https://community.openai.com/u/navjordj)\
**Post date:** [March 23, 2023, 8:56am UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/1 "2023-03-23T08:56:49Z")

</div>

Hi.

What is the context length of the GPT-4 model in chatGPT? The [models page](https://platform.openai.com/docs/models/gpt-4) in the openAI documentation says chat optimized GPT-4 has a context length of 8192. While [this paper](https://arxiv.org/pdf/2303.11381.pdf) from Azure AI says that GPT-4 in chatGPT has a context length of 4096.

---

<div class="post-metadata">

**Author:** ![paul.armstrong](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paul.armstrong/32/15511_2.png) [@paul.armstrong](https://community.openai.com/u/paul.armstrong)\
**Post date:** [March 23, 2023, 9:23am UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/2 "2023-03-23T09:23:00Z")

</div>

Hi  
Welcome to the community.

I don’t have access to GPT-4 but I have found that documentation to be reliable in that regard. Remember, these are tokens not characters, and are calculated by the sum of the input and output.  
I hope this helps 🙃

---

<div class="post-metadata">

**Author:** ![navjordj](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/navjordj/32/53256_2.png) [@navjordj](https://community.openai.com/u/navjordj)\
**Post date:** [March 23, 2023, 10:00am UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/3 "2023-03-23T10:00:20Z")

</div>

Thanks for your response.

I was able to find an API endpoint describing the different models thanks to [this repository](https://github.com/terminalcommandnewsletter/everything-chatgpt).

Turns out that the GPT-4 backend for chatGPT only supports 4095 tokens 🙁

Full response from backend-api/models:

```json
{'models': [{'slug': 'text-davinci-002-render-sha',
   'max_tokens': 4097,
   'title': 'Default (GPT-3.5)',
   'description': 'Optimized for speed, currently available to Plus users',
   'tags': [],
   'qualitative_properties': {'reasoning': [3, 5],
    'speed': [5, 5],
    'conciseness': [2, 5]}},
  {'slug': 'text-davinci-002-render-paid',
   'max_tokens': 4097,
   'title': 'Legacy (GPT-3.5)',
   'description': 'The previous ChatGPT Plus model',
   'tags': [],
   'qualitative_properties': {'reasoning': [3, 5],
    'speed': [2, 5],
    'conciseness': [1, 5]}},
  {'slug': 'gpt-4',
   'max_tokens': 4095,
   'title': 'GPT-4',
   'description': 'Our most advanced model, available to Plus subscribers.\n\nGPT-4 excels at tasks that require advanced reasoning, complex instruction understanding, and more creativity.',
   'tags': [],
   'qualitative_properties': {'reasoning': [5, 5],
    'speed': [2, 5],
    'conciseness': [4, 5]}}]}

```

---

<div class="post-metadata">

**Author:** ![navjordj](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/navjordj/32/53256_2.png) [@navjordj](https://community.openai.com/u/navjordj)\
**Post date:** [March 23, 2023, 5:47pm UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/4 "2023-03-23T17:47:07Z")

</div>

I did find out that the context length (max tokens) of GPT-4 in chatGPT is 4095. I don’t believe this is public info and I am not sure why

---

<div class="post-metadata">

**Author:** ![overbeck.christopher](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/overbeck.christopher/32/7035_2.png) [@overbeck.christopher](https://community.openai.com/u/overbeck.christopher)\
**Post date:** [March 23, 2023, 9:27pm UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/5 "2023-03-23T21:27:58Z")

</div>

It is public. Right there in the docs where they list all the model’s and their context.  
GPT-4 is 8k GPT-3.5-Turbo is 4k. They are also planning to come out with a GPT-4-32k, but that’s not available right now.  
You can see how many tokens a string is by using the tiktoken library. Also in the docs.

---

<div class="post-metadata">

**Author:** ![navjordj](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/navjordj/32/53256_2.png) [@navjordj](https://community.openai.com/u/navjordj)\
**Post date:** [March 24, 2023, 9:08am UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/6 "2023-03-24T09:08:14Z")

</div>

I am referring to the GPT-4 model available on [chat.openai.com](http://chat.openai.com) for Plus members. It seems like this version of GPT-4 only supports 4095 tokens and not 8k/32k as for the API endpoints.

---

<div class="post-metadata">

**Author:** ![powercaller](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/powercaller/32/37395_2.png) [@powercaller](https://community.openai.com/u/powercaller)\
**Post date:** [March 29, 2023, 12:07am UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/7 "2023-03-29T00:07:08Z")

</div>

Indeed, it seems it is not the full 8k context and 4k sounds about right. After a long conversation, GPT-4 forgot some earlier details prior. I counted the tokens using the transormers library in python, from beginning to end of the conversation, and it was ~6k.

---

<div class="post-metadata">

**Author:** ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)\
**Post date:** [December 13, 2023, 4:42pm UTC](https://community.openai.com/t/chatgpt-4-context-lengths/114919/9 "2023-12-13T16:42:29Z")

</div>


