Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
09e09dd
codegen metadata
stainless-app[bot] Apr 28, 2026
984519c
feat: Add default retrieve handler when passing an id to commands (#345)
blainekasten Apr 28, 2026
2ea6a2d
feat(api): Update server url to .ai
stainless-app[bot] Apr 28, 2026
5fae36f
codegen metadata
stainless-app[bot] Apr 29, 2026
0c33450
chore: Update references from .xyz to .ai domain (#349)
blainekasten Apr 29, 2026
549c763
codegen metadata
stainless-app[bot] Apr 29, 2026
949bfa4
chore: Improve --json support accross multiple commands (#347)
blainekasten Apr 29, 2026
315e544
codegen metadata
stainless-app[bot] Apr 29, 2026
c03fb18
feat(api): add cached_input field to Pricing model
stainless-app[bot] Apr 29, 2026
b1edd58
feat: MOSH-2181: Add default note on max-seq-length
stainless-app[bot] Apr 30, 2026
1476f70
feat: Show cache input token pricing in models list cli output (#350)
blainekasten Apr 30, 2026
ea1d61a
fix(types): remove eval-sample, eval-output, eval-summary, batch-gene…
stainless-app[bot] Apr 30, 2026
bdf480c
codegen metadata
stainless-app[bot] Apr 30, 2026
95cf65b
feat: ENG-87042: clarify TTS language parameter supports lowercase lo…
stainless-app[bot] Apr 30, 2026
14b429f
feat: ENG-87042: document language on TTS WebSocket and simplify loca…
stainless-app[bot] Apr 30, 2026
1668cf4
chore: Pass agent name in request headers when detected (#351)
blainekasten Apr 30, 2026
4905c1a
docs: polish CLI help text; introduce Options + Global Options panels…
muhsinking Apr 30, 2026
a52e64b
chore(internal): reformat pyproject.toml
stainless-app[bot] Apr 30, 2026
f59d672
feat: add the pronunciation dict
stainless-app[bot] May 1, 2026
2f1c458
fix: Properly handle unlinking temp file during fine-tuning download …
blainekasten May 1, 2026
307ff11
release: 2.12.0
stainless-app[bot] May 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.11.0"
".": "2.12.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 75
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-19148ebeed55db4be0c1c60d31c81306386c4c71a2aee8d1eeac8ebfa15c1168.yml
openapi_spec_hash: 747224d60adf1ab51760e5752ce1b846
config_hash: 279a64a8df3e6dba241bfa1e18a04f69
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai/togetherai-e1200616b1a93d40e478800d2c9e06ddeb10b508f2a9aa65810ee31878ba4f23.yml
openapi_spec_hash: 23245993d115722da1b697f10799f4f1
config_hash: 6c214c91fad5ead4849be777fd9e8108
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 2.12.0 (2026-05-01)

Full Changelog: [v2.11.0...v2.12.0](https://github.com/togethercomputer/together-py/compare/v2.11.0...v2.12.0)

### Features

* Add default retrieve handler when passing an id to commands ([#345](https://github.com/togethercomputer/together-py/issues/345)) ([984519c](https://github.com/togethercomputer/together-py/commit/984519c038d4b99a794b5665c5c74b7c22f8802c))
* add the pronunciation dict ([f59d672](https://github.com/togethercomputer/together-py/commit/f59d672d1f26abc9b4ad6216209b6d6707cfa88b))
* **api:** add cached_input field to Pricing model ([c03fb18](https://github.com/togethercomputer/together-py/commit/c03fb180dc52531e4c99ebcd2a2ca8acea81dc9b))
* **api:** Update server url to .ai ([2ea6a2d](https://github.com/togethercomputer/together-py/commit/2ea6a2d9201373c8959b4c34749236183a785543))
* ENG-87042: clarify TTS language parameter supports lowercase locales ([95cf65b](https://github.com/togethercomputer/together-py/commit/95cf65b30233791b1e73f823a3cb0e6cdb731ab4))
* ENG-87042: document language on TTS WebSocket and simplify locale note ([14b429f](https://github.com/togethercomputer/together-py/commit/14b429f0e08c8ad9eba4ffb51ba6d8d95d35973d))
* MOSH-2181: Add default note on max-seq-length ([b1edd58](https://github.com/togethercomputer/together-py/commit/b1edd58f1bc7ccc2f3b1016ac5d09eaf2fad16b3))
* Show cache input token pricing in models list cli output ([#350](https://github.com/togethercomputer/together-py/issues/350)) ([1476f70](https://github.com/togethercomputer/together-py/commit/1476f709115b23e6ca08468c4b0ca6e72553d967))


### Bug Fixes

* Properly handle unlinking temp file during fine-tuning download ([#352](https://github.com/togethercomputer/together-py/issues/352)) ([2f1c458](https://github.com/togethercomputer/together-py/commit/2f1c458ee388a14757c50b077e8402c0a063fe01))
* **types:** remove eval-sample, eval-output, eval-summary, batch-generated from FilePurpose ([ea1d61a](https://github.com/togethercomputer/together-py/commit/ea1d61a182cad4f11f0e123a23381284f61b2153))


### Chores

* Improve --json support accross multiple commands ([#347](https://github.com/togethercomputer/together-py/issues/347)) ([949bfa4](https://github.com/togethercomputer/together-py/commit/949bfa4514e34b761727622fab3d345e940a7fe9))
* **internal:** reformat pyproject.toml ([a52e64b](https://github.com/togethercomputer/together-py/commit/a52e64bde79ccfe3f06c9d4a59af5e736889e412))
* Pass agent name in request headers when detected ([#351](https://github.com/togethercomputer/together-py/issues/351)) ([1668cf4](https://github.com/togethercomputer/together-py/commit/1668cf4208e4c32c7ee91a6978b708bc8c4c8256))
* Update references from .xyz to .ai domain ([#349](https://github.com/togethercomputer/together-py/issues/349)) ([0c33450](https://github.com/togethercomputer/together-py/commit/0c334506cfb7f56a7cc8fb0bba4c4b89aed0b408))


### Documentation

* polish CLI help text; introduce Options + Global Options panels ([#346](https://github.com/togethercomputer/together-py/issues/346)) ([4905c1a](https://github.com/togethercomputer/together-py/commit/4905c1ac807de4b317639524720592d51b1d23f9))

## 2.11.0 (2026-04-28)

Full Changelog: [v2.10.0...v2.11.0](https://github.com/togethercomputer/together-py/compare/v2.10.0...v2.11.0)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "together"
version = "2.11.0"
version = "2.12.0"
description = "The official Python library for the together API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -177,7 +177,7 @@ show_error_codes = true
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
exclude = ['src/together/_files.py', '_dev/.*.py', 'tests/.*']
exclude = ["src/together/_files.py", "_dev/.*.py", "tests/.*"]

strict_equality = true
implicit_reexport = true
Expand Down
17 changes: 17 additions & 0 deletions src/together/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import pydantic
from httpx import URL
from pydantic import PrivateAttr
from detect_agent import determine_agent

from . import _exceptions
from ._qs import Querystring
Expand Down Expand Up @@ -675,6 +676,7 @@ def default_headers(self) -> dict[str, str | Omit]:
"Content-Type": "application/json",
"User-Agent": self.user_agent,
**self.platform_headers(),
**self.agent_headers(),
**self.auth_headers,
**self._custom_headers,
}
Expand Down Expand Up @@ -714,6 +716,12 @@ def platform_headers(self) -> Dict[str, str]:
# https://github.com/python/cpython/issues/88476
return platform_headers(self._version, platform=self._platform)

def agent_headers(self) -> dict[str, str]:
# the actual implementation is in a separate `lru_cache` decorated
# function because adding `lru_cache` to methods will leak memory
# https://github.com/python/cpython/issues/88476
return agent_headers()

def _parse_retry_after_header(self, response_headers: Optional[httpx.Headers] = None) -> float | None:
"""Returns a float of the number of seconds (not milliseconds) to wait after retrying, or None if unspecified.

Expand Down Expand Up @@ -2055,6 +2063,15 @@ def get_platform() -> Platform:
return "Unknown"


@lru_cache(maxsize=None)
def agent_headers() -> dict[str, str]:
agent = determine_agent()
if agent["is_agent"] and agent["agent"]:
return {"X-Stainless-Agent": agent["agent"]["name"]}

return {}


@lru_cache(maxsize=None)
def platform_headers(version: str, *, platform: Platform | None) -> Dict[str, str]:
return {
Expand Down
4 changes: 2 additions & 2 deletions src/together/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
base_url = os.environ.get("TOGETHER_BASE_URL")
self._base_url_overridden = base_url is not None
if base_url is None:
base_url = f"https://api.together.xyz/v1"
base_url = f"https://api.together.ai/v1"

custom_headers_env = os.environ.get("TOGETHER_CUSTOM_HEADERS")
if custom_headers_env is not None:
Expand Down Expand Up @@ -402,7 +402,7 @@ def __init__(
base_url = os.environ.get("TOGETHER_BASE_URL")
self._base_url_overridden = base_url is not None
if base_url is None:
base_url = f"https://api.together.xyz/v1"
base_url = f"https://api.together.ai/v1"

custom_headers_env = os.environ.get("TOGETHER_CUSTOM_HEADERS")
if custom_headers_env is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/together/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "together"
__version__ = "2.11.0" # x-release-please-version
__version__ = "2.12.0" # x-release-please-version
2 changes: 1 addition & 1 deletion src/together/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
MAX_CONNECTION_RETRIES = 2
MAX_RETRIES = DEFAULT_MAX_RETRIES

BASE_URL = "https://api.together.xyz/v1"
BASE_URL = "https://api.together.ai/v1"
Loading
Loading