For the complete documentation index, see llms.txt. This page is also available as Markdown.

Get Cost & Usage Details (non Streaming)

Get cost & usage details (non streaming)

post

Get cost details and usage details in every call

Header parameters
AuthorizationstringRequiredExample: sk-Yf4DN
Body
modelstringRequired
Responses
200Success
application/json
costnumberRequired
createdintegerRequired
idstringRequired
modelstringRequired
objectstringRequired
request_idstringRequired
post/v1/chat/completions
POST /v1/chat/completions HTTP/1.1
Host: llm.onerouter.pro
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 135

{
  "model": "x-ai/grok-4.1-fast-reasoning",
  "messages": [
    {
      "role": "user",
      "content": "What is the meaning of life?"
    }
  ],
  "usage": {
    "include": true
  }
}
200Success
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "42.\n\n(But seriously, according to *The Hitchhiker's Guide to the Galaxy*, that's the answer from Deep Thought after 7.5 million years of computation. The real trick? We forgot the actual question. In truth, the meaning of life is subjective—it's what you make it: love, curiosity, creating something greater than yourself, or just enjoying the cosmic ride. What's yours?)",
        "role": "assistant"
      }
    }
  ],
  "cost": 0.000168,
  "cost_details": {
    "audio_cost": 0,
    "byok_cost": 0,
    "completion_cost": 0.0001585,
    "discount_rate": 1,
    "image_cost": 0,
    "is_byok": false,
    "native_web_search_cost": 0,
    "plugin_web_search_cost": 0,
    "prompt_cache_read_cost": 0.00000755,
    "prompt_cache_write_1_h": 0,
    "prompt_cache_write_5_min": 0,
    "prompt_cache_write_cost": 0,
    "prompt_cost": 0.0000024,
    "reasoning_cost": 0,
    "tools_cost": 0,
    "video_cost": 0
  },
  "created": 1773738521,
  "id": "4caceb70-c51c-f928-0594-5877e824e3cb",
  "model": "x-ai/grok-4.1-fast-reasoning",
  "object": "chat.completion",
  "request_id": "8a365a915cf84ad083866cce1ae1a2de",
  "usage": {
    "completion_tokens": 317,
    "completion_tokens_details": {
      "audio_tokens": 0,
      "image_tokens": 0,
      "reasoning_tokens": 237
    },
    "prompt_tokens": 163,
    "prompt_tokens_details": {
      "audio_tokens": 0,
      "cache_write_tokens": 0,
      "cached_tokens": 151,
      "video_tokens": 0
    },
    "total_tokens": 480
  }
}

Last updated