---
title: "Check an LLM context window from the command line"
url: https://recursiveai.org/onellm/cookbook/inspect-model-context-window-offline/
description: "Check an LLM model’s context window from the command line. OneLLM shows the local catalog value and which layer set it, with no API key."
version: "1.0.1"
---

# Check an LLM context window from the command line

**OneLLM** is a free, open-source LLM and agent library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneLlm.Cli) · [GitHub](https://github.com/recursive-ai-oss/onellm-csharp) · [Docs](https://recursiveai.org/onellm/docs/) · [Download example (.zip)](https://recursiveai.org/onellm/cookbook/inspect-model-context-window-offline/inspect-model-context-window-offline.zip)

Look up how many tokens a model can work with at once, without calling the model.

```shell
dotnet tool install -g RecursiveAI.OneLlm.Cli
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```shell
onellm catalog gpt-6-luna
```

Unzip [the example](https://recursiveai.org/onellm/cookbook/inspect-model-context-window-offline/inspect-model-context-window-offline.zip), then `dotnet run`.

Replace `gpt-6-luna` with any model name from the catalog. To list the names, run `onellm catalog` with no arguments.

The tool prints the model’s fields, including these lines. `[shipped]` means the value came from the catalog embedded in the package.

```text
model: openai:gpt-6-luna
provider: openai
name: "gpt-6-luna"	[shipped]
displayName: "GPT-6 Luna"	[shipped]
kind: "chat"	[shipped]
contextWindow: 1050000	[shipped]
maxOutputTokens: 128000	[shipped]
```

If the name matches more than one provider, the tool lists the matches. Use `provider:model` to choose one.

## The full program

The full program needs `Example.csproj` from the zip: the project sets the `CatalogTool` assembly attribute that the program reads to find the CLI. The download uses the same `catalog` command through the pinned `RecursiveAI.OneLlm.Cli` package. `dotnet run` restores the tool package and runs it without a global tool install. It prints the entry shown above, followed by capability and pricing fields. Only the package restore needs NuGet access or a populated package cache.

```csharp
using System.Diagnostics;
using System.Reflection;

// Run the same catalog command as the installed onellm tool.
var tool = Assembly.GetExecutingAssembly()
    .GetCustomAttributes<AssemblyMetadataAttribute>()
    .Single(item => item.Key == "CatalogTool").Value!;
var start = new ProcessStartInfo
{
    FileName = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH")
        ?? "dotnet",
    ArgumentList = { tool, "catalog", "gpt-6-luna" }
};
using var process = Process.Start(start)!;
await process.WaitForExitAsync();
return process.ExitCode;
```

## Variations

**List the catalog names and windows together.** Without a model name, the tool prints one tab-separated row per entry. Find the model in the first column and read its window from the second.

```shell
onellm catalog
```

The list includes this row:

```text
openai:gpt-6-luna	1050000
```

## Related recipes

- [Connect to an OpenAI-compatible server](https://recursiveai.org/onellm/cookbook/connect-openai-compatible-server/)
- [Cap LLM cost per request](https://recursiveai.org/onellm/cookbook/limit-llm-spend-before-request/)

## The short answer

Install the `RecursiveAI.OneLlm.Cli` tool, then run `onellm catalog` with a model name. Read `contextWindow` for the window and the bracketed label for where the value came from. The lookup reads local catalog data rather than querying a provider endpoint. It doesn’t tell you whether your account or deployment can use that window.

## How does the LLM context window work?

The context window is a limit on what the model can process together, not a count of characters in the last message. When planning a request, account for the system prompt and earlier turns you send along with the new prompt and documents. The [OneLLM counting docs](https://recursiveai.org/onellm/docs/pricing-and-counting/#token-counting) describe allowances for messages, tools, images and other files in addition to text.

`contextWindow` and `maxOutputTokens` describe different limits. The first is the model’s catalog window; the second is a cap on generated output. Neither says how many tokens your current conversation occupies. Some entries also have a separate input limit; the example prints it as `properties.maxInputTokens` farther down. Don’t size a prompt using the window alone: check the input and output limits for the endpoint you actually use.

## What are the context window limitations for LLMs?

The terminal command tells you what OneLLM knows locally, not how your particular server is configured. If your deployment imposes a smaller window than the catalog lists, use the deployment’s documented limit. If you maintain [catalog overrides](https://recursiveai.org/onellm/docs/spec-catalog/#layers), check which layer supplied `contextWindow` before assuming everyone running the same command will see the same number.

The [catalog specification](https://recursiveai.org/onellm/docs/spec-catalog/) defines three sources: `shipped` for the embedded data, `user` for user files, and `code` for overrides set in code. Higher layers replace individual fields, so an override of the window doesn’t have to replace the model’s other settings. The source label identifies the winning layer, not the vendor documentation or a measurement of a live run.
