Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Oct 21, 2025

Important

This PR updates the API to allow optional public and secret keys when creating API keys and adds a reference to the Metrics API documentation.

  • API Key Creation:
    • Added optional public_key and secret_key parameters to create_api_key() in ProjectsClient and AsyncProjectsClient.
    • Both keys must be provided together and must start with 'pk-lf-' and 'sk-lf-' respectively.
  • Documentation:

This description was created by Ellipsis for 665b045. You can customize this summary. It will automatically update as commits are pushed.

Disclaimer: Experimental PR review

Greptile Overview

Updated On: 2025-10-21 08:00:53 UTC

Summary

This PR updates the auto-generated API client to sync with the upstream Langfuse API specification (commit 1ded68c).

Key changes:

  • Metrics API: Enhanced documentation with link to comprehensive Metrics API docs
  • Projects API: Added optional public_key and secret_key parameters to create_api_key method, allowing predefined API keys to be created with custom values instead of auto-generated ones
  • Both sync and async client methods updated consistently
  • Documentation reflects mutual dependency between public_key and secret_key parameters

The changes are straightforward API surface additions with no breaking changes to existing functionality.

Confidence Score: 4/5

  • Safe to merge with minimal risk - purely additive API changes from auto-generated code
  • Score of 4 reflects that this is auto-generated code with consistent implementation across sync/async methods and proper documentation. Minor deduction because client-side validation for the new parameters (format checks, mutual dependency) could improve developer experience, though server-side validation likely handles this.
  • No files require special attention - all changes are consistent auto-generated API client updates

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/reference.md 5/5 Documentation updates: added link to Metrics API docs and documented new optional public_key/secret_key parameters for create_api_key
langfuse/api/resources/metrics/client.py 5/5 Enhanced docstring with link to Metrics API documentation for both sync and async clients
langfuse/api/resources/projects/client.py 4/5 Added optional public_key and secret_key parameters to create_api_key method (sync and async), but client-side validation is missing

Sequence Diagram

sequenceDiagram
    participant Client
    participant ProjectsClient
    participant API as Langfuse API
    
    Note over Client,API: create_api_key - New Flow with Optional Keys
    
    Client->>ProjectsClient: create_api_key(project_id, note?, public_key?, secret_key?)
    ProjectsClient->>ProjectsClient: Prepare request payload<br/>{note, publicKey, secretKey}
    ProjectsClient->>API: POST /api/public/projects/{id}/apiKeys
    
    alt Success (200-299)
        API-->>ProjectsClient: ApiKeyResponse
        ProjectsClient-->>Client: Return ApiKeyResponse
    else Bad Request (400)
        API-->>ProjectsClient: Error response
        ProjectsClient-->>Client: Raise Error
    else Unauthorized (401)
        API-->>ProjectsClient: Error response
        ProjectsClient-->>Client: Raise UnauthorizedError
    else Forbidden (403)
        API-->>ProjectsClient: Error response
        ProjectsClient-->>Client: Raise AccessDeniedError
    else Not Found (404)
        API-->>ProjectsClient: Error response
        ProjectsClient-->>Client: Raise NotFoundError
    else Method Not Allowed (405)
        API-->>ProjectsClient: Error response
        ProjectsClient-->>Client: Raise MethodNotAllowedError
    end
    
    Note over Client,API: Metrics Query - Enhanced Documentation
    Client->>MetricsClient: metrics(query)
    MetricsClient->>API: POST /api/public/metrics
    API-->>MetricsClient: MetricsResponse
    MetricsClient-->>Client: Return MetricsResponse
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp merged commit 8723870 into main Oct 21, 2025
12 checks passed
@hassiebp hassiebp deleted the api-spec-bot-1ded68c branch October 21, 2025 16:48
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.

3 participants