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.
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.
bearerAuthorizationBearer <token>An access token, or an API key.
project*stringThe project's ID.
^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$llmRequest*stringThe request's ID.
^req_[0-7][0-9a-hjkmnp-tv-z]{25}$OK
application/json- response
alias*stringThe alias the request named the model by; it remains after the model is deleted.
cacheReadTokens*integerPrompt tokens read from the provider's cache.
int64cacheWriteTokens*integerPrompt tokens written to the provider's cache.
int64cost?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*integerHow long the request took, in milliseconds, from when the gateway received it until the answer ended.
int64errorCode*stringWhat went wrong, when something did: the gateway's code, such as insufficient_quota, or the provider's, such as overloaded_error.
errorMessage*stringThe error's message, cut short. A provider's can quote values from the request.
firstTokenLatencyMs?integerHow long the first piece of a streamed answer took to arrive, in milliseconds; absent for answers not streamed, or with no content.
int64inputTokens*integerPrompt tokens neither read from nor written to a cache.
int64model*stringThe project's model called, projects/{project_id}/models/{model_id}.
name*stringResource name, projects/{project_id}/llmRequests/{llm_request_id}.
operation*stringWhat the request was to the provider, such as openai.chat_completions, or generate.anthropic.messages for generation in kosem's format.
outcome*stringHow 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.
"ANSWERED""CALLER_LEFT""BROKEN_OFF""TIMED_OUT""UNREACHABLE""CREDENTIAL_REFUSED""REDIRECTED""SPEND_LIMITED""BILLING_REFUSED""RATE_LIMITED""WRONG_FORMAT"outputTokens*integerTokens of the answer, including reasoning.
int64principal*stringWho made the request, such as user:usr_… or serviceAccount:sa_….
provider*stringThe 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*stringThe provider's name for the model, such as gpt-5-mini.
providerStatus*integerThe HTTP status the provider answered with; 0 when it did not answer.
int32providerType*stringThe type of the model's provider, such as providerTypes/anthropic.
reasoningTokens*integerTokens the model reasoned with, a part of outputTokens.
int64requestFormat?stringThe 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.
"ANTHROPIC_MESSAGES""OPENAI_RESPONSES""OPENAI_CHAT_COMPLETIONS"source*stringWhat in kosem made the request, such as an agent, projects/{project_id}/agents/{agent_id}; empty for calls to the API.
sourceModel*stringWhen the model called is an adoption: the organization's model it adopted, organizations/{organization_id}/models/{model_id}; empty otherwise.
startTime*stringWhen the gateway received the request.
date-timestream*booleanWhether the answer was streamed.
upstreamRequestId*stringThe provider's ID for the request, from its answer.
usageEstimated*booleanWhether the gateway estimated some of the tokens, because the provider did not report them all, as when the answer broke off.
userAgent*stringThe caller's user agent, cut short.
curl -X GET 'https://api.kosem.ai/v1/projects/string/llmRequests/string'{
"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"
}