Skip to content

Conversation

thli-openai
Copy link
Contributor

@thli-openai thli-openai commented Feb 10, 2025

Summary

This PR addresses a few items:

  1. Refactors the usage / cost API calls and pagination into its own helper function to reduce duplicate code
  2. Corrects the total cost example in the Cost API which was incorrectly labeled as line item costs
  3. Adds additional example for a line item cost stacked bar chart

Motivation

Why are these changes necessary? How do they improve the cookbook?


For new content

When contributing new content, read through our contribution guidelines, and mark the following action items as completed:

  • I have added a new entry in registry.yaml (and, optionally, in authors.yaml) so that my content renders on the cookbook website.
  • I have conducted a self-review of my content based on the contribution guidelines:
    • Relevance: This content is related to building with OpenAI technologies and is useful to others.
    • Uniqueness: I have searched for related examples in the OpenAI Cookbook, and verified that my content offers new insights or unique information compared to existing documentation.
    • Spelling and Grammar: I have checked for spelling or grammatical mistakes.
    • Clarity: I have done a final read-through and verified that my submission is well-organized and easy to understand.
    • Correctness: The information I include is correct and all of my code executes successfully.
    • Completeness: I have explained everything fully, including all necessary references and citations.

We will rate each of these areas on a scale from 1 to 4, and will only accept contributions that score 3 or higher on all areas. Refer to our contribution guidelines for more details.

@thli-openai thli-openai requested a review from MW-OAI February 10, 2025 17:38
@thli-openai thli-openai force-pushed the feature/usage-api-cookbook branch 2 times, most recently from 94b83ce to a251b53 Compare February 10, 2025 20:03
Copy link
Contributor

@MW-OAI MW-OAI left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@MW-OAI MW-OAI left a comment

Choose a reason for hiding this comment

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

Looks good

@thli-openai thli-openai force-pushed the feature/usage-api-cookbook branch from a251b53 to 13d0799 Compare February 11, 2025 17:28
@thli-openai thli-openai merged commit 3b4245d into main Feb 11, 2025
@thli-openai thli-openai deleted the feature/usage-api-cookbook branch February 11, 2025 17:28
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.

2 participants