Quickstart

Get up to speed with our inference API in one minute.

👋 Welcome to the Together AI docs! Together AI makes it easy to run or fine-tune leading open source models with only a few lines of code.

  • Inference - Use the API or playgrounds to evaluate serverless models
  • Fine-Tuning - Fine-tune with a few commands and deploy your fine-tuned model for inference.
  • GPU Clusters - If you're interested in private, state of the art clusters with A100 or H100 GPUs, contact us.

Get started with Inference

  1. Register for an account to access your API key (we give you $5 to get started).
  2. Run your first model after installing our library (pip install together for Python or npm install together-ai for TypeScript):
import os
from together import Together

client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))

response = client.chat.completions.create(
    model="meta-llama/Llama-3-8b-chat-hf",
    messages=[{"role": "user", "content": "What are some fun things to do in New York"}],
)
print(response.choices[0].message.content)
import Together from "together-ai";

const together = new Together({
  apiKey: process.env["TOGETHER_API_KEY"],
});

const response = await together.chat.completions.create({
  messages: [{ role: "user", content: "Tell me fun things to do in New York" }],
  model: "meta-llama/Llama-3-8b-chat-hf",
});
console.log(response..choices[0].message.content)
curl -X POST "https://api.together.xyz/v1/chat/completions" \
     -H "Authorization: Bearer $TOGETHER_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
     "model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
     "messages": [
     		{"role": "system", "content": "You are an expert travel guide"},
     		{"role": "user", "content": "Tell me fun things to do in San Francisco."}
     	]
     }'

You can choose from any of our many supported models to generate chat, images, language, or code. We can't wait to see what you build!

Next steps

Resources