Skip to content

elrayyxml/api-nexray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

-----------------------------------------------------

api-nexray

-----------------------------------------------------

Api NexRay

Cover

npm version License: MIT npm downloads REST API

Contact

Instagram TikTok Email WhatsApp

Official Channel

Installation

Use the stable version:

npm install api-nexray
# or
yarn add api-nexray

package.json

"dependencies": {
  "api-nexray": "latest"
}

Example

Import Module

const nexray = require('api-nexray');
# or
import nexray from 'api-nexray';

Headers

import nexray from 'api-nexray';

nexray.setOptions({
  headers: {
  timeout: 30000, // 30 seconds
  maxRetries: 3   // Retry 3 times on failure
  }
});

Get Request

import nexray from 'api-nexray';

const data = await nexray.get('/ai/gemini', {
  text: 'Halo apa kabar...'
});

console.log(data);

Response

{
  "status": true,
  "author": "@nexray - ElrayyXml",
  "result": "Halo! Kabar saya baik, terima kasih telah bertanya. Ada yang bisa saya bantu hari ini?"
}

Post Request

import nexray from 'api-nexray';

const response = await nexray.post('/ai/chatgpt', {
  text: 'Halo apa kabar...'
});

console.log(response);
import nexray from 'api-nexray';
import fs from 'fs';
import path from 'path';

const response = await nexray.post('/tools/codeconvert', {
  file: 'tes.js',
  mode: 'esm'
});

console.log(response);

# or

const buffer = await nexray.post('/ai/nanobanana', {
  image: 'input.jpg', // Path or also directly buffer
  param: 'prompt'
});

console.log(buffer);

Get Buffer

import nexray from 'api-nexray';

const buffer = await nexray.getBuffer('/maker/brat', {
  text: 'Halo apa kabar...'
});

console.log(buffer);

Bad Request

{
  "status": false,
  "author": "@nexray - ElrayyXml",
  "error": "400 Bad Request - Invalid parameters or missing required fields"
}

Internal Server Error

{
  "status": false,
  "author": "@nexray - ElrayyXml",
  "error": "500 Internal Server Error - Server encountered an error"
}

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors