Skip to Content
kosemdocs
ReferenceAPILlm requests

Get LLM request

Gets a request to one of a project's models, without its prompt or answer. The request log keeps each request for as many days as the organization's plan says (llmgateway.requestLogDays: 7 on Hobby, 30 on Pro, 90 on Team and Enterprise); an older one is not found.

GET
/v1/projects/{project}/llmRequests/{llmRequest}

Gets a request to one of a project's models, without its prompt or answer.

The request log keeps each request for as many days as the organization's plan says (llmgateway.requestLogDays: 7 on Hobby, 30 on Pro, 90 on Team and Enterprise); an older one is not found.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
llmRequest*string

The request's ID.

Match^req_[0-7][0-9a-hjkmnp-tv-z]{25}$

Response Body

OK

application/json
  1. response
alias*string

The alias the request named the model by; it remains after the model is deleted.

cacheReadTokens*integer

Prompt tokens read from the provider's cache.

Formatint64
cacheWriteTokens*integer

Prompt tokens written to the provider's cache.

Formatint64
cost?

What the request cost at the provider's list prices; absent for models whose prices kosem does not know, and for requests not sent.

durationMs*integer

How long the request took, in milliseconds, from when the gateway received it until the answer ended.

Formatint64
errorCode*string

What went wrong, when something did: the gateway's code, such as insufficient_quota, or the provider's, such as overloaded_error.

errorMessage*string

The error's message, cut short. A provider's can quote values from the request.

firstTokenLatencyMs?integer

How long the first piece of a streamed answer took to arrive, in milliseconds; absent for answers not streamed, or with no content.

Formatint64
inputTokens*integer

Prompt tokens neither read from nor written to a cache.

Formatint64
model*string

The project's model called, projects/{project_id}/models/{model_id}.

name*string

Resource name, projects/{project_id}/llmRequests/{llm_request_id}.

operation*string

What the request was to the provider, such as openai.chat_completions, or generate.anthropic.messages for generation in kosem's format.

outcome*string

How the request ended: ANSWERED, with the whole answer, whose providerStatus says whether the provider succeeded; CALLER_LEFT before the answer was whole; BROKEN_OFF before it was whole; TIMED_OUT, longer than a request may last; UNREACHABLE, the provider could not be reached or did not start its answer in time; CREDENTIAL_REFUSED by the provider; REDIRECTED by the provider. Not sent: SPEND_LIMITED, the organization or the project reached its monthly spend limit; BILLING_REFUSED by the organization's billing; RATE_LIMITED, the project ran out of a rate quota, which the log keeps at most once a second for each project; WRONG_FORMAT, the model is not served in the format of the endpoint called.

Value in"ANSWERED""CALLER_LEFT""BROKEN_OFF""TIMED_OUT""UNREACHABLE""CREDENTIAL_REFUSED""REDIRECTED""SPEND_LIMITED""BILLING_REFUSED""RATE_LIMITED""WRONG_FORMAT"
outputTokens*integer

Tokens of the answer, including reasoning.

Formatint64
principal*string

Who made the request, such as user:usr_… or serviceAccount:sa_….

provider*string

The provider the request went through, or would have: organizations/{organization_id}/providers/{provider_id}, or projects/{project_id}/providers/{provider_id} for the project's own.

providerModel*string

The provider's name for the model, such as gpt-5-mini.

providerStatus*integer

The HTTP status the provider answered with; 0 when it did not answer.

Formatint32
providerType*string

The type of the model's provider, such as providerTypes/anthropic.

reasoningTokens*integer

Tokens the model reasoned with, a part of outputTokens.

Formatint64
requestFormat?string

The provider API format the caller used; absent for generation in kosem's format, and for records from before format translation. The operation names what went to the provider, which may use a different format.

Value in"ANTHROPIC_MESSAGES""OPENAI_RESPONSES""OPENAI_CHAT_COMPLETIONS"
source*string

What in kosem made the request, such as an agent, projects/{project_id}/agents/{agent_id}; empty for calls to the API.

sourceModel*string

When the model called is an adoption: the organization's model it adopted, organizations/{organization_id}/models/{model_id}; empty otherwise.

startTime*string

When the gateway received the request.

Formatdate-time
stream*boolean

Whether the answer was streamed.

upstreamRequestId*string

The provider's ID for the request, from its answer.

usageEstimated*boolean

Whether the gateway estimated some of the tokens, because the provider did not report them all, as when the answer broke off.

userAgent*string

The caller's user agent, cut short.

Example Request
curl -X GET 'https://api.kosem.ai/v1/projects/string/llmRequests/string'
Example Response
{
  "alias": "string",
  "cacheReadTokens": 0,
  "cacheWriteTokens": 0,
  "cost": {
    "currencyCode": "string",
    "nanos": -999999999,
    "units": 0
  },
  "durationMs": 0,
  "errorCode": "string",
  "errorMessage": "string",
  "firstTokenLatencyMs": 0,
  "inputTokens": 0,
  "model": "string",
  "name": "string",
  "operation": "string",
  "outcome": "ANSWERED",
  "outputTokens": 0,
  "principal": "string",
  "provider": "string",
  "providerModel": "string",
  "providerStatus": 0,
  "providerType": "string",
  "reasoningTokens": 0,
  "requestFormat": "ANTHROPIC_MESSAGES",
  "source": "string",
  "sourceModel": "string",
  "startTime": "2019-08-24T14:15:22Z",
  "stream": true,
  "upstreamRequestId": "string",
  "usageEstimated": true,
  "userAgent": "string"
}