Coder Social home page Coder Social logo

openai-gptokenomics's Introduction

OpenAI-GPTokenomics

OpenAI-GPTokenomics is a simple command-line tool to calculate the price for requests sent to the OpenAI models.

Features

  • Calculate request price based on model and number of tokens.
  • Calculate answer price based on model and number of tokens.
  • Support for multiple OpenAI models: GPT-4, GPT-3.5 Turbo, DaVinci, Curie, Babbage, and Ada.
  • Read data from input files or directly from command-line arguments.
  • Write output to a file or print it to the console.

Requirements

  • Rust (tested with Edition 2021)
  • Dependencies:
    • tiktoken-rs v0.3.3
    • structopt v0.3

Installation

  • Clone the repository:
git clone https://github.com/tragDate/openai-gptokenomics.git
  • Change into the project directory:
cd openai-gptokenomics
  • Build the project:
cargo build --release
  • The binary will be available at ./target/release/openai-gptokenomics.

Usage

openai-gptokenomics [FLAGS] [OPTIONS]

Flags:

  • -r, --request_file: A file with the request data (conflicts with --request_data).
  • -d, --request_data: A string with the request data (conflicts with --request_file).
  • -a, --answer_file: A file with the answer data (conflicts with --answer_data).
  • --answer_data: A string with the answer data (conflicts with --answer_file).
  • --answer: Calculate answer price from stdin.
  • -o, --output_file: Save the output into a file, instead of printing it to the console.

Options:

  • -m, --model (default: gpt-3.5-turbo): The OpenAI model.
  • --output_file: The path to save the output.

Example:

openai-gptokenomics -m "gpt-4" -d "What is the capital of France?" --answer_data "The capital of France is Paris."

Author

@tragDate

License

GPL-3.0

openai-gptokenomics's People

Contributors

zmolecristian avatar

Stargazers

Scriu Buguri avatar Andrei Cojocaru avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.