in our chat, not voice, We are getting high token ...
# support
q
We are seeing crazy high charges for chat messsages like 5 cents just for a single input and output. I see the token is high is this because of something we have configured incorrectly? @Vapi Support Bot
@Vapi Support Bot
c
Hi Qper, To help manage costs related to chat messages, ensure that you are not creating a new chat for every message. Instead, use the
previousChatId
from the last response to maintain context and avoid extra charges. This way, you can keep the conversation within the same chat session. Here's a code snippet for your API request using the `previousChatId`:
Copy code
js
await fetch('https://api.vapi.ai/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    assistantId: 'your-assistant-id',
    input: 'Your message here',
    previousChatId: 'last-chat-id'
  })
});
This approach will help decrease costs by linking all messages to the initial chat session. For further details, you can refer to the [Vapi session management documentation](https://docs.vapi.ai/chat/session-management).