René's URL Explorer Experiment


Title: Improve token usage recording by antonpirker · Pull Request #4566 · getsentry/sentry-python · GitHub

Open Graph Title: Improve token usage recording by antonpirker · Pull Request #4566 · getsentry/sentry-python

X Title: Improve token usage recording by antonpirker · Pull Request #4566 · getsentry/sentry-python

Description: The official Python SDK for Sentry.io. Contribute to getsentry/sentry-python development by creating an account on GitHub.

Open Graph Description: Update token usage recording to work if the LLM is calling them prompt_tokens or input_tokens. Same for completion_tokens and output_tokens. Records also cached and reasoning tokens usage. Because ...

X Description: Update token usage recording to work if the LLM is calling them prompt_tokens or input_tokens. Same for completion_tokens and output_tokens. Records also cached and reasoning tokens usage. Because ...

Opengraph URL: https://github.com/getsentry/sentry-python/pull/4566

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:8485fa90-085a-64f0-516a-820937266835
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA78C:1E3D3D:2A27DD:3A79B1:6B008831
html-safe-nonce96b20420c4ba947f128754ce2100481994feecd9084699497b4216f7931255a6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzhDOjFFM0QzRDoyQTI3REQ6M0E3OUIxOjZCMDA4ODMxIiwidmlzaXRvcl9pZCI6IjIwMjMyMTAzMDAwOTM3OTQzNTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf8ab67a6047fbe0ee23767dfa4f41e1ceba1e2dd47888d84aadd167f7ec32475
hovercard-subject-tagpull_request:2653191361
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/getsentry/sentry-python/4566/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/7a0103869e30bfb4c3b60c57d76714c0ac0857b3ce3f47926655f3deb6e24b0e/getsentry/sentry-python/pull/4566
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7a0103869e30bfb4c3b60c57d76714c0ac0857b3ce3f47926655f3deb6e24b0e/getsentry/sentry-python/pull/4566
og:image:altUpdate token usage recording to work if the LLM is calling them prompt_tokens or input_tokens. Same for completion_tokens and output_tokens. Records also cached and reasoning tokens usage. Because ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameantonpirker
hostnamegithub.com
expected-hostnamegithub.com
None4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61
turbo-cache-controlno-cache
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasedb758f8e02b8257935fb03edf81a3e76eb3abd11
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-namepull-requests

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/4566#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F4566
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F4566
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/pull/4566
Reloadhttps://github.com/getsentry/sentry-python/pull/4566
Reloadhttps://github.com/getsentry/sentry-python/pull/4566
getsentryhttps://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Codehttps://github.com/getsentry/sentry-python
Issues345 (345)https://github.com/getsentry/sentry-python/issues
Pull requests41 (41)https://github.com/getsentry/sentry-python/pulls
Discussionshttps://github.com/getsentry/sentry-python/discussions
Actionshttps://github.com/getsentry/sentry-python/actions
Security and quality2 (2)https://github.com/getsentry/sentry-python/security
Insightshttps://github.com/getsentry/sentry-python/insights
https://github.com/getsentry/sentry-python
antonpirkerhttps://github.com/antonpirker
masterhttps://github.com/getsentry/sentry-python/tree/master
antonpirker/openai-token-usagehttps://github.com/getsentry/sentry-python/tree/antonpirker/openai-token-usage
Conversationhttps://github.com/getsentry/sentry-python/pull/4566
Commits5 (5)https://github.com/getsentry/sentry-python/pull/4566/commits
Checkshttps://github.com/getsentry/sentry-python/pull/4566/checks
Files changedhttps://github.com/getsentry/sentry-python/pull/4566/files
Improve token usage recordinghttps://github.com/getsentry/sentry-python/pull/4566#top
antonpirkerhttps://github.com/antonpirker
masterhttps://github.com/getsentry/sentry-python/tree/master
antonpirker/openai-token-usagehttps://github.com/getsentry/sentry-python/tree/antonpirker/openai-token-usage
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
Jul 9, 2025https://github.com/getsentry/sentry-python/pull/4566#issue-3216256495
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
https://github.com/antonpirker
Updated recording of token usagehttps://github.com/getsentry/sentry-python/pull/4566/commits/f864566faed6be7a1ed54cd23c0f44033021100c
f864566https://github.com/getsentry/sentry-python/pull/4566/commits/f864566faed6be7a1ed54cd23c0f44033021100c
https://github.com/apps/codecov
codecovhttps://github.com/apps/codecov
Jul 9, 2025https://github.com/getsentry/sentry-python/pull/4566#issuecomment-3053005117
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
Codecovhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
(657c2b1)https://app.codecov.io/gh/getsentry/sentry-python/commit/657c2b159a20b9c4280157f3cbd44c251f211228?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
(520c3d7)https://app.codecov.io/gh/getsentry/sentry-python/commit/520c3d725411b0702401d94aab9321a82264ca1b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
Files with missing lineshttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
sentry_sdk/ai/monitoring.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fai%2Fmonitoring.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9haS9tb25pdG9yaW5nLnB5
2 Missing and 2 partials ⚠️ https://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
sentry_sdk/integrations/openai.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Fopenai.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvb3BlbmFpLnB5
2 Missing and 1 partial ⚠️ https://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
Files with missing lineshttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
sentry_sdk/integrations/anthropic.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Fanthropic.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvYW50aHJvcGljLnB5
sentry_sdk/integrations/cohere.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Fcohere.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvY29oZXJlLnB5
sentry_sdk/integrations/huggingface_hub.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Fhuggingface_hub.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvaHVnZ2luZ2ZhY2VfaHViLnB5
sentry_sdk/integrations/langchain.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Flangchain.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvbGFuZ2NoYWluLnB5
sentry_sdk/integrations/openai.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Fopenai.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvb3BlbmFpLnB5
sentry_sdk/ai/monitoring.pyhttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566?src=pr&el=tree&filepath=sentry_sdk%2Fai%2Fmonitoring.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9haS9tb25pdG9yaW5nLnB5
3 files with indirect coverage changeshttps://app.codecov.io/gh/getsentry/sentry-python/pull/4566/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
https://github.com/antonpirker
updated testshttps://github.com/getsentry/sentry-python/pull/4566/commits/1fe97c903d9916256b500a7ff09cad93e177292a
1fe97c9https://github.com/getsentry/sentry-python/pull/4566/commits/1fe97c903d9916256b500a7ff09cad93e177292a
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
July 10, 2025 08:01https://github.com/getsentry/sentry-python/pull/4566#event-18560263300
July 10, 2025 13:11https://github.com/getsentry/sentry-python/pull/4566#event-18565777110
antonpirkerhttps://github.com/antonpirker
July 15, 2025 14:17https://github.com/getsentry/sentry-python/pull/4566#commits-pushed-6b816f7
https://github.com/antonpirker
Merge branch 'master' into antonpirker/openai-token-usagehttps://github.com/getsentry/sentry-python/pull/4566/commits/6b816f748c1b4a3f55609333af1e34452b31210d
6b816f7https://github.com/getsentry/sentry-python/pull/4566/commits/6b816f748c1b4a3f55609333af1e34452b31210d
https://github.com/antonpirker
better commentshttps://github.com/getsentry/sentry-python/pull/4566/commits/e7ed400a5d73dd26d78f1271b1f1c21d06bb6d2e
e7ed400https://github.com/getsentry/sentry-python/pull/4566/commits/e7ed400a5d73dd26d78f1271b1f1c21d06bb6d2e
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
July 15, 2025 12:40https://github.com/getsentry/sentry-python/pull/4566#event-18637583617
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
code ownerhttps://github.com/getsentry/sentry-python/blob/657c2b159a20b9c4280157f3cbd44c251f211228/.github/CODEOWNERS#L1
July 15, 2025 12:40https://github.com/getsentry/sentry-python/pull/4566#event-18637583817
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
Jul 15, 2025 https://github.com/getsentry/sentry-python/pull/4566#ref-pullrequest-3215866799
Add support for OpenAi responses API #4564 https://github.com/getsentry/sentry-python/pull/4564
https://github.com/sentrivana
sentrivanahttps://github.com/sentrivana
Jul 15, 2025 https://github.com/getsentry/sentry-python/pull/4566#pullrequestreview-3020754022
View reviewed changes https://github.com/getsentry/sentry-python/pull/4566/files/e7ed400a5d73dd26d78f1271b1f1c21d06bb6d2e
sentrivanahttps://github.com/sentrivana
https://github.com/getsentry/sentry-python/pull/4566#pullrequestreview-3020754022
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
sentry_sdk/integrations/openai.pyhttps://github.com/getsentry/sentry-python/pull/4566/files/e7ed400a5d73dd26d78f1271b1f1c21d06bb6d2e#diff-8be672624748ac6598fe3d702a6beaf03e1fa6bc3c5f8aeadf68158d401fe34e
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
https://github.com/antonpirker
https://github.com/sentrivana
Update sentry_sdk/integrations/openai.pyhttps://github.com/getsentry/sentry-python/pull/4566/commits/520c3d725411b0702401d94aab9321a82264ca1b
520c3d7https://github.com/getsentry/sentry-python/pull/4566/commits/520c3d725411b0702401d94aab9321a82264ca1b
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
July 15, 2025 14:47https://github.com/getsentry/sentry-python/pull/4566#event-18640292672
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
2ccab61https://github.com/getsentry/sentry-python/commit/2ccab61dfd5dee9135d9b7e5fb25d184f5dfd52c
Jul 15, 2025https://github.com/getsentry/sentry-python/pull/4566#event-18640428419
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
July 15, 2025 14:54https://github.com/getsentry/sentry-python/pull/4566#event-18640428664
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/{{ revealButtonHref }}
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F4566
https://github.com/sentrivana
sentrivana https://github.com/sentrivana
https://github.com/getsentry/sentry-python/pull/4566/files/e7ed400a5d73dd26d78f1271b1f1c21d06bb6d2e
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/4566
https://github.com/antonpirker
https://github.com/sentrivana
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.