onellm
v0.0.1
Published
The 1LLM SDK is a drop-in replacement for the OpenAI SDK, pre-configured to work with the 1LLM API. It is fully compatible with the ChatGPT Chat Completions API.
Readme
1LLM SDK
The 1LLM SDK is a drop-in replacement for the OpenAI SDK, pre-configured to work with the 1LLM API. It is fully compatible with the ChatGPT Chat Completions API.
Installation
npm install 1llmUsage
Since 1LLM is built on top of the official OpenAI Node.js library, you can use it exactly as you would use the OpenAI SDK.
Initialize the Client
const OneLLM = require('1llm');
const client = new OneLLM({
apiKey: process.env.ONELLM_API_KEY, // Your 1LLM API Key
});Chat Completions
async function main() {
const completion = await client.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'gpt-3.5-turbo',
});
console.log(completion.choices[0]);
}
main();Configuration
The SDK automatically sets the baseURL to https://www.1llm.ai/v1. You can override this if needed:
const client = new OneLLM({
apiKey: 'your-api-key',
baseURL: 'https://custom-url.com/v1',
});For full documentation on available methods and parameters, refer to the OpenAI Node.js SDK documentation.
