name: pwn-ai-providers-openai description: Drive PWN::AI::Providers::OpenAI from pwn_eval. license: MIT allowed-tools: [pwn, pwn_eval] metadata: bundled: true generated: false preserve: true module: PWN::AI::Providers::OpenAI source: pwn/ai/providers/open_ai.rb
PWN::AI::Providers::OpenAI
This plugin is used for interacting w/ OpenAI's REST API using the 'rest' browser type of PWN::HTTP::TransparentBrowser. This is based on the following OpenAI API Specification: https://api.openai.com/v1
When to use
Call PWN::AI::Providers::OpenAI from pwn_eval when the task needs this module.
Do not reimplement it in shell.
Catalog authentication
Use ai.openai.key for the Platform catalog, or a saved OpenAI account grant
for the subscription catalog. PWN reuses a valid access token; otherwise it tries
silent refresh. Only ai.openai.oauth.enroll: true (or oauth: true) permits
new device consent during a request. A blank key or client ID does not. For a
first grant, the operator runs get_models in a private foreground terminal
and approves the displayed code at the provider. Leave the separate key unset
when testing account access alone; a failed silent refresh can otherwise use
it when enrollment is off.
How to call
PWN::AI::Providers::OpenAI.get_models(non_interactive: true).fetch(:data).length
Public methods
refresh_oauth_bearer_tokenobtain_oauth_bearer_tokenget_modelsget_modelchat_with_toolsapi_endpointchatimg_genvisioncreate_fine_tunelist_fine_tunesget_fine_tune_statuscancel_fine_tuneget_fine_tune_eventsdelete_fine_tune_modellist_filesupload_filedelete_fileget_fileauthorshelp
References
references/urls.md— URLs from source
Source
pwn/ai/providers/open_ai.rb
Verification
The number is the entry count returned by the selected catalog. It is not proof of generation permissions or billing. Do not print the result of a token helper.
