Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
chimera-api
Advanced tools
This project is a simple script for interacting with the Chimera API. The main class is Chimera
, and it has methods for chat completion, image generation, text-to-speech generation, and content moderation.
The Proxy handler is 100% not a thing to be used with a single API, but I am lazy and didn't want to rework the whole thing to accomodate for this single wrapper. So I just made it a thing. If you want to use it, you can. If you don't, you don't have to. This is an open-source project, so feel free to fork it and make your own changes.
Why axios and not fetch?: Built-in fetch does not support proxies, which is a requirement for me, and since Axios is really easy to use, I just went with it.
Why would you use this?: Let's be honest, if you're here you're lazy to make your own wrapper. I get it. I am too. So I made this. You're welcome.
Install the project using npm:
npm install chimera-api
This is an ESM module, you won't be able to use it with require()
. You will need to use import
instead:
(async () => {
const ChimeraModule = await import("chimera-api");
const Chimera = ChimeraModule.default;
const apiKey = "YOUR_API_KEY";
const chimera = new Chimera(apiKey);
const createChatCompletion = await chimera.chatCompletion({
model: "gpt-4",
messages: [
{
content: "Hello, how are you?",
role: "user",
},
],
});
console.log(createChatCompletion);
process.exit(0);
})();
First, import the Chimera
class:
import Chimera from "chimera-api";
Create a new instance of the class with your API key:
const chimera = new Chimera("your_api_key");
If you need to use a proxy, provide a configuration object as the second parameter to the constructor:
const chimera = new Chimera("your-api-key", {
host: "proxy-host",
port: "proxy-port",
protocol: "http",
auth: {
username: "proxy-username",
password: "proxy-password",
}, // optional
});
You can then use the class methods as follows:
let chatCompletionRequest = {
model: "gpt-4",
messages: [{ role: "user", content: "Hello" }],
// other properties...
};
chimera
.chatCompletion(chatCompletionRequest)
.then((response) => console.log(response))
.catch((error) => console.error(error));
let imageRequest = {
prompt: "E G G.",
// other properties...
};
chimera
.imageGeneration(imageRequest)
.then((response) => console.log(response))
.catch((error) => console.error(error));
let ttsRequest = {
text: "Hello, world!",
};
chimera
.textToSpeech(ttsRequest)
.then((response) => console.log(response))
.catch((error) => console.error(error));
chimera
.Moderation("some potentially offensive text")
.then((response) => console.log(response))
.catch((error) => console.error(error));
chimera
.Whisper(
{
file: createReadStream("./path/to/file.mp3"),
fileName: "name.mp3",
language: "pt-BR",
},
"audio/translations"
)
```
</details>
<details>
<summary> Transcription </summary>
````javascript
chimera
.Whisper(
{
file: createReadStream("./path/to/file.mp3"),
fileName: "name.mp3",
language: "pt-BR",
},
"audio/transcriptions"
)
```
</details>
There are also some examples on the `test` folder.
## Disclaimer
This project is licensed under the GNU General Public License v3.0.
Please note that this is not an official project of the developers of Chimera. This was made out of personal interest and may be helpful to others. This comes with no guarantees or support, but feel free to use it as you wish within the bounds of the license.
Enjoy!
me made dis :)
FAQs
An unoficial wrapper made for the Chimera API
We found that chimera-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.