Web Developer
I have a question regarding the GenAI Platform that DigitalOcean started recently.
I have a LAMP stack droplet that make extensive use of ChatGPT API (gpt-4o model) on our website. I want to know if using the GenAI Platform replacing (or as an alternative option) the ChatGPT API will require a whole lot of rewrite code in terms of API calls ?
This is what I have so far :
$client = OpenAI::client($OPENAI_API_KEY);
$response = $client->chat()->create([
'model' => $model,
'messages' => [
['role' => 'user', 'content' => $prompt],
],
'temperature' => $temperature,
'max_tokens' => $max_tokens,
'top_p' => $top_p,
'frequency_penalty' => $frequency_penalty,
'presence_penalty' => $presence_penalty
]);
$answer = trim($response['choices'][0]['message']['content']);
Is DO’s GenAI’s API syntax as compatible as OpenAI ?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hey!
DigitalOcean’s GenAI Platform offers API compatibility with OpenAI, allowing you to use existing OpenAI-compatible SDKs and libraries without significant code changes.
This means your current implementation with the OpenAI PHP client should work out of the box with the GenAI Platform.
Take a look at this guide here for more details:
https://www.digitalocean.com/community/tutorials/custom-realtime-chat-application
Let me know how it goes!
- Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.