# Optimizing Input Token Usage in API Conversations

**URL:** <https://community.openai.com/t/optimizing-input-token-usage-in-api-conversations/675079>\
**Category:** Prompting\
**Tags:** api, api-optimization, prompts, prompt-optimization\
**Created:** [March 10, 2024, 1:07am UTC](https://community.openai.com/t/optimizing-input-token-usage-in-api-conversations/675079 "2024-03-10T01:07:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezzeldine2001](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ezzeldine2001/32/329941_2.png) [@ezzeldine2001](https://community.openai.com/u/ezzeldine2001)\
**Post date:** [March 10, 2024, 1:07am UTC](https://community.openai.com/t/optimizing-input-token-usage-in-api-conversations/675079/1 "2024-03-10T01:07:19Z")

</div>

Hello everyone,

I am currently using the API and I’m wondering if there is a way to reduce the number of input tokens. During a typical conversation with the API, the input tokens tend to be too extensive, so I’m seeking a solution to this issue.

---

<div class="post-metadata">

**Author:** ![Diet](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/diet/32/562749_2.png) [@Diet](https://community.openai.com/u/Diet)\
**Post date:** [March 10, 2024, 2:05am UTC](https://community.openai.com/t/optimizing-input-token-usage-in-api-conversations/675079/2 "2024-03-10T02:05:18Z")

</div>

@stevenic frequently mentions this tool that he made:

> [@Kruel.ai V5.0 - Api companion with full understanding running 16k thanks to advanced memory system](https://community.openai.com/t/kruel-ai-v5-0-api-companion-with-full-understanding-running-16k-thanks-to-advanced-memory-system/674592/8):
>
> You might take a look at the Python version of my Promptrix library: It’s a library for building prompts but it does a lot of the dynamic token management that you’re doing. It also lets you build hierarchical prompts that it can then squeeze to fit into the context window. Promptrix automatically tries to fit as much information into the context window as it can without overflowing the context window.

> **[GitHub - Stevenic/promptrix-py: Promptrix is a prompt layout engine for Large...](https://github.com/Stevenic/promptrix-py)**
>
> Promptrix is a prompt layout engine for Large Language Models. - Stevenic/promptrix-py

> **[GitHub - Stevenic/promptrix: Promptrix is a prompt layout engine for Large...](https://github.com/Stevenic/promptrix)**
>
> Promptrix is a prompt layout engine for Large Language Models. - Stevenic/promptrix

I haven’t tried it, but it could be a start if you don’t intend to roll your own solution 🤔

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [March 10, 2024, 2:06am UTC](https://community.openai.com/t/optimizing-input-token-usage-in-api-conversations/675079/3 "2024-03-10T02:06:32Z")

</div>

Welcome to the forum.

Great tools by @stevenic …

Try paring down the system prompt small enough so that it still works.

If you share the prompts, we can probably help tighten them up.

Moving this to #Prompting category.
