openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.6k stars 468 forks source link

Where to modify to adapt a locally-deployed OpenAI API compatible service? #226

Closed fishfree closed 8 months ago

fishfree commented 9 months ago

This package is very productive. Thank you for your great work! I'd like to modfiy some codes to use a locally-deployed OpenAI API compatible service in our university. I don't konw which files to modify to make it, it's beyond my capability. Any help would be apprciately very much!

gehrisandro commented 9 months ago

Hi @fishfree

Probably it is enough to change the URL by using the factory:


$client = OpenAI::factory()
    ->withApiKey($yourApiKey)
    ->withBaseUri($yourLocalUrl) // default: api.openai.com/v1
    ->make();