Skip to main content

Text-Based Models

To utilize text-based models effectively in your application using the Merlin API, follow this guide to understand the available models and how to interact with them using Node.js.

Available Models​

Below is the list of the available text-based model IDs you can use with the Merlin API along with a brief description:

Model IDDescriptionProviderPricing (in $ per 1K tokens)
gpt-3.5-turboA cost-effective and fast model, suitable for a wide range of tasks.OpenAIPricing
gpt-4-1106-previewAn early preview version of the GPT-4 model.OpenAIPricing
gpt-4The latest generation GPT-4 model, offering advanced capabilities.OpenAIPricing
claude-instant-1A model from Anthropic, designed for instant completions.AnthropicPricing
claude-2The second version of the Claude model from Anthropic.AnthropicPricing
codellama-34bA fine-tuned model specialized in generating code-related content.Meta0.001
mistral-7bA medium-sized, instruction-following version of MistralAI.Mistral0.00015
mistral-7b-openorcaFine tuned mistral model trained by Orca FoundationOrca Foundation0.00015
zephyr-7b-betaA prototype version of a large-scale model from HuggingFace.Huggingface0.00015
llama-2-7bSmall sized open source model by MetaMeta0.00015
llama-2-13bMedium sized open source model by MetaMeta0.00025
llama-2-70bLargest open source model by MetaMeta0.001
gpt-4-0314A version of GPT-4 with specialized optimizations.OpenAIPricing
gpt-4-0613A GPT-4 variant optimized for certain tasks.OpenAIPricing
gpt-4-32kA GPT-4 model with an extended token limit.OpenAIPricing
gpt-4-32k-0314A specialized version of GPT-4 with a 32k token limit.OpenAIPricing
gpt-4-32k-0613Another variant of GPT-4 with the 32k token limit, with different optimizations.OpenAIPricing
gpt-3.5-turbo-1106A variant of GPT-3.5-turbo for specific use-cases.OpenAIPricing
gpt-3.5-turbo-16kAn expansion of GPT-3.5-turbo with a larger token limit.OpenAIPricing
gpt-3.5-turbo-0301A specific configuration of GPT-3.5-turbo.OpenAIPricing
gpt-3.5-turbo-0613Another GPT-3.5-turbo configuration for particular applications.OpenAIPricing
gpt-3.5-turbo-16k-0613Combines the 16k expansion with the 0613 optimizations.OpenAIPricing
gemini-proGoogle's competitor to the GPT-4 model, with multimodal capabilitiesGoogle

Interacting with Text-Based Models​

To interact with the provided models using Node.js, you can use the following sample code:

import { Merlin } from "merlin-node";

const apiKey = "<YOUR_MERLIN_API_KEY>"; // Replace with your API key from Merlin
const merlin = new Merlin({ merlinConfig: { apiKey } });

async function createCompletion() {
try {
const completion = await merlin.chat.completions.create({
messages: [{ role: "system", content: "You are a helpful assistant." }],
model: "gpt-3.5-turbo", // Adjust model as needed
});

console.log(completion.choices[0].message.content);
} catch (error) {
console.error("Error creating completion:", error);
}
}

createCompletion();

Remember to install the merlin-node package and add your API key to use Merlin API.

Notes​

  • Make sure to replace the model property's value with the desired model ID from the table above depending on your task requirements.
  • The output from the createCompletion function call is logged and will visible in the console soon.