together
The official Python SDK for the Together AI REST API, with typed sync and async clients.
Repository Health
Technical Analysis
together is the official Python library for the Together AI platform, providing convenient access to the Together REST API for running open-source and frontier models. The 2.x SDK is generated with Stainless and includes full type definitions for every request parameter and response field, plus both synchronous and asynchronous clients powered by httpx.
It exposes Together AI’s full surface — chat completions, text completions, embeddings, reranking, image and video generation, audio, fine-tuning, batches, files, evals, endpoints, and a code interpreter — behind an ergonomic resource-based client that mirrors the OpenAI-style API shape.
What You Get
- Synchronous
Togetherand asynchronousAsyncTogetherclients built on httpx - Typed request params and response models for the entire Together AI API
- Resource namespaces for chat, completions, embeddings, images, videos, audio, and fine-tuning
- Streaming responses, pagination helpers, and configurable retries/timeouts
Common Use Cases
- Calling open and frontier LLMs for chat and text completion
- Generating embeddings for retrieval and semantic search
- Fine-tuning models and generating images or video via one typed client
Under The Hood
Architecture - The src/together/ package follows the Stainless SDK layout: _base_client.py and _client.py implement the HTTP client (sync + async), _models.py/_types.py provide Pydantic-backed typed models, _streaming.py handles server-sent streaming, and pagination.py supplies page iterators. Each API area is a resource module under resources/ (chat, completions, embeddings, images, videos, audio, fine_tuning, batches, files, evals, endpoints, rerank, code_interpreter) with matching schemas under types/.
Tech Stack - Python 3.9+, built on httpx for transport and pydantic v2 for models, packaged with a modern pyproject.toml and uv.lock. Releases are automated via release-please.
Code Quality - The tests/ tree is comprehensive, with api_resources/ unit tests, integration/ tests, CLI tests, test_client.py, and test_files.py plus a conftest.py. Being generator-produced, naming and error handling are consistent across resources, and py.typed ships for full type-checker support.
API Design - The developer experience is excellent and OpenAI-like: instantiate Together(api_key=...) and call namespaced methods such as client.chat.completions.create(...). Sync and async parity, streaming, typed params, and env-var key defaults keep boilerplate minimal.