Find an API

Search public APIs with auth details & Postman guides

← All APIs

Together AI

api.together.xyz · AI

AI Bearer Token Free Tier AI LLM Open Source

Run 200+ open-source AI models via a single OpenAI-compatible API — LLaMA, Mistral, Qwen, Gemma, DeepSeek, and more. $100 free credits for new accounts.

Authentication

Bearer Token API key from api.together.xyz. Pass as Authorization: Bearer YOUR_KEY.

Sample Requests

POST Chat completion

Chat with LLaMA 3 8B.

https://api.together.xyz/v1/chat/completions

Hover any highlighted part to learn what it does

Headers — extra info sent with the request
Content-Type application/json
Authorization Bearer YOUR_KEY
Request Body — data you're sending
{
  "model": "meta-llama/Llama-3-8b-chat-hf",
  "messages": [
    {
      "role": "user",
      "content": "Explain APIs to a 5-year-old."
    }
  ]
}
curl -X POST "https://api.together.xyz/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"meta-llama/Llama-3-8b-chat-hf","messages":[{"role":"user","content":"Explain APIs to a 5-year-old."}]}'
import requests
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
data = {
    "model": "meta-llama/Llama-3-8b-chat-hf",
    "messages": [
        {
            "role": "user",
            "content": "Explain APIs to a 5-year-old."
        }
    ]
}
response = requests.post(
    "https://api.together.xyz/v1/chat/completions",
    headers=headers,
    json=data,
)
print(response.json())
const url = 'https://api.together.xyz/v1/chat/completions';

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "model": "meta-llama/Llama-3-8b-chat-hf",
  "messages": [
    {
      "role": "user",
      "content": "Explain APIs to a 5-year-old."
    }
  ]
}),
}); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"bytes"
	"encoding/json"
)

func main() {
	targetURL := "https://api.together.xyz/v1/chat/completions"
	jsonData, _ := json.Marshal({"model":"meta-llama/Llama-3-8b-chat-hf","messages":[{"role":"user","content":"Explain APIs to a 5-year-old."}]})
	req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.together.xyz/v1/chat/completions")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
req["Content-Type"] = "application/json"
req.body = "{\"model\":\"meta-llama/Llama-3-8b-chat-hf\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain APIs to a 5-year-old.\"}]}"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.together.xyz/v1/chat/completions";
$opts = ["http" => [
    "method" => "POST",
    "header" => implode("\r\n", [
        "Content-Type: application/json",
        "Authorization: Bearer YOUR_ACCESS_TOKEN",
        "Content-Type: application/json"
    ]),
    "content" => json_encode({"model":"meta-llama/Llama-3-8b-chat-hf","messages":[{"role":"user","content":"Explain APIs to a 5-year-old."}]}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Sign up at api.together.xyz for $100 in free credits
  2. Get API key from your account settings
  3. Set Authorization: Bearer YOUR_KEY
  4. Fully OpenAI-compatible — just change the base URL and model name
  5. List models: GET /v1/models

Open documentation ↗