ChatGPT API - TypeScript/JavaScript. ChatGPT API ini ditenagai oleh: https://daniapi.biz.id
npm install @danitech/chatgpt-apibash
npm i @danitech/chatgpt-api
`
$3
`bash
yarn add @danitech/chatgpt-api
`
Cara Menggunakan
$3
#### CJS
`javascript
const chatGPTAPI = require('@danitech/chatgpt-api');
`
#### ESM
`javascript
import chatGPTAPI from '@danitech/chatgpt-api';
`
$3
`javascript
const { models } = chatGPTAPI;
const { chatGPT3, chatGPT35, chatGPT4 } = models;
// GPT-3 model
(async () => {
try {
const response = await chatGPT3('Hello, AI.');
console.log('ChatGPT-3:', response);
} catch (error) {
console.error('Error:', error);
}
})();
// GPT-3.5 model
(async () => {
try {
const response = await chatGPT35('Hello, AI.');
console.log('ChatGPT-3.5:', response);
} catch (error) {
console.error('Error:', error);
}
})();
// GPT-4 model
(async () => {
try {
const response = await chatGPT4('Hello, AI.');
console.log('ChatGPT-4:', response);
} catch (error) {
console.error('Error:', error);
}
})();
`
$3
`text
ChatGPT-3: Hello! How can I assist you today?
ChatGPT-3.5: Hello! How can I assist you today?
ChatGPT-4: Hello! How can I assist you today?
``