OpenAI · ChatGPT · GPT
How to save tokens on the OpenAI and ChatGPT API
You are billed for the text you send, not only the answer you wanted. Tokand sits in front of the OpenAI-compatible call, drops junk from the request, and leaves the model alone.
Where ChatGPT and GPT API bills actually come from
A short question is cheap. The bill grows when the same thread carries old tool output, repeated file dumps, and system text the model already saw. OpenAI prices input tokens and output tokens separately. Cutting input tokens is the lever that does not require a cheaper model. Official pricing is on the OpenAI pricing page.
What to change in the client
Point the OpenAI SDK at Tokand. The rest of the call stays the same: model name, messages, tools, and your own API relationship if you bring your own key.
baseURL: "https://api.tokand.com/v1"
Python is the same idea: construct OpenAI with that base URL. A one-off path is tokand(request, sender). Tokand shrinks the request. Your code still sends it. Tokand does not wrap the model client.
What stays the same
- The model. GPT stays GPT. You are not moved to a smaller model unless you choose that yourself.
- The latest user message. The question you just asked is not rewritten.
- Fail-open. If Tokand times out or errors, the original request goes to the provider. You lose savings for that call, not the product.
When a short prompt should skip the filter
A one-paragraph prompt with nothing to cut should pass through unchanged and record zero saved. A short question sitting on a fat tool trace should still go through Tokand. The gate is the size of the request, not the length of the sentence.
Related searches this page answers
- How to reduce OpenAI API cost
- How to save ChatGPT tokens
- How to lower GPT input token usage
- OpenAI-compatible base URL for cheaper inference
Install steps: quickstart. ChatGPT setup: ChatGPT guide. Codex: Codex guide.