MCPcopy Index your code
hub / github.com/polarsource/polar

github.com/polarsource/polar @main sqlite

repository ↗ · DeepWiki ↗
21,126 symbols 103,925 edges 3,168 files 3,559 documented · 17%
README

Polar - An open source monetization platform for developers | Product Hunt Polar - An open source monetization platform for developers | Product Hunt


Website   •   Docs   •   API Reference

Follow @polar_sh


Polar: A billing platform for the intelligence era

Turn usage into revenue. Polar is the financial layer for a new generation of intelligent software, built for AI startups that need to charge for tokens, agents, and compute without building billing infrastructure from scratch.

  • Ship any pricing model in an afternoon. Usage billing, subscriptions, seats, credits, trials, and discounts. Compose them however your product charges.
  • Meter what matters. Bill tokens, API calls, agent runs, GPU seconds, and storage with precision down to the event.
  • Checkouts that convert, realtime metrics, and worldwide tax handled for you.
  • We're the merchant of record, so we take on the billing boilerplate (receipts, customer accounts, dunning) and the headaches (sales tax, VAT) on your behalf.

Built for AI workloads

  • AI completions: wrap any model with metered token billing on every call.
  • Autonomous agents: charge per run with step-level granularity, retries without double-billing.
  • GPU & compute: meter fine-tuning, hosted inference, and training runs by the second.

Pricing

  • Starter (free): 5.00% + 50¢ per transaction
  • Pro: 3.80% + 40¢ per transaction
  • Growth: 3.60% + 35¢ per transaction
  • Scale: 3.40% + 30¢ per transaction
  • Eligible startups can apply to the Startup Program for a year on our most generous plan
  • Additional fees may apply. Read more

Roadmap, Issues & Feature Requests

💬 Feature requests & bugs can be reported through the "Feedback" button found in the sidebar, bottom left of your Polar dashboard.

🔓 Found a security vulnerability? We greatly appreciate responsible and private disclosures. See Security

Polar API & SDK

You can integrate Polar on your docs, sites or services using our Public API and Webhook API.

We also maintain SDKs for the following languages:

Contributions

Our DEVELOPMENT.md file contains everything you need to know to configure your development environment.

Contributors

♥️🙏 To our pyproject.toml friends: FastAPI, Pydantic, Dramatiq, SQLAlchemy, Githubkit, sse-starlette, Uvicorn, httpx-oauth, jinja, blinker, pyjwt, Sentry + more

♥️🙏 To our package.json friends: Next.js, TanStack Query, tailwindcss, openapi-typescript-codegen, axios, radix-ui, cmdk, framer-motion + more

♥️🙏 To IPinfo that provides IP address data to help us geolocate customers during checkout.

License

Licensed under Apache License, Version 2.0.

Extension points exported contracts — how you extend this code

EmbedCheckoutMessageLoaded (Interface)
* Message sent to the parent window when the embedded checkout is fully loaded.
clients/packages/checkout/src/checkout.ts
QueryParams (Interface)
(no doc)
sdk/generator/typescript/template/src/base.ts
QueryParams (Interface)
(no doc)
sdk/typescript/src/base.ts
components (Interface)
(no doc)
server/emails/src/types/openapi.ts
PropRow (Interface)
(no doc)
clients/apps/orbit/src/components/docs/PropsTable.tsx
MapResult (Interface)
(no doc)
clients/scripts/box-codemod/src/mappings.ts
EmbedCheckoutMessageClose (Interface)
* Message sent to the parent window when the embedded checkout needs to be closed.
clients/packages/checkout/src/checkout.ts
ClientOptions (Interface)
(no doc)
sdk/generator/typescript/template/src/base.ts

Core symbols most depended-on inside this repo

from_session
called by 1164
server/polar/authz/repository.py
get
called by 968
server/polar/logging.py
patch
called by 760
server/polar/file/service.py
select
called by 631
server/polar/backoffice/components/_input.py
create_customer
called by 598
server/tests/fixtures/random_objects.py
is_
called by 497
server/polar/models/event.py
utc_now
called by 475
server/polar/kit/utils.py
flush
called by 421
server/polar/worker/_enqueue.py

Shape

Method 8,948
Function 6,345
Class 4,167
Interface 1,133
Route 533

Languages

Python78%
TypeScript22%

Modules by API surface

sdk/typescript/src/models/outputs.ts351 symbols
sdk/python/polar/outputs.py348 symbols
server/tests/checkout/test_service.py254 symbols
server/tests/organization/test_service.py251 symbols
server/tests/subscription/test_service.py207 symbols
server/tests/order/test_service.py196 symbols
sdk/typescript/src/errors.ts186 symbols
server/tests/integrations/polar/test_service.py162 symbols
sdk/typescript/src/models/inputs.ts162 symbols
sdk/python/polar/inputs.py162 symbols
server/polar/metrics/metrics.py150 symbols
sdk/python/polar/errors.py122 symbols

Dependencies from manifests, versioned

@ai-sdk/anthropic3.0.70 · 1×
@ai-sdk/google2.0.69 · 1×
@ai-sdk/mcp1.0.36 · 1×
@ai-sdk/openai3.0.53 · 1×
@ai-sdk/react3.0.169 · 1×
@babel/core7.28.5 · 1×
@bacons/apple-targets3.0.6 · 1×
@changesets/cli2.31.0 · 1×
@cloudflare/stream-react1.9.3 · 1×
@date-fns/utc2.1.1 · 1×
@dev-plugins/react-query0.1.0 · 1×

Datastores touched

preview_pr_123Database · 1 repos
dbnameDatabase · 1 repos
postgresDatabase · 1 repos

For agents

$ claude mcp add polar \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact