{"id":31765590,"url":"https://github.com/johnbean393/context-tester","last_synced_at":"2025-10-10T00:21:03.582Z","repository":{"id":317430561,"uuid":"1066177591","full_name":"johnbean393/Context-Tester","owner":"johnbean393","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-30T19:41:40.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-30T21:27:48.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnbean393.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-29T06:12:32.000Z","updated_at":"2025-09-30T19:41:43.000Z","dependencies_parsed_at":"2025-09-30T21:27:50.571Z","dependency_job_id":null,"html_url":"https://github.com/johnbean393/Context-Tester","commit_stats":null,"previous_names":["johnbean393/context-tester"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/johnbean393/Context-Tester","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbean393%2FContext-Tester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbean393%2FContext-Tester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbean393%2FContext-Tester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbean393%2FContext-Tester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbean393","download_url":"https://codeload.github.com/johnbean393/Context-Tester/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbean393%2FContext-Tester/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002374,"owners_count":26083356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-10T00:21:02.393Z","updated_at":"2025-10-10T00:21:03.574Z","avatar_url":"https://github.com/johnbean393.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Context Window Tester\n\nEfficiently measure the maximum context window size of any LLM using binary search and OpenAI-compatible APIs.\n\n## Quick Start\n\n```bash\n# Install dependencies\npip install openai\n\n# Test a model\npython context_tester.py --endpoint \u003cAPI_ENDPOINT\u003e --api-key \u003cAPI_KEY\u003e --model \u003cMODEL_NAME\u003e\n```\n\n## Examples\n\n```bash\n# OpenAI GPT-4\npython context_tester.py --endpoint \"https://api.openai.com/v1\" --api-key \"sk-...\" --model \"gpt-4\"\n\n# Zhipu GLM-4.6\npython context_tester.py --endpoint \"https://open.bigmodel.cn/api/paas/v4/\" --api-key \"sk-...\" --model \"glm-4.6\"\n\n# Custom bounds\npython context_tester.py --endpoint \"...\" --api-key \"...\" --model \"...\" --lower-bound 1000 --upper-bound 16000\n```\n\n## Options\n\n| Option | Required | Default | Description |\n|--------|----------|---------|-------------|\n| `--endpoint` | Yes | - | API endpoint URL |\n| `--api-key` | No* | - | API key (or use `OPENAI_API_KEY` env var) |\n| `--model` | Yes | - | Model name to test |\n| `--lower-bound` | No | 128,000 | Lower bound for testing (tokens) |\n| `--upper-bound` | No | 2,000,000 | Upper bound for testing (tokens) |\n| `--chars-per-token` | No | 4 | Character-to-token ratio estimate |\n\n*Required unless `OPENAI_API_KEY` environment variable is set.\n\n## How It Works\n\nUses binary search to efficiently find the maximum context length by sending test text of varying sizes to the model. Provides real-time visual progress and reports the maximum successful context size in tokens.\n\n## Compatible APIs\n\nWorks with any OpenAI-compatible API:\n- OpenAI (GPT-3.5, GPT-4, etc.)\n- Anthropic Claude (via compatible wrappers)  \n- Local models (Ollama, vLLM, FastChat)\n- Cloud providers (Azure OpenAI, AWS Bedrock)\n- Custom APIs implementing OpenAI chat format","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbean393%2Fcontext-tester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbean393%2Fcontext-tester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbean393%2Fcontext-tester/lists"}