OpenAI is an artificial intelligence (AI) research and deployment company. They aim to ensure that artificial general intelligence (AGI)—by which they mean highly autonomous systems that outperform humans at most economically valuable work—benefits all of humanity. OpenAI conducts fundamental, long-term research toward the creation of safe AGI. They also build and release AI systems such as ChatGPT and DALL-E, with the goal of pushing the boundaries of AI capabilities while prioritizing ethical considerations and safety. OpenAI is dedicated to ensuring that their technology is used responsibly and for the betterment of society.
openai
const { LLMInterface } = require('llm-interface');
LLMInterface.setApiKey({'openai': process.env.OPENAI_API_KEY});
async function main() {
try {
const response = await LLMInterface.sendMessage('openai', 'Explain the importance of low latency LLMs.');
console.log(response.results);
} catch (error) {
console.error(error);
throw error;
}
}
main();
The following model aliases are provided for this provider.
default
: gpt-4o-minilarge
: gpt-4osmall
: gpt-4o-miniagent
: gpt-4o
default
: text-embedding-ada-002large
: text-embedding-3-largesmall
: text-embedding-3-small
The following parameters can be passed through options
.
frequency_penalty
: Penalizes new tokens based on their existing frequency in the text so far, reducing the likelihood of repeating the same line. Positive values reduce the frequency of tokens appearing in the generated text.function_call
: Details not available, please refer to the LLM provider documentation.functions
: Details not available, please refer to the LLM provider documentation.logit_bias
: An optional parameter that modifies the likelihood of specified tokens appearing in the model-generated output.logprobs
: Includes the log probabilities of the most likely tokens, providing insights into the model's token selection process.max_tokens
: The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.n
: Specifies the number of responses to generate for each input message. Note that costs are based on the number of generated tokens across all choices. Keeping n as 1 minimizes costs.parallel_tool_calls
: Details not available, please refer to the LLM provider documentation.presence_penalty
: Penalizes new tokens based on whether they appear in the text so far, encouraging the model to talk about new topics. Positive values increase the likelihood of new tokens appearing in the generated text.response_format
: Defines the format of the AI's response. Setting this to { "type": "json_object" } enables JSON mode, ensuring the message generated by the model is valid JSON.seed
: A random seed for reproducibility. If specified, the system will attempt to sample deterministically, ensuring repeated requests with the same seed and parameters return the same result. Determinism is not guaranteed.service_tier
: Details not available, please refer to the LLM provider documentation.stop
: Up to 4 sequences where the API will stop generating further tokens.stream
: If set, partial message deltas will be sent, similar to ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.stream_options
: Options for streaming responses.temperature
: Controls the randomness of the AI's responses. A higher temperature results in more random outputs, while a lower temperature makes the output more focused and deterministic. Generally, it is recommended to alter this or top_p, but not both.tool_choice
: Specifies which external tools the AI can use to assist in generating its response.tools
: A list of external tools available for the AI to use in generating responses.top_logprobs
: Details not available, please refer to the LLM provider documentation.top_p
: Controls the cumulative probability of token selections for nucleus sampling. It limits the tokens to the smallest set whose cumulative probability exceeds the threshold. It is recommended to alter this or temperature, but not both.user
: Identifier for the user making the request.
- Native JSON Mode
- Streaming
- Functions
- Tools
- Embeddings
Commercial (Credit Card Required): The OpenAI API is a commercial product and requires a credit card to get started.
To get an API key, first create an OpenAI account, then visit the link below.
OpenAI documentation is available here.