Meta logoLlama 3.1 8B Instruct

State of the art open-source 8B LLM by Meta

Deploy Llama 3.1 8B Instruct behind an API endpoint in seconds.

Deploy model

Example usage

Call the model and stream results

Input
1import requests
2
3# Replace the empty string with your model id below
4model_id = ""
5baseten_api_key = os.environ["BASETEN_API_KEY"]
6
7data = {
8    "prompt": "What even is AGI?",
9    "stream": True,
10    "max_tokens": 1024
11}
12
13# Call model endpoint
14res = requests.post(
15    f"https://model-{model_id}.api.baseten.co/production/predict",
16    headers={"Authorization": f"Api-Key {baseten_api_key}"},
17    json=data,
18    stream=True
19)
20
21# Print the generated tokens as they get streamed
22for content in res.iter_content():
23    print(content.decode("utf-8"), end="", flush=True)
JSON output
1[
2    "arrrg",
3    "me hearty",
4    "I",
5    "be",
6    "doing",
7    "..."
8]

Deploy any model in just a few commands

Avoid getting tangled in complex deployment processes. Deploy best-in-class open-source models and take advantage of optimized serving for your own models.

$

truss init -- example stable-diffusion-2-1-base ./my-sd-truss

$

cd ./my-sd-truss

$

export BASETEN_API_KEY=MdNmOCXc.YBtEZD0WFOYKso2A6NEQkRqTe

$

truss push

INFO

Serializing Stable Diffusion 2.1 truss.

INFO

Making contact with Baseten 👋 👽

INFO

🚀 Uploading model to Baseten 🚀

Upload progress: 0% | | 0.00G/2.39G