Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@
{
".": "0.29.0"
".": "0.30.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: 41
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-f53d9282224f2c3943d83d014d64ba61271f3aedef59197cc4dae0102d2b365d.yml
openapi_spec_hash: a884fe7d04e9f64675e3943a962ebb65
config_hash: 73457be4d72f0bf4c22de49f2b2d4ec3
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-eacfa676c4ac9c051f61d4d25c1074315959b2e3d418bca529e6de2a9f6636e7.yml
openapi_spec_hash: 1d56caf3dd011e888fb911d34bd34aef
config_hash: 3c3a676f96a972da95e0e85618e64c76
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 0.30.0 (2025-11-04)

Full Changelog: [v0.29.0...v0.30.0](https://github.com/togethercomputer/together-typescript/compare/v0.29.0...v0.30.0)

### ⚠ BREAKING CHANGES

* **api:** The default max retries for api calls has changed from 5 to 2. This may result in more frequent non-200 responses.

### Features

* **api:** Change the default max retries from 5 to 2 ([f89b597](https://github.com/togethercomputer/together-typescript/commit/f89b5970f3b5af1cdaa904de20f0e1c0493671c6))


### Bug Fixes

* Do not auto-retry on 500 errors. 501+ can retry ([7ce8399](https://github.com/togethercomputer/together-typescript/commit/7ce83993a3550d5e8f75706114543f7d7dad9cfb))

## 0.29.0 (2025-10-30)

Full Changelog: [v0.28.0...v0.29.0](https://github.com/togethercomputer/together-typescript/compare/v0.28.0...v0.29.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ Error codes are as follows:

### Retries

Certain errors will be automatically retried 5 times by default, with a short exponential backoff.
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
429 Rate Limit, and >=500 Internal errors will all be retried by default.
429 Rate Limit, and >=501 Internal errors will all be retried by default.

You can use the `maxRetries` option to configure or disable this:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "together-ai",
"version": "0.29.0",
"version": "0.30.0",
"description": "The official TypeScript library for the Together API",
"author": "Together <dev-feedback@TogetherAI.com>",
"types": "dist/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export interface ClientOptions {
* The maximum number of times that the client will retry a request in case of a
* temporary failure, like a network error or a 5XX error from the server.
*
* @default 5
* @default 2
*/
maxRetries?: number | undefined;

Expand Down Expand Up @@ -222,7 +222,7 @@ export class Together {
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
* @param {number} [opts.maxRetries=5] - The maximum number of times the client will retry a request.
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
*/
Expand Down Expand Up @@ -254,7 +254,7 @@ export class Together {
parseLogLevel(readEnv('TOGETHER_LOG'), "process.env['TOGETHER_LOG']", this) ??
defaultLogLevel;
this.fetchOptions = options.fetchOptions;
this.maxRetries = options.maxRetries ?? 5;
this.maxRetries = options.maxRetries ?? 2;
this.fetch = options.fetch ?? Shims.getDefaultFetch();
this.#encoder = Opts.FallbackEncoder;

Expand Down
2 changes: 1 addition & 1 deletion src/internal/request-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type RequestOptions = {
* The maximum number of times that the client will retry a request in case of a
* temporary failure, like a network error or a 5XX error from the server.
*
* @default 5
* @default 2
*/
maxRetries?: number;

Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.29.0'; // x-release-please-version
export const VERSION = '0.30.0'; // x-release-please-version
6 changes: 3 additions & 3 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ describe('instantiate client', () => {
});

test('maxRetries option is correctly set', () => {
const client = new Together({ maxRetries: 10, apiKey: 'My API Key' });
expect(client.maxRetries).toEqual(10);
const client = new Together({ maxRetries: 4, apiKey: 'My API Key' });
expect(client.maxRetries).toEqual(4);

// default
const client2 = new Together({ apiKey: 'My API Key' });
expect(client2.maxRetries).toEqual(5);
expect(client2.maxRetries).toEqual(2);
});

describe('withOptions', () => {
Expand Down