{"id":30583969,"url":"https://github.com/sensoris/semcache","last_synced_at":"2025-08-29T09:02:49.614Z","repository":{"id":299865390,"uuid":"980628761","full_name":"sensoris/semcache","owner":"sensoris","description":"Semantic caching layer for your LLM applications. Reuse responses and reduce token usage.","archived":false,"fork":false,"pushed_at":"2025-06-18T17:40:45.000Z","size":396,"stargazers_count":67,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-18T18:27:23.105Z","etag":null,"topics":["anthropic","gemini","genai","llm","openai","semantic-cache"],"latest_commit_sha":null,"homepage":"https://semcache.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sensoris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-05-09T12:52:10.000Z","updated_at":"2025-06-18T17:40:48.000Z","dependencies_parsed_at":"2025-06-18T18:28:11.371Z","dependency_job_id":"19028d44-4cdf-4022-b872-cbe9d6624169","html_url":"https://github.com/sensoris/semcache","commit_stats":null,"previous_names":["sensoris/semcache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sensoris/semcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensoris%2Fsemcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensoris%2Fsemcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensoris%2Fsemcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensoris%2Fsemcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sensoris","download_url":"https://codeload.github.com/sensoris/semcache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensoris%2Fsemcache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272658762,"owners_count":24971604,"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-08-29T02:00:10.610Z","response_time":87,"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":["anthropic","gemini","genai","llm","openai","semantic-cache"],"created_at":"2025-08-29T09:02:48.357Z","updated_at":"2025-08-29T09:02:49.602Z","avatar_url":"https://github.com/sensoris.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# ⚡ semcache\n\n`semcache` is a semantic caching layer for your LLM applications. \n\n- [semcache website](https://semcache.io)\n- [semcache docs](https://docs.semcache.io)\n\n## Quick Start\n\nStart the Semcache Docker image:\n\n```bash\ndocker run -p 8080:8080 semcache/semcache:latest\n```\n\nConfigure your application e.g with the OpenAI Python SDK:\n\n```python\nfrom openai import OpenAI\n\n# Point to your Semcache host instead of OpenAI\nclient = OpenAI(base_url=\"http://localhost:8080\", api_key=\"your-key\")\n\n# Cache miss - continues to OpenAI\nresponse = client.chat.completions.create(\n    model=\"gpt-4o\",\n    messages=[{\"role\": \"user\", \"content\": \"What is the capital of France?\"}]\n)\n\n# Cache hit - returns instantly \nresponse = client.chat.completions.create(\n    model=\"gpt-4o\",\n    messages=[{\"role\": \"user\", \"content\": \"Tell me France's capital city\"}]\n)\n```\n\nNode.js follows a similar pattern of changing the base URL to point to your Semcache host:\n\n```js\nconst OpenAI = require('openai');\n\n// Point to your Semcache host instead of OpenAI\nconst openai = new OpenAI({baseURL: 'http://localhost:8080', apiKey: 'your-key'});\n```\n\n## Features\n\n- **🧠 Completely in-memory** - Prompts, responses and the vector database are stored in-memory\n- **🎯 Flexible by design** - Can work with your custom or private LLM APIs\n- **🔌 Support for major LLM APIs** - OpenAI, Anthropic, Gemini, and more\n- **⚡ HTTP proxy mode** - Drop-in replacement that reduces costs and latency\n- **📈 Prometheus metrics** - Full observability out of the box\n- **📊 Build-in dashboard** - Monitor cache performance at `/admin`\n- **📤 Smart eviction** - LRU cache eviction policy\n\n\n**Semcache is still in beta and being actively developed.**\n\n## How it works\n\nSemcache accelerates LLM applications by caching responses based on semantic similarity.\n\nWhen you make a request Semcache first searches for previously cached answers to similar prompts and delivers them immediately. This eliminates redundant API calls, reducing both latency and costs.\n\nSemcache also operates in a \"cache-aside\" mode, allowing you to load prompts and responses yourself.\n\n## Example Integrations\n\nFor comprehensive provider configuration and detailed code examples, visit our [LLM Providers \u0026 Tools documentation](https://docs.semcache.io/docs/llm-providers-tools).\n\n### HTTP Proxy\n\nPoint your existing SDK to Semcache instead of the provider's endpoint.\n\n**OpenAI**\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"http://localhost:8080\", api_key=\"your-key\")\n```\n\n**Anthropic**\n```python\nimport anthropic\n\nclient = anthropic.Anthropic(\n    base_url=\"http://localhost:8080\",  # Semcache endpoint\n    api_key=\"your-key\"\n)\n```\n\n**LangChain**\n```python\nfrom langchain.llms import OpenAI\n\nllm = OpenAI(\n    openai_api_base=\"http://localhost:8080\",\n    openai_api_key=\"your-key\"\n)\n```\n\n**LiteLLM**\n```python\nimport litellm\n\nlitellm.api_base = \"http://localhost:8080\"\n```\n\n\n### Cache-aside\nInstall with:\n```bash\npip install semcache\n```\n\n```python\nfrom semcache import Semcache\n\n# Initialize the client\nclient = Semcache(base_url=\"http://localhost:8080\")\n\n# Store a key-data pair\nclient.put(\"What is the capital of France?\", \"Paris\")\n\n# Retrieve data by semantic similarity\nresponse = client.get(\"Tell me France's capital city.\")\nprint(response)  # \"Paris\"\n```\n\n\nor in Node.js\n\nInstall with\n```bash\nnpm install semcache\n```\nUse the sdk in your service\n\n```javascript\nconst SemcacheClient = require('semcache');\n\nconst client = new SemcacheClient('http://localhost:8080');\n\n(async () =\u003e {\n  await client.put('What is the capital of France?', 'Paris');\n\n  const result = await client.get('What is the capital of France?');\n  console.log(result); // =\u003e 'Paris'\n})();\n```\n\n## Configuration\n\nConfigure via environment variables or `config.yaml`:\n\n```yaml\nlog_level: info\nport: 8080\n```\n\nEnvironment variables (prefix with `SEMCACHE_`):\n```bash\nSEMCACHE_PORT=8080\nSEMCACHE_LOG_LEVEL=debug\n```\n\n## Monitoring\n\n### Prometheus Metrics\n\nSemcache emits comprehensive Prometheus metrics for production monitoring.\n\nCheck out our `/monitoring` directory for our custom Grafana dashboard.\n\n### Built-in Dashboard\n\nAccess the admin dashboard at `/admin` to monitor cache performance.\n\n## Enterprise\n\nOur managed version of Semcache provides you with semantic caching as a service.\n\nFeatures we offer:\n- **Custom text embedding models** for your specific business \n- **Persistent storage** allowing you to build application memory over time \n- **In-depth analysis** of your LLM responses\n- **SLA support** and dedicated engineering resources\n\nContact us at [contact@semcache.io](mailto:contact@semcache.io)\n\n## Contributing\n\nInterested in contributing? Contributions to Semcache are welcome! Feel free to make a PR.\n\n---\n\nBuilt with ❤️ in Rust • [Documentation](https://docs.semcache.io) • [GitHub Issues](https://github.com/sensoris/semcache/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensoris%2Fsemcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensoris%2Fsemcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensoris%2Fsemcache/lists"}