MCPcopy
hub / github.com/msgbyte/tianji / getLLMContextWindow

Function getLLMContextWindow

src/server/utils/llm.ts:116–133  ·  view source on GitHub ↗
(modelName: string)

Source from the content-addressed store, hash-verified

114 * @returns The context window in tokens
115 */
116export function getLLMContextWindow(modelName: string): number {
117 let contextWindow = 0;
118
119 for (const provider of Object.values(contextWindowsV2)) {
120 if (contextWindow > 0) {
121 break;
122 }
123
124 for (const model of Object.values(provider.models)) {
125 if (model.id === modelName) {
126 contextWindow = model.limit.context ?? 0;
127 break;
128 }
129 }
130 }
131
132 return contextWindow;
133}
134
135export function getLLMCostDecimalWithCustomPrice(
136 inputToken: number,

Callers 1

env.tsFile · 0.85

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected