Install:
npx skills add diskd-ai/together-api| skills.sh
Integration skill for building AI-powered applications with Together AI's open-source model inference platform.
This skill provides guidance and patterns for working with Together AI's API, covering:
- Chat completions with 200+ open-source models
- Vision/image understanding
- Image generation (FLUX, Stable Diffusion)
- Audio transcription (Whisper) and text-to-speech
- Tool use/function calling
- Structured outputs and JSON mode
- Embeddings
Triggers:
- Mentions of Together AI, Together API, or GroqCloud
- Working with open-source LLM inference
- Using Python SDK (
together) or TypeScript SDK (together-ai) - Tasks involving FLUX image generation or Whisper transcription via Together
Use cases:
- Implementing chat completions with Llama, DeepSeek, Qwen, or other open-source models
- Adding vision capabilities with Llama 4 multimodal models
- Generating images with FLUX or Stable Diffusion
- Transcribing audio with Whisper
- Building agents with tool use/function calling
- Creating embeddings for RAG or semantic search
# Python
pip install together
# TypeScript/JavaScript
npm install together-aiexport TOGETHER_API_KEY=<your-api-key>Python:
from together import Together
client = Together() # Uses TOGETHER_API_KEY env var
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[{"role": "user", "content": "Hello"}]
)TypeScript:
import Together from "together-ai";
const client = new Together();
const response = await client.chat.completions.create({
model: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages: [{ role: "user", content: "Hello" }],
});| Use Case | Model | Notes |
|---|---|---|
| Fast + cheap | meta-llama/Llama-3.2-3B-Instruct-Turbo |
Best for simple tasks |
| Balanced | meta-llama/Llama-3.3-70B-Instruct-Turbo |
Quality/cost balance |
| Highest quality | deepseek-ai/DeepSeek-V3 |
163K context |
| Reasoning | deepseek-ai/DeepSeek-R1 |
Chain-of-thought |
| Vision | meta-llama/Llama-4-Scout-17B-16E-Instruct |
Image understanding |
| Code | Qwen/Qwen2.5-Coder-32B-Instruct |
Code generation |
| Audio STT | openai/whisper-large-v3 |
Transcription |
| TTS | canopylabs/orpheus-3b |
Text-to-speech |
| Image Gen | black-forest-labs/FLUX.1-schnell |
Fast image generation |
together-api/
SKILL.md # Full API reference and patterns
README.md # This file (overview)
references/ # Supporting documentation
models.md # Complete model list and pricing
tool-use.md # Function calling patterns
vision.md # Image/video processing
audio.md # Transcription and TTS
images.md # Image generation
stream = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[{"role": "user", "content": "List 3 colors as JSON array"}],
response_format={"type": "json_object"}
)response = client.chat.completions.create(
model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
]
}]
)response = client.images.generate(
prompt="A serene mountain landscape at sunset",
model="black-forest-labs/FLUX.1-schnell",
steps=4,
width=1024,
height=1024
)from together import Together
from together._exceptions import RateLimitError, APIConnectionError, APIStatusError
client = Together()
try:
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[{"role": "user", "content": "Hello"}]
)
except RateLimitError:
# Wait and retry with exponential backoff
pass
except APIConnectionError:
# Network issue
pass
except APIStatusError as e:
# API error (check e.status_code)
pass- Full skill reference: SKILL.md
- Models and pricing: references/models.md
- Tool use guide: references/tool-use.md
- Vision guide: references/vision.md
- Audio guide: references/audio.md
- Image generation: references/images.md
- Official docs: https://docs.together.ai
- Python SDK: https://github.com/togethercomputer/together-python
- TypeScript SDK: https://github.com/togethercomputer/together-typescript
MIT