Skip to content

Support chat inside your product

Answer questions inside your product with a streaming chat model through the OpenAI-compatible endpoint. Each tenant is a customer tag, so the cost of the assistant is known per account.

Simulated run Simulated · no API call 0:09.6

Request

POST https://api.tovano.ai/v1/chat/completions
Authorization: Bearer $TOVANO_API_KEY
Content-Type: application/json
X-Tovano-Customer: tenant-1093

{
  "model": "text/demo-chat-1",
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "messages": [
    {
      "role": "system",
      "content": "You are the support assistant for a payroll product. Answer only from the help-centre excerpts below. …"
    },
    {
      "role": "user",
      "content": "How do I correct a payslip after it has been sent?"
    }
  ]
}

Response · Last chunk before [DONE]

{
  "id": "chatcmpl_7b9a836b04",
  "object": "chat.completion.chunk",
  "model": "text/demo-chat-1",
  "choices": [],
  "usage": {
    "prompt_tokens": 3120,
    "completion_tokens": 410,
    "total_tokens": 3530
  },
  "tovano": {
    "task_id": "tsk_a471ed2469fc",
    "charged_micro": 4760
  }
}

Tasks

7 tasks

  1. tenant-1093 · payslip correction

    tsk_a471ed2469fc · 3,120 in · 410 out tokens

    Completed $0.00476
  2. tenant-0218 · leave balance

    tsk_7c28fd439bac · 2,480 in · 350 out tokens

    Completed $0.00388
  3. tenant-0771 · tax code change

    tsk_3f4d0a7258fe · 4,010 in · 520 out tokens

    Completed $0.00609
  4. tenant-1093 · bank details

    tsk_25da86f96c0e · 2,890 in · 300 out tokens

    Completed $0.00409
  5. tenant-0450 · overtime rules

    tsk_3fbe0450f840 · 3,550 in · 460 out tokens

    Completed $0.00539
  6. tenant-0218 · new starter

    tsk_379c563fed7e · 1,980 in · 240 out tokens

    Completed $0.00294
  7. tenant-0904 · year-end report

    tsk_fac0636ec054 · 3,300 in · 380 out tokens

    Completed $0.00482
Reserved $0.000 Charged $0.03197

Output

How do I correct a payslip after it has been sent?

Issue a correction run. Open Payroll, choose the pay period and the employee, then select Correct payslip. The employee receives the corrected payslip, the original is marked as replaced, and any difference is carried into the next run. If the period is already closed, reopen it first under Settings, Pay periods.

Events

  1. 0:00.0POST /v1/chat/completions · 7 requests streaming
  2. 0:05.0tsk_7c28fd439bac completed · $0.00388
  3. 0:06.0tsk_25da86f96c0e completed · $0.00409
  4. 0:07.2tsk_a471ed2469fc completed · $0.00476
  5. 0:07.2tsk_3f4d0a7258fe completed · $0.00609
  6. 0:07.2tsk_379c563fed7e completed · $0.00294
  7. 0:08.2tsk_3fbe0450f840 completed · $0.00539
  8. 0:08.8tsk_fac0636ec054 completed · $0.00482
  9. 0:09.6Done · 7 tasks · $0.03197 charged

A played-back run with realistic requests, responses and charges. No API call is made and no key is used. Times are compressed.

Cost of this run

$0.03197 for 7 tasks

ModelAmount
Demo Chat 1
text/demo-chat-121,330 input tokens × $1.00 / 1M input tokens
$0.02133
Demo Chat 1
text/demo-chat-12,660 output tokens × $4.00 / 1M output tokens
$0.01064
Total$0.03197

Unit prices from the model catalogue, in US dollars, excluding tax. Agent jobs are charged per step at each step model's price.

At your volume

What a month costs

3,000,000 replies × $0.0048 $14,400.00 Per reply: 3,200 input tokens × $1.00 + 400 output tokens × $4.00.

List prices. Committed-volume pricing, invoicing and an SLA are agreed in your contract. Talk to sales

How it works

Three calls you would write anyway.

  1. 1

    Use the client you have

    The chat endpoint speaks the OpenAI format, including streaming. Point an existing client at api.tovano.ai/v1 and keep your code.

  2. 2

    Tenant as customer tag

    Send X-Tovano-Customer with every request. Token spend per tenant comes back from /v1/usage, ready for a usage-based plan or a fair-use limit.

  3. 3

    Charge in the stream

    The last chunk carries the token counts and the exact charge, so you can log the cost of every reply next to the conversation.

The code

Copy it, add your key, run it.

The same request in curl, TypeScript and Python. The TypeScript client is tovano on npm.

curl https://api.tovano.ai/v1/chat/completions \
  -H "Authorization: Bearer $TOVANO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Tovano-Customer: tenant-1093" \
  -d '{
    "model": "text/demo-chat-1",
    "stream": true,
    "stream_options": { "include_usage": true },
    "messages": [
      { "role": "system", "content": "You are the support assistant for a payroll product. Answer only from the help-centre excerpts below." },
      { "role": "user", "content": "How do I correct a payslip after it has been sent?" }
    ]
  }'
# Server-sent events. The last chunk has "usage" and "tovano": { "task_id", "charged_micro" }.

More examples

What else teams run at volume.

All examples

Run it on your volume, with your contract.

Committed-volume pricing, monthly invoices, higher limits and a named contact for teams that run AI in production.