⚠️ Pending Update · 2026-08-29 Verification · Content may be outdated, please refer to official docs Updated: 2026-08-29 · Status: Pending Verification
Introduction
Together AI is a hosting provider focused on open-source models, offering inference APIs for hundreds of models including Llama, Qwen, and DeepSeek. New accounts get a $5 welcome credit — enough for several hundred thousand tokens. This article walks through signup, your first call, and image generation.
架构图
Sign Up and Claim Credits
- Open https://www.together.ai and click Sign Up. Log in with Google or GitHub.
- Go to https://api.together.ai/settings/billing. The $5 credit is automatically credited to new accounts.
- If it does not appear, enter a referral code on the Dashboard or email support@together.ai.
- Create an API key at https://api.together.ai/settings/api-keys and copy the
xxxxx...string.
Split keys by purpose: one for local development, another for CI with a $1 cap to prevent runaway spend.
Install and Configure
Together AI is fully OpenAI-compatible, so the openai SDK works directly:
pip install openai
export TOGETHER_API_KEY="..."
Example Call
import os
from openai import OpenAI
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-3.3-70B-Instruct-Turbo",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain an inverted index in one sentence."},
],
temperature=0.3,
max_tokens=256,
)
print(resp.choices[0].message.content)
Image Generation
Together also hosts Stable Diffusion / FLUX:
import requests, os, base64
r = requests.post(
"https://api.together.xyz/v1/images/generations",
headers={"Authorization": f"Bearer {os.environ['TOGETHER_API_KEY']}"},
json={
"model": "black-forest-labs/FLUX.1-schnell-Free",
"prompt": "a serene mountain lake at sunrise",
"n": 1,
},
)
img_b64 = r.json()["data"][0]["b64_json"]
with open("lake.png", "wb") as f:
f.write(base64.b64decode(img_b64))
Browse Available Models
curl https://api.together.xyz/v1/models \
-H "Authorization: Bearer $TOGETHER_API_KEY" | jq '.data[].id' | head
Or browse https://docs.together.ai/docs/inference-models. Models with :free are free but rate-limited.
Cost Estimation
For Llama-3.3-70B-Instruct-Turbo:
- Input: $0.88 / 1M tokens
- Output: $0.88 / 1M tokens
The $5 credit buys roughly 5M tokens — enough for one to two weeks of prototyping. Turbo variants are 3-5x cheaper than the base; prefer them.
Model Selection and Cost Optimization
Together models fall into three tiers: :free (fully free but strictly rate-limited), Turbo variants (quantized for the best price/performance), and the original (highest accuracy, higher price). For daily development prefer Turbo — Llama-3.3-70B-Instruct-Turbo is 3-5x cheaper than the base. For Chinese, try Qwen/Qwen2.5-72B-Instruct-Turbo; for code, Qwen/Qwen2.5-Coder-32B-Instruct.
Troubleshooting
401 unauthorized: Make sure the key was copied in full with no leading or trailing spaces.model not found: Model IDs are case-sensitive. Trust the list returned by/v1/models.- Out of credit: Add a card for pay-as-you-go, or fall back to
:freemodels on OpenRouter. - Fine-tuning: Together offers a Fine-tuning API — see https://docs.together.ai/docs/fine-tuning.
Together AI is a cost-effective choice for commercializing open-source models.
Best Practices
- $5 credit buys 500-1000 calls: Llama 3.3 70B is about $0.6/M token, so $5 lasts a while.
- Together direct is faster than via OpenRouter: skipping a network hop saves 50-100ms latency.
- Quantized models are cheaper:
Llama-3.3-70B-Instruct-Turboquantized is 1/3 the price of FP16. - Use the OpenAI SDK directly: just swap
base_urlandapi_key, leave the rest of your code unchanged.
🚀 Get Started: One-Click Free API Access
Want to call all the free models above with a single API key, no need to sign up for each provider? Apishare.cc provides a unified API Key — one key, 100+ models, free models at zero cost.
👉 Register on Apishare.cc → Get your unified API Key
📊 Want to see more free model rankings? Check out the Sep 2026 Free LLM API Rankings →
Get Started: APIShare Free API Directory
- Claim free credits: Register · Sign in
- Browse all free APIs: Free API Directory
About the Free API Aggregator
The models covered in this guide are all served through the APIShare free API aggregator, which gives you one key for the whole catalog.
- Full model catalog: APIShare free API directory
- Sign up for a free trial key: Register and claim your API key