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
- Register for an account to access your API key (we give you $25 to get started).
- Run your first model after installing our library (
pip install together
):
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 OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.TOGETHER_API_KEY,
baseURL: 'https://api.together.xyz/v1',
});
async function main() {
const response = await client.chat.completions.create({
messages: [
{
role: 'system',
content: 'You are an expert travel guide.',
},
{
role: 'user',
content: 'Tell me fun things to do in San Francisco.',
},
],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
});
const output = response.choices[0].message.content;
console.log(output);
}
main();
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
- Check out the Together AI playground to try out different models.
- Learn how to stream responses back to your applications.
- Explore our examples to learn about various use cases.
- See our integrations with leading LLM frameworks.
Resources
Updated 10 days ago