content/providers/03-community-providers/25-llamagate.mdx
LlamaGate is an OpenAI-compatible API gateway providing access to 26+ open-source LLMs with competitive pricing. Perfect for indie developers and startups who want affordable access to models like Llama, Qwen, DeepSeek, and Mistral.
Learn more about LlamaGate's capabilities in the LlamaGate Documentation.
The LlamaGate provider is available in the @llamagate/ai-sdk-provider module. You can install it with:
<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}> <Tab> <Snippet text="pnpm add @llamagate/ai-sdk-provider" dark /> </Tab> <Tab> <Snippet text="npm install @llamagate/ai-sdk-provider" dark /> </Tab> <Tab> <Snippet text="yarn add @llamagate/ai-sdk-provider" dark /> </Tab> <Tab> <Snippet text="bun add @llamagate/ai-sdk-provider" dark /> </Tab> </Tabs>
To create a LlamaGate provider instance, use the createLlamaGate function:
import { createLlamaGate } from '@llamagate/ai-sdk-provider';
const llamagate = createLlamaGate({
apiKey: 'YOUR_LLAMAGATE_API_KEY',
});
You can obtain your LlamaGate API key from the LlamaGate Dashboard.
Alternatively, you can use the default instance which reads from the LLAMAGATE_API_KEY environment variable:
import { llamagate } from '@llamagate/ai-sdk-provider';
LlamaGate provides chat models via the llamagate() function or llamagate.chatModel():
// Default usage
const model = llamagate('llama-3.1-8b');
// Explicit chat model
const chatModel = llamagate.chatModel('qwen3-8b');
| Model ID | Description | Context |
|---|---|---|
llama-3.1-8b | Llama 3.1 8B Instruct | 131K |
llama-3.2-3b | Llama 3.2 3B | 131K |
qwen3-8b | Qwen 3 8B | 32K |
mistral-7b-v0.3 | Mistral 7B v0.3 | 32K |
deepseek-r1-8b | DeepSeek R1 8B (Reasoning) | 64K |
deepseek-r1-7b-qwen | DeepSeek R1 Distill Qwen 7B | 131K |
openthinker-7b | OpenThinker 7B | 32K |
dolphin3-8b | Dolphin 3 8B | 128K |
qwen2.5-coder-7b | Qwen 2.5 Coder 7B | 32K |
codellama-7b | CodeLlama 7B | 16K |
qwen3-vl-8b | Qwen 3 VL 8B (Vision) | 32K |
llava-7b | LLaVA 1.5 7B (Vision) | 4K |
gemma3-4b | Gemma 3 4B (Vision) | 128K |
You can find the full list of available models in the LlamaGate Models documentation.
LlamaGate provides text embedding models via llamagate.textEmbeddingModel():
const embeddingModel = llamagate.textEmbeddingModel('nomic-embed-text');
| Model ID | Description | Context |
|---|---|---|
nomic-embed-text | Nomic Embed Text | 8K |
embeddinggemma-300m | EmbeddingGemma 300M | 2K |
qwen3-embedding-8b | Qwen 3 Embedding 8B | 40K |
Here are examples of using LlamaGate with the AI SDK:
generateTextimport { createLlamaGate } from '@llamagate/ai-sdk-provider';
import { generateText } from 'ai';
const llamagate = createLlamaGate({
apiKey: 'YOUR_LLAMAGATE_API_KEY',
});
const { text } = await generateText({
model: llamagate('llama-3.1-8b'),
prompt: 'Explain quantum computing in simple terms.',
});
console.log(text);
streamTextimport { createLlamaGate } from '@llamagate/ai-sdk-provider';
import { streamText } from 'ai';
const llamagate = createLlamaGate({
apiKey: 'YOUR_LLAMAGATE_API_KEY',
});
const result = streamText({
model: llamagate('qwen3-8b'),
prompt: 'Write a short story about a robot.',
});
for await (const chunk of result) {
console.log(chunk);
}
embedimport { createLlamaGate } from '@llamagate/ai-sdk-provider';
import { embed } from 'ai';
const llamagate = createLlamaGate({
apiKey: 'YOUR_LLAMAGATE_API_KEY',
});
const { embedding } = await embed({
model: llamagate.textEmbeddingModel('nomic-embed-text'),
value: 'The quick brown fox jumps over the lazy dog.',
});
console.log(embedding);
import { createLlamaGate } from '@llamagate/ai-sdk-provider';
import { generateText } from 'ai';
const llamagate = createLlamaGate({
apiKey: 'YOUR_LLAMAGATE_API_KEY',
});
const { text } = await generateText({
model: llamagate('qwen3-vl-8b'),
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'What is in this image?' },
{ type: 'image', image: new URL('https://example.com/image.jpg') },
],
},
],
});
console.log(text);