File size: 3,747 Bytes
1477a90 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
import { type Client } from '../core.js'
import { unwrap, type RequestOptions } from '../lib/types.js'
import { paginatePages } from '../lib/paginate.js'
import {
listLlmCostPrices,
getLlmCostPrice,
listLlmCostOverrides,
createLlmCostOverride,
deleteLlmCostOverride,
} from '../funcs/llmCost.js'
import type {
ListLlmCostPricesRequest,
ListLlmCostPricesResponse,
GetLlmCostPriceRequest,
GetLlmCostPriceResponse,
ListLlmCostOverridesRequest,
ListLlmCostOverridesResponse,
CreateLlmCostOverrideRequest,
CreateLlmCostOverrideResponse,
DeleteLlmCostOverrideRequest,
DeleteLlmCostOverrideResponse,
} from '../models/operations/llmCost.js'
import type { LlmCostPrice } from '../models/types.js'
export class LLMCost {
constructor(private readonly _client: Client) {}
/**
* List LLM cost prices
*
* List global LLM cost prices. Returns prices with overrides applied if any.
*
* GET /openmeter/llm-cost/prices
*/
async listPrices(
request?: ListLlmCostPricesRequest,
options?: RequestOptions,
): Promise<ListLlmCostPricesResponse> {
return unwrap(await listLlmCostPrices(this._client, request, options))
}
/**
* List LLM cost prices
*
* List global LLM cost prices. Returns prices with overrides applied if any.
*
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
*
* GET /openmeter/llm-cost/prices
*/
listPricesAll(
request?: ListLlmCostPricesRequest,
options?: RequestOptions,
): AsyncIterable<LlmCostPrice> {
return paginatePages(
(req, opts) => listLlmCostPrices(this._client, req, opts),
request ?? {},
options,
)
}
/**
* Get LLM cost price
*
* Get a specific LLM cost price by ID. Returns the price with overrides applied if
* any.
*
* GET /openmeter/llm-cost/prices/{priceId}
*/
async getPrice(
request: GetLlmCostPriceRequest,
options?: RequestOptions,
): Promise<GetLlmCostPriceResponse> {
return unwrap(await getLlmCostPrice(this._client, request, options))
}
/**
* List LLM cost overrides
*
* List per-namespace price overrides.
*
* GET /openmeter/llm-cost/overrides
*/
async listOverrides(
request?: ListLlmCostOverridesRequest,
options?: RequestOptions,
): Promise<ListLlmCostOverridesResponse> {
return unwrap(await listLlmCostOverrides(this._client, request, options))
}
/**
* List LLM cost overrides
*
* List per-namespace price overrides.
*
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
*
* GET /openmeter/llm-cost/overrides
*/
listOverridesAll(
request?: ListLlmCostOverridesRequest,
options?: RequestOptions,
): AsyncIterable<LlmCostPrice> {
return paginatePages(
(req, opts) => listLlmCostOverrides(this._client, req, opts),
request ?? {},
options,
)
}
/**
* Create LLM cost override
*
* Create a per-namespace price override.
*
* POST /openmeter/llm-cost/overrides
*/
async createOverride(
request: CreateLlmCostOverrideRequest,
options?: RequestOptions,
): Promise<CreateLlmCostOverrideResponse> {
return unwrap(await createLlmCostOverride(this._client, request, options))
}
/**
* Delete LLM cost override
*
* Delete a per-namespace price override.
*
* DELETE /openmeter/llm-cost/overrides/{priceId}
*/
async deleteOverride(
request: DeleteLlmCostOverrideRequest,
options?: RequestOptions,
): Promise<DeleteLlmCostOverrideResponse> {
return unwrap(await deleteLlmCostOverride(this._client, request, options))
}
}
|