Platform • Docs • Blog • Discord
The Together Cookbook is a collection of code and guides designed to help developers build with open source models using Together AI. The best way to use the recipes is to copy code snippets and integrate them into your own projects!
We welcome contributions to this repository! If you have a cookbook you'd like to add, please reach out to use the Discord or open a pull request!
To make the most of the examples in this cookbook, you'll need a Together AI API key (sign up for free here).
While the code examples are primarily written in Python/JS, the concepts can be adapted to any programming language that supports interaction with the Together API.
| Cookbook | Description | Open |
|---|---|---|
| Inference: chat and text | ||
| Thinking Augmented Generation | Give R1 thinking tokens to small models. | |
| Summarization Evaluation | Summarize and evaluate outputs with LLMs. | |
| Inference: vision | ||
| Multimodal RAG with Nvidia Slide Deck | Multimodal RAG using Nvidia investor slides. | |
| OCR | Text extraction, multilingual OCR, and text spotting with Qwen3-VL. | |
| 2D Grounding | Object detection with 2D bounding boxes and point grounding. | |
| 3D Grounding | 3D bounding boxes, camera parameters, depth perception. | |
| Spatial Understanding | Object relationships, affordances, embodied reasoning. | |
| Video Understanding | Video description, temporal localization, video Q&A. | |
| Omni Recognition | Universal recognition for celebrities, anime, food, landmarks. | |
| Document Parsing | Convert documents to HTML/Markdown with coordinates. | |
| Image to Code | Screenshot to HTML, chart to matplotlib code. | |
| Long Document Understanding | Multi-page PDF analysis and Q&A. | |
| Structured Text Extraction from Images | Extract structured text from images. | |
| Inference: image generation | ||
| Multimodal Search and Conditional Image Generation | Text-to-image and image-to-image search and conditional image generation. | |
| Inference: structured outputs | ||
| Knowledge Graphs with Structured Outputs | Get LLMs to generate knowledge graphs. | |
| Inference: batch | ||
| Batch Inference & Evals | Batch inference and evaluation workflows. | |
| Agents | ||
| Serial Chain Agent Workflow | Chain multiple LLM calls sequentially to process complex tasks. | |
| Conditional Router Agent Workflow | Create an agent that routes tasks to specialized models. | |
| Parallel Agent Workflow | Run multiple LLMs in parallel and aggregate their solutions. | |
| Orchestrator Subtask Agent Workflow | Break down tasks into parallel subtasks executed by LLMs. | |
| Looping Agent Workflow | Build an agent that iteratively improves responses. | |
| Cross-Provider Advisor Agent Workflow | A cheap Together executor does the work and only consults a frontier Claude advisor when it gets stuck. | |
| Together Open Deep Research | An open source deep-research implementation with multi-step web search. | |
| Agno Agents | Build agents with the Agno framework on Together. | |
| Arcade Agents | Build agents with Arcade.dev tool integrations. | |
| Composio Agents | Use Composio tools to build production-grade agents. | |
| DSPy Agents | Build optimized agents with DSPy and Together models. | |
| Klavis AI Agents | Use Klavis AI to give agents access to MCP-based tools. | |
| Agentic RAG with LangGraph | Build an agentic RAG pipeline with LangGraph. | |
| LangGraph Planning Agent | Build a plan-and-execute agent with LangGraph. | |
| PydanticAI Agents | Build type-safe agents with PydanticAI and Together. | |
| Tool Use with Toolhouse | Use Toolhouse tools with Together's function-calling models. | |
| Apps | ||
| PDF to Podcast | Generate a podcast from PDF content (NotebookLM-style). | |
| Fine-tuning | ||
| End-to-end Fine-tuning Guide | Fine-tuning basics and best practices. | |
| Preference Tuning - DPO | Fine-tuning LLMs with preference data using DPO. | |
| Continual Fine-tuning | Continuously fine-tune model checkpoints on new data. | |
| Function Calling Fine-tuning | Fine-tune LLMs for tool/function-calling use cases. | |
| Reasoning Fine-tuning | Fine-tune LLMs with reasoning traces. | |
| Vision-Language Fine-tuning | Fine-tune VLMs on image+text data. | |
| Long Context Fine-tuning for Repetition | Fine-tune LLMs to repeat back words in long sequences. | |
| Summarization Long Context Fine-tuning | Long context fine-tuning to improve summarization. | |
| Multi-turn Conversation Fine-tuning | Fine-tune LLMs on multi-step conversations. | |
| Evaluations | ||
| Classification Evals | LLM-as-a-Judge for safety evaluation and classification tasks. | |
| Compare Evals | Head-to-head model comparison on summarization tasks. | |
| Prompt Evals | Prompt optimization through A/B testing and comparison. | |
| Optimizing LLM Judges | Tune LLM-as-judge configurations for better alignment with humans. | |
| GEPA Optimization | Optimize prompts via genetic prompt evolution (GEPA) on Together. | |
| Dedicated endpoints | ||
| Grafana Dashboard for Dedicated Endpoints | Monitor dedicated endpoints in Grafana with an importable example dashboard. | |
| OpenEnv | ||
| OpenEnv GRPO BlackJack | Train Blackjack policies via GRPO using OpenEnv on Together. | — |
Folders mirror the product areas in the Together AI docs. New notebooks go in the folder for the product they demonstrate:
inference/: examples that call the inference APIs, grouped by capability (chat/,vision/,image-generation/,structured-outputs/,batch/). These run on serverless models or on dedicated model inference by swapping themodelparameter.agents/: agent workflow patterns and framework integrations (LangGraph, DSPy, PydanticAI, Agno, tool providers such as Arcade, Composio, Klavis, and Toolhouse).apps/: end-to-end demo apps that back the Build apps guides.fine-tuning/: fine-tuning jobs, from the end-to-end guide to DPO, continual, long-context, and vision-language runs.evaluations/: the Evaluations API (classification, comparison, prompt, and judge-tuning evals).dedicated-endpoints/: operating dedicated endpoints (monitoring, dashboards, deploys), as opposed to calling a model.openenv/: OpenEnv reinforcement-learning environments.archived/: notebooks that no longer run on the platform (see below).images/anddatasets/: shared assets referenced by notebooks across folders.
Folders with runnable scripts rather than notebooks carry a ci.yaml manifest for execution CI (see .ci/run_examples.py).
Several code demos in the Together AI documentation are backed folders or notebooks in this repo. The docs page is the source of truth for the explanation, and the cookbook holds the full runnable code.
Notebooks that depend on models no longer available on the platform, or that have been superseded, move to archived/ instead of rotting in place. Archived notebooks are excluded from execution CI and from the table above. See archived/README.md for what was archived and why. Don't link to archived notebooks from the docs.
Looking for more resources to enhance your experience with open source models? Check out these helpful links:
- Together AI Research: Explore papers and technical blog posts from our research team.
- Together AI Blog: Explore technical blogs, product announcements and more on our blog.