{"id":29671381,"url":"https://github.com/tinybirdco/llm-performance-tracker","last_synced_at":"2025-07-22T20:07:43.763Z","repository":{"id":281177925,"uuid":"944361169","full_name":"tinybirdco/llm-performance-tracker","owner":"tinybirdco","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-10T11:42:06.000Z","size":102371,"stargazers_count":43,"open_issues_count":1,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-19T07:43:45.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://llm-tracker.tinybird.live","language":"TypeScript","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/tinybirdco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2025-03-07T08:04:30.000Z","updated_at":"2025-07-17T18:25:17.000Z","dependencies_parsed_at":"2025-03-07T12:28:56.086Z","dependency_job_id":"35aca27c-c964-4807-b8ca-ca37d2155429","html_url":"https://github.com/tinybirdco/llm-performance-tracker","commit_stats":null,"previous_names":["tinybirdco/ai-analytics-template","tinybirdco/llm-performance-tracker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tinybirdco/llm-performance-tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fllm-performance-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fllm-performance-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fllm-performance-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fllm-performance-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinybirdco","download_url":"https://codeload.github.com/tinybirdco/llm-performance-tracker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinybirdco%2Fllm-performance-tracker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266563915,"owners_count":23948689,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-07-22T20:07:43.194Z","updated_at":"2025-07-22T20:07:43.739Z","avatar_url":"https://github.com/tinybirdco.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Performance Tracker\n\nThis is a template for an LLM performance tracker dashboard and cost calculator. It is built with Next.js and [Tinybird](https://tinybird.co).\n\n![LLM Performance Tracker Dashboard](./assets/screenshot.png)\n\nUse this template to bootstrap a multi-tenant, user-facing LLM analytics dashboard and cost calculator.\n\nCheck the [demo video](https://youtu.be/34AF33EysTg)\n\nFeatures:\n\n- Track LLM costs, requests, tokens and duration by model, provider, organization, project, environment and user\n- Multi-tenant user-facing dashboard\n- AI cost calculator\n- Vector search\n- Ask AI integration\n\nFork it and make it your own! You can track your own metrics and dimensions.\n\nStack:\n\n- [Next.js](https://nextjs.org/) - Application\n- [Tinybird](https://tinybird.co) - Analytics\n- [OpenAI](https://openai.com/) - AI features\n- [Vercel AI SDK](https://sdk.vercel.ai/docs/introduction) - AI features\n- [Vercel](https://sdk.vercel.ai/docs/introduction) - Application deployment\n- [Clerk](https://clerk.com/) - User management and auth\n- [Tremor](https://tremor.so/) - Charts\n\n## Live Demo\n\n- https://llm-tracker.tinybird.live\n\n## Quick Start\n\nDeploy the template, instrument and use the hosted version to track.\n\n### Deploy\n\n```bash\n# install the tinybird CLI\ncurl https://tinybird.co | sh\n\n# select or create a new workspace\ntb login\n\n# deploy the template\ntb --cloud deploy --template https://github.com/tinybirdco/llm-performance-tracker/tree/main/tinybird\n```\n\n### Instrumentation\n\nSend your data to Tinybird using the [Events API](https://www.tinybird.co/docs/get-data-in/ingest-apis/events-api). Some examples:\n\n- [LiteLLM (Python)](https://www.tinybird.co/docs/get-data-in/guides/ingest-litellm)\n- [Vercel AI SDK (TypeScript)](https://www.tinybird.co/docs/get-data-in/guides/ingest-vercel-ai-sdk)\n\n### Use the hosted app\n\n```bash\n# copy the token to the clipboard\ntb --cloud token copy read_pipes \u0026\u0026 TINYBIRD_TOKEN=$(pbpaste)\n\n# use the hosted dashboard with your data\nopen https://llm-tracker.tinybird.live\\?token\\=$TINYBIRD_TOKEN\n```\n\n## Build and deploy your own LLM tracker\n\nGet started by forking the GitHub repository and then customizing it to your needs.\n\nStart Tinybird locally:\n\n```\ncurl https://tinybird.co | sh\ncd tinybird\ntb local start\ntb login\ntb dev\ntoken ls  # copy the read_pipes token\n```\n\nConfigure the Next.js application:\n\n```\ncd dashboard/ai-analytics\ncp .env.example .env\nEdit the .env file with your Tinybird API key and other configuration.\n```\n\n```\nNEXT_PUBLIC_TINYBIRD_API_URL=http://localhost:7181\n# read_pipes token\nNEXT_PUBLIC_TINYBIRD_API_KEY=\n```\n\nStart the Next.js application:\n\n```\ncd dashboard/ai-analytics\nnpm install\nnpm run dev\n```\n\nOpen the application in your browser:\n\n```\nhttp://localhost:3000\n```\n\n## Deployment\n\n- Fork and connect this repository to Vercel.\n- Set the environment variables in Vercel.\n- Configure the [CI/CD GitHub actions](https://github.com/tinybirdco/ai-analytics-template/tree/main/.github/workflows) to deploy to Tinybird.\n\n## Multi-tenancy\n\nCreate a Clerk project and set up these environment variables in your Next.js application:\n\n```\n# workspace ID for multi-tenant JWT tokens\nTINYBIRD_WORKSPACE_ID=\n# workspace admin token for multi-tenant JWT tokens\nTINYBIRD_JWT_SECRET=\n\n# Clerk publishable key\nNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=\n# Clerk secret key\nCLERK_SECRET_KEY=\n# Clerk sign in URL\nNEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in\nNEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up\nNEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/\nNEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/\n```\n\nThe [middleware](https://github.com/tinybirdco/ai-analytics-template/blob/main/dashboard/ai-analytics/src/middleware.ts) will get the `org:name` permission from the Clerk user and use it to create a Tinybird JWT token with the `organization` dimension fixed to that value. Read more about Tinybird JWT tokens [here](https://www.tinybird.co/docs/forward/get-started/authentication#json-web-tokens-jwts).\n\n## Mock Data\n\nFor local testing, generate mock data with the following commands:\n\n```sh\ncd tinybird/mock\nnpm install\nnpm run generate -- --start-date 2025-02-01 --end-date 2025-03-31 --events-per-day 100 --output ../fixtures/llm_events.ndjson\n```\n\nThe [generate-llm-events.js](https://github.com/tinybirdco/ai-analytics-template/blob/main/tinybird/mock/generate-llm-events.js) script generates the embeddings.\n\n## AI features\n\nTo use the AI features, click on Settings in the dashboard and input an OpenAI API key.\n\nSee the `search` and `extract-cost-parameters` [API routes](https://github.com/tinybirdco/ai-analytics-template/tree/main/dashboard/ai-analytics/src/app/api) for more details on how the AI features work.\n\n## Vector search\n\nThe vector search is powered by Tinybird, but embeddings need to be calculated in a separate process. See the [generate-embedding](https://github.com/tinybirdco/ai-analytics-template/blob/main/dashboard/ai-analytics/src/app/api/generate-embedding/route.ts) route for more details.\n\nThe process is:\n\n- The user inputs a query and clicks the search button.\n- The query is sent to the `generate-embedding` route to get the embedding.\n- The embedding is sent to the Tinybird `llm_messages` as a query parameter.\n- `llm_messages` use `cosineDistance` to find the most similar vectors.\n- The frontend shows the table rows with the most similar vectors.\n\n## Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md)\n\n## Support\n\nJoin the [Tinybird Slack community](https://www.tinybird.co/community) to get help with your project.\n\n## License\n\nMIT License\n\n©️ Copyright 2025 Tinybird","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybirdco%2Fllm-performance-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinybirdco%2Fllm-performance-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybirdco%2Fllm-performance-tracker/lists"}