Class: LlmCostTracker::Providers::Openai::Parser
- Inherits:
-
LlmCostTracker::Parsers::Base
- Object
- LlmCostTracker::Parsers::Base
- LlmCostTracker::Providers::Openai::Parser
- Includes:
- ResponseParser
- Defined in:
- lib/llm_cost_tracker/providers/openai/parser.rb
Constant Summary collapse
- TRACKED_PATHS =
%w[ /v1/chat/completions /v1/completions /v1/embeddings /v1/responses /v1/images/generations /v1/images/edits /v1/images/variations /v1/audio/transcriptions /v1/audio/translations /v1/audio/speech /v1/moderations ].freeze
Constants included from ServiceCharges
ServiceCharges::CHAT_COMPLETIONS_ANNOTATION_PROVIDER_FIELD, ServiceCharges::CHAT_COMPLETIONS_SEARCH_MODEL_PROVIDER_FIELD, ServiceCharges::RESPONSE_OUTPUT_RENAMES
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ResponseParser
#auto_enable_stream_usage?, combined_pricing_mode, event_from_response, #parse, #parse_stream
Methods included from ServiceCharges
billable?, build_line_item, chat_completions_search_model?, chat_completions_search_provider_field, chat_completions_used_web_search?, chat_completions_web_search_items, dimension_key_for, line_item_details, line_items_from_output, local_model_name, openai_stream_service_line_items, output_dimension, reasoning_model?, service_line_items_for, store_output_item, transcription_line_items, web_search_preview_used?
Methods inherited from LlmCostTracker::Parsers::Base
#auto_enable_stream_usage?, #model_for, #parse, #parse_stream, #safe_json_parse, #streaming_request?
Methods included from LlmCostTracker::Parsers::UrlMatchers
#match_uri?, #parsed_uri, #path_matches?, #uri_matches?
Class Method Details
.match?(url) ⇒ Boolean
24 25 26 |
# File 'lib/llm_cost_tracker/providers/openai/parser.rb', line 24 def match?(url) match_uri?(url, hosts: Hosts::API_HOSTS, exact_paths: TRACKED_PATHS) end |
.provider_names ⇒ Object
28 29 30 |
# File 'lib/llm_cost_tracker/providers/openai/parser.rb', line 28 def provider_names %w[openai] end |
Instance Method Details
#provider_for(_request_url) ⇒ Object
33 34 35 |
# File 'lib/llm_cost_tracker/providers/openai/parser.rb', line 33 def provider_for(_request_url) "openai" end |