Skip to content

feat(api): update API spec from langfuse/langfuse 306cdfb - #2143

Open
langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-306cdfb-44893410249-1
Open

langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-306cdfb-44893410249-1

Conversation

@langfuse-bot

@langfuse-bot langfuse-bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Generated from langfuse/langfuse main at 306cdfb.

RetriggerView in GreptileConfidence Score: 4/5

Meet the repository's import-placement requirement before merging; the example timestamp fix is non-blocking.

Summary

Adds organization-level billable usage queries under unstable.billable_units.

  • Python clients can fetch billable units by project and time bucket.

Reviews (1) · Last reviewed commit: "feat(api): update API spec from langfuse..." · Reviewed by Greptile

@github-actions

Copy link
Copy Markdown

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.

Tip: disable this comment in your organization's Code Review settings.

@property
def billable_units(self):
if self._billable_units is None:
from .billable_units.client import BillableUnitsClient # noqa: E402

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Imports break the repository rule

Both new billable_units properties import their clients inside the methods. The repository requires imports at the top of the module. Move BillableUnitsClient and AsyncBillableUnitsClient to module-level imports before merging.

Rule Used: Move imports to the top of the module instead of placing them within functions or methods. (source)

Learned From
langfuse/langfuse-python#1387

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/unstable/client.py
Line: 43

Comment:
**Imports break the repository rule**

Both new `billable_units` properties import their clients inside the methods. The repository requires imports at the top of the module. Move `BillableUnitsClient` and `AsyncBillableUnitsClient` to module-level imports before merging.

**Rule Used:** Move imports to the top of the module instead of placing them within functions or methods. ([source](https://app.greptile.com/-/switch-tenant?tenant=personal-org-4986&next=%2Fcustom-context%3Fmemory%3Dc960fc07-9928-409f-a18b-a780cbdded12))

**Learned From**
[langfuse/langfuse-python#1387](https://github.com/langfuse/langfuse-python/pull/1387)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +91 to +93
to_timestamp=datetime.datetime.fromisoformat(
"2024-01-15 09:30:00+00:00",
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Examples request an empty interval

Both get examples pass identical from_timestamp and to_timestamp values. The documented range excludes its end, so users copying either example request no time span rather than a useful usage report. Set to_timestamp later than from_timestamp in both examples.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/unstable/billable_units/client.py
Line: 91-93

Comment:
**Examples request an empty interval**

Both `get` examples pass identical `from_timestamp` and `to_timestamp` values. The documented range excludes its end, so users copying either example request no time span rather than a useful usage report. Set `to_timestamp` later than `from_timestamp` in both examples.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This is a purely additive regeneration of the Fern client that adds the unstable billable_units endpoint and follows the same patterns as the sibling sub-clients.

What was reviewed:

  • UnstableClient and AsyncUnstableClient get lazy billable_units properties. The new names appear in _dynamic_imports, the TYPE_CHECKING imports and __all__, and the sync and async code match.
  • The raw clients send GET api/public/unstable/organizations/billable-units. Both timestamps go through serialize_datetime, and errors are mapped to exceptions the same way topics/raw_client.py does it.
  • The BillableUnitsRow and BillableUnitsResponse aliases (projectId, topicFacetSummaries, usageRecordedFrom) and the frozen extra="allow" config match the generated topics types.
  • Not done: AGENTS.md asks for request and response serialization tests on generated client changes, but none were added and none were run in this review.
Extended reasoning...

The change adds 9 generated files under langfuse/api/unstable/: a new billable_units module with sync and async clients, raw clients and three types, plus the wiring in unstable/__init__.py and unstable/client.py. It is a read-only GET endpoint that uses the existing client wrapper and error types. It touches no auth, crypto, permissions or hand-written SDK code. Existing public names are unchanged and the code matches the existing Fern patterns for topics and dashboards. CODEOWNERS only covers .github/, and the PR timeline shows no open reviewer objections.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant