Meta

Setup Meta's Llama models and learn how to use them in the starter kit via various hosting providers.

The Meta provider integration brings Meta's cutting-edge Llama family of open-weight models to your applications through the AI SDK. Renowned for their exceptional performance across diverse tasks, these models deliver state-of-the-art capabilities for your AI solutions.

Meta Llama

Setup

Deploying Llama models in your applications involves leveraging a third-party hosting provider that integrates seamlessly with the AI SDK, such as DeepInfra, Fireworks AI, Amazon Bedrock, Baseten, and others.

Choose a hosting provider & get API Key

Select a trusted provider that hosts Llama models (e.g., DeepInfra, Fireworks AI, or Amazon Bedrock). Register with your preferred provider and generate a secure API key through their platform console.

Add API Key to environment

Add your provider-specific API key to your project's .env file (e.g., in apps/web). Use the appropriate environment variable for your chosen provider:

.env
# Example for DeepInfra
DEEPINFRA_API_KEY=your-deepinfra-api-key
 
# Example for Fireworks AI
FIREWORKS_API_KEY=your-fireworks-api-key
 
# Example for Amazon Bedrock (requires AWS credentials)
# AWS_ACCESS_KEY_ID=...
# AWS_SECRET_ACCESS_KEY=...
# AWS_REGION=...

Configure provider

When implementing AI SDK functions (generateText, streamText, etc.), initialize the client for your selected provider and specify the appropriate Llama model identifier:

import { generateText } from "ai";
import { deepinfra } from "@ai-sdk/deepinfra";
// Or: import { fireworks } from '@ai-sdk/fireworks';
// Or: import { bedrock } from '@ai-sdk/amazon-bedrock';
 
const { text } = await generateText({
  // Example using DeepInfra
  model: deepinfra("meta-llama/Meta-Llama-3.1-8B-Instruct"),
  // Example using Fireworks AI
  // model: fireworks('accounts/fireworks/models/llama-v3p1-8b-instruct'),
  // Example using Amazon Bedrock
  // model: bedrock('meta.llama3-1-8b-instruct-v1:0'),
  prompt: "Why is the sky blue?",
});

For comprehensive implementation details, consult the AI SDK documentation for your specific provider: DeepInfra, Fireworks AI, Amazon Bedrock, etc.

Features

Llama models accessible through the AI SDK offer a range of powerful capabilities, with specific features varying based on model version and hosting provider implementation.

Use Cases

AI Chatbot

Create intelligent, responsive chatbots capable of natural conversations, accurate information retrieval, and efficient task execution. Experience this capability in our Chat Demo.

Content Generation

Produce diverse, high-quality text content spanning articles, summaries, creative narratives, marketing copy, and more—tailored to your specific requirements.

Code Assistance

Boost developer productivity with AI-powered code generation, insightful code explanations, effective debugging assistance, and programming guidance across multiple languages.

Automated Workflows

Streamline operations by combining Llama models with tool usage capabilities to automate complex business processes and seamlessly interact with your existing systems.

How is this guide?

Last updated on

On this page

Make AI your edge, not replacement.