Together AI API keys

25 community-sourced Together AI keys, re-checked against the API. Copy a key below, export it as TOGETHER_API_KEY, and send requests to https://api.together.xyz/v1.

Keys

Using your Together AI key

Export the key as TOGETHER_API_KEY, then call the API at https://api.together.xyz/v1.

export TOGETHER_API_KEY="your-key-here"

curl

curl https://api.together.xyz/v1/chat/completions \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "meta-llama/Llama-4-Scout-17B-16E-Instruct",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Python (OpenAI SDK)

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["TOGETHER_API_KEY"],
    base_url="https://api.together.xyz/v1",
)

resp = client.chat.completions.create(
    model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
    messages=[{"role": "user", "content": "Say hello"}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.TOGETHER_API_KEY,
  baseURL: "https://api.together.xyz/v1",
});

const resp = await client.chat.completions.create({
  model: "meta-llama/Llama-4-Scout-17B-16E-Instruct",
  messages: [{ role: "user", content: "Say hello" }],
});
console.log(resp.choices[0].message.content);