API du modèle meta-llama/llama-3.1-8b-instruct chez OpenRouter, $0.05 / $0.08 par million de tokens, contexte 131 072 tokens. Exemples curl, Python et JavaScript, test en direct.
Tester et noter dans le catalogue
Meta's latest class of model (Llama 3.1) launched with a variety of sizes & flavors. This 8B instruct-tuned version is fast and efficient. It has demonstrated strong performance compared to...
- Type
- Modèle
- Fournisseur
- OpenRouter
- Identifiant du modèle
meta-llama/llama-3.1-8b-instruct- Tarif
- Payant
- Prix entrée / sortie
- $0.05 / $0.08 par million de tokens
- Accès sans clé
- Non
- Variable de clé
OPENROUTER_API_KEY- URL de base (OpenAI-compatible)
https://openrouter.ai/api/v1- Contexte
- 131 072 tokens
- Entrées
- Texte
- Fonctions
- Sortie JSON, Appel d’outils
- Note des développeurs
- Pas encore noté
- Documentation
- https://openrouter.ai/meta-llama/llama-3.1-8b-instruct
Exemples de code
cURL
curl https://openrouter.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-d '{"model":"meta-llama/llama-3.1-8b-instruct","messages":[{"role":"user","content":"Bonjour, présente-toi en une phrase."}]}'Python
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"])
r = client.chat.completions.create(
model="meta-llama/llama-3.1-8b-instruct",
messages=[{"role": "user", "content": "Bonjour, présente-toi en une phrase."}],
)
print(r.choices[0].message.content)JavaScript
// npm install openai
import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://openrouter.ai/api/v1', apiKey: process.env.OPENROUTER_API_KEY })
const r = await client.chat.completions.create({
model: 'meta-llama/llama-3.1-8b-instruct',
messages: [{ role: 'user', content: 'Bonjour, présente-toi en une phrase.' }],
})
console.log(r.choices[0].message.content)
Générer le code d’intégration →
Recherches populaires
Questions fréquentes
L’API Meta: Llama 3.1 8B Instruct est-elle gratuite ?
Non : Meta: Llama 3.1 8B Instruct est une API payante ($0.05 / $0.08 par million de tokens).
Comment appeler Meta: Llama 3.1 8B Instruct depuis mon code ?
Meta: Llama 3.1 8B Instruct expose une API compatible OpenAI à l’adresse https://openrouter.ai/api/v1 : utilisez n’importe quel SDK OpenAI (Python, JavaScript…) avec cette URL de base. Identifiant du modèle : meta-llama/llama-3.1-8b-instruct. Du code prêt à l’emploi (streaming, JSON, reprises) est disponible dans la boîte à outils du développeur.
Quelle est la fenêtre de contexte de Meta: Llama 3.1 8B Instruct ?
Meta: Llama 3.1 8B Instruct accepte jusqu’à 131 072 jetons de contexte (message et historique).
Quelles sont les alternatives à Meta: Llama 3.1 8B Instruct ?
API similaires référencées dans le catalogue : Llama-3.2-3B-Instruct · Parasail, Llama-3.1-8B-Instruct · Amazon Bedrock, Llama-3.1-8B-Instruct · CoreWeave, Llama-3.1-8B-Instruct · DeepInfra, Llama-3.1-8B-Instruct · Groq.
Alternatives
- Llama-3.2-3B-Instruct · Parasail — Payant
- Llama-3.1-8B-Instruct · Amazon Bedrock — Payant
- Llama-3.1-8B-Instruct · CoreWeave — Payant
- Llama-3.1-8B-Instruct · DeepInfra — Payant
- Llama-3.1-8B-Instruct · Groq — Payant
- Llama-3.3-70B-Instruct · Cloudflare — Payant
- Llama-3.3-70B-Instruct · CoreWeave — Payant
- Llama-3.3-70B-Instruct · Groq — Payant
- Llama-4-Scout-17B-16E-Instruct · DeepInfra — Payant
- Llama-3.1-70B-Instruct · Amazon Bedrock — Payant
- Llama-4-Maverick-17B-128E-Instruct · Parasail — Payant
- Llama-Guard-4-12B · DeepInfra — Payant