Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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.37.0"
".": "0.38.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-dc45695614158674dec4da8ae843a7564905f24d2ce577e8e6e5246b4a7b0f61.yml
openapi_spec_hash: 46a91a84c8c270792676ee863b33ab99
config_hash: 67b76d1064bef2e591cadf50de08ad19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-da5b9df3bfe0d31a76c91444c9eba060ad607d7d5a4e7483c5cc3fe2cac0f25e.yml
openapi_spec_hash: 7efd2ae2111f3a9bf190485828a13252
config_hash: b66198d27b4d5c152688ff6cccfdeab5
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.38.0 (2026-02-21)

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

### Features

* Update descriptions for endpoints ([e7a8aaf](https://github.com/togethercomputer/together-typescript/commit/e7a8aafed811633b2a1c2c19df41fb43fd48ae89))


### Bug Fixes

* **client:** avoid removing abort listener too early ([1376258](https://github.com/togethercomputer/together-typescript/commit/137625849136205dc82f3b2493c96709365933ba))
* **internal:** skip tests that depend on mock server ([be7e0e7](https://github.com/togethercomputer/together-typescript/commit/be7e0e717e129fcdca13570d5967d61d8107240f))


### Chores

* configure new SDK language ([b6f30b6](https://github.com/togethercomputer/together-typescript/commit/b6f30b6587c51483d7aace93a19350d4acb22061))
* Fix various docstrings ([af4c47f](https://github.com/togethercomputer/together-typescript/commit/af4c47fab26f6ad7599866d2facd2075dfb7f7d7))
* **internal/client:** fix form-urlencoded requests ([d73f69f](https://github.com/togethercomputer/together-typescript/commit/d73f69fb0a280ad9d2c1f15da25d3695ff9c55c7))
* **internal:** avoid type checking errors with ts-reset ([70ad44b](https://github.com/togethercomputer/together-typescript/commit/70ad44b46220b19de3a0def616593e2382bda8dd))
* Remove broken field LineCount from FileResponse ([a0c187e](https://github.com/togethercomputer/together-typescript/commit/a0c187e9ae89232655f4e29e82ed08778fa70294))
* Revert adding mcp code. Code additions were unexpected. ([bb39360](https://github.com/togethercomputer/together-typescript/commit/bb39360b1f1815afa03cd59aec365c76f6fa6bf0))
* Update descriptions for jig queue methods and properties ([7fdfcca](https://github.com/togethercomputer/together-typescript/commit/7fdfcca72618b3ea51d38ac01f91e6a08ad0863e))
* update mock server docs ([ac14bf7](https://github.com/togethercomputer/together-typescript/commit/ac14bf741e8980c297b657f886d8ea0a88c15dcc))

## 0.37.0 (2026-02-04)

Full Changelog: [v0.36.1...v0.37.0](https://github.com/togethercomputer/together-typescript/compare/v0.36.1...v0.37.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ $ pnpm link -—global together-ai
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```sh
$ npx prism mock path/to/your/openapi.yml
$ ./scripts/mock
```

```sh
Expand Down
1 change: 0 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ Methods:
Types:

- <code><a href="./src/resources/files.ts">FileList</a></code>
- <code><a href="./src/resources/files.ts">FileObject</a></code>
- <code><a href="./src/resources/files.ts">FilePurpose</a></code>
- <code><a href="./src/resources/files.ts">FileResponse</a></code>
- <code><a href="./src/resources/files.ts">FileType</a></code>
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.37.0",
"version": "0.38.0",
"description": "The official TypeScript library for the Together API",
"author": "Together <dev-feedback@TogetherAI.com>",
"types": "dist/index.d.ts",
Expand Down
22 changes: 10 additions & 12 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,7 @@ import {
Evals,
EvaluationJob,
} from './resources/evals';
import {
FileDeleteResponse,
FileList,
FileObject,
FilePurpose,
FileResponse,
FileType,
Files,
} from './resources/files';
import { FileDeleteResponse, FileList, FilePurpose, FileResponse, FileType, Files } from './resources/files';
import {
FineTuning,
FineTuningCancelResponse,
Expand Down Expand Up @@ -532,7 +524,7 @@ export class Together {
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);

const errText = await response.text().catch((err: any) => castToError(err).message);
const errJSON = safeJSON(errText);
const errJSON = safeJSON(errText) as any;
const errMessage = errJSON ? undefined : errText;

loggerFor(this).debug(
Expand Down Expand Up @@ -599,7 +591,6 @@ export class Together {
return await this.fetch.call(undefined, url, fetchOptions);
} finally {
clearTimeout(timeout);
if (signal) signal.removeEventListener('abort', abort);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abort listeners accumulate across completed requests

Medium Severity

fetchWithTimeout no longer removes the abort listener from the caller-provided signal after fetch completes. Reusing one AbortSignal for many requests now retains one closure per request, causing unbounded listener growth and extra abort callbacks long after requests have finished.

Fix in Cursor Fix in Web

}
}

Expand Down Expand Up @@ -783,6 +774,14 @@ export class Together {
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
) {
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
} else if (
typeof body === 'object' &&
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
) {
return {
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
body: this.stringifyQuery(body as Record<string, unknown>),
};
} else {
return this.#encoder({ body, headers });
}
Expand Down Expand Up @@ -868,7 +867,6 @@ export declare namespace Together {
export {
Files as Files,
type FileList as FileList,
type FileObject as FileObject,
type FilePurpose as FilePurpose,
type FileResponse as FileResponse,
type FileType as FileType,
Expand Down
4 changes: 2 additions & 2 deletions src/core/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
let data;

try {
data = JSON.parse(sse.data);
data = JSON.parse(sse.data) as any;
} catch (e) {
logger.error(`Could not parse message into JSON:`, sse.data);
logger.error(`From chunk:`, sse.raw);
Expand Down Expand Up @@ -121,7 +121,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
try {
for await (const line of iterLines()) {
if (done) continue;
if (line) yield JSON.parse(line);
if (line) yield JSON.parse(line) as Item;
}
done = true;
} catch (e) {
Expand Down
3 changes: 3 additions & 0 deletions src/resources/audio/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export interface AudioSpeechStreamChunk {

model: string;

/**
* The object type, which is always `audio.tts.chunk`.
*/
object: 'audio.tts.chunk';
}

Expand Down
9 changes: 9 additions & 0 deletions src/resources/audio/voices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,24 @@ export namespace VoiceListResponse {
* Represents a model with its available voices.
*/
export interface Data {
/**
* Model name.
*/
model: string;

/**
* List of available voices for the model.
*/
voices: Array<Data.Voice>;
}

export namespace Data {
export interface Voice {
id: string;

/**
* Voice name to be used for audio inference.
*/
name: string;
}
}
Expand Down
51 changes: 44 additions & 7 deletions src/resources/beta/clusters/clusters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export interface Cluster {

cluster_name: string;

/**
* Type of cluster.
*/
cluster_type: 'KUBERNETES' | 'SLURM';

control_plane_nodes: Array<Cluster.ControlPlaneNode>;
Expand Down Expand Up @@ -166,17 +169,29 @@ export interface ClusterListRegionsResponse {

export namespace ClusterListRegionsResponse {
export interface Region {
id: string;

availability_zones: Array<string>;

/**
* List of supported identifiable driver versions available in the region.
*/
driver_versions: Array<string>;

/**
* Identifiable name of the region.
*/
name: string;

/**
* List of supported identifiable gpus available in the region.
*/
supported_instance_types?: Array<string>;
}
}

export interface ClusterCreateParams {
/**
* RESERVED billing types allow you to specify the duration of the cluster
* reservation via the duration_days field. ON_DEMAND billing types will give you
* ownership of the cluster until you delete it.
*/
billing_type: 'RESERVED' | 'ON_DEMAND';

/**
Expand All @@ -201,24 +216,36 @@ export interface ClusterCreateParams {
num_gpus: number;

/**
* Region to create the GPU cluster in. Valid values are us-central-8 and
* us-central-4.
* Region to create the GPU cluster in. Usable regions can be found from
* `client.clusters.list_regions()`
*/
region: 'us-central-8' | 'us-central-4';
region: string;

/**
* Type of cluster to create.
*/
cluster_type?: 'KUBERNETES' | 'SLURM';

/**
* Duration in days to keep the cluster running.
*/
duration_days?: number;

/**
* Inline configuration to create a shared volume with the cluster creation.
*/
shared_volume?: ClusterCreateParams.SharedVolume;

/**
* ID of an existing volume to use with the cluster creation.
*/
volume_id?: string;
}

export namespace ClusterCreateParams {
/**
* Inline configuration to create a shared volume with the cluster creation.
*/
export interface SharedVolume {
/**
* Region name. Usable regions can be found from `client.clusters.list_regions()`
Expand All @@ -230,13 +257,23 @@ export namespace ClusterCreateParams {
*/
size_tib: number;

/**
* Customizable name of the volume to create.
*/
volume_name: string;
}
}

export interface ClusterUpdateParams {
/**
* Type of cluster to update.
*/
cluster_type?: 'KUBERNETES' | 'SLURM';

/**
* Number of GPUs to allocate in the cluster. This must be multiple of 8. For
* example, 8, 16 or 24
*/
num_gpus?: number;
}

Expand Down
21 changes: 21 additions & 0 deletions src/resources/beta/clusters/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,24 @@ export class Storage extends APIResource {
}

export interface ClusterStorage {
/**
* Size of the volume in whole tebibytes (TiB).
*/
size_tib: number;

/**
* Deployment status of the volume.
*/
status: 'available' | 'bound' | 'provisioning';

/**
* ID of the volume.
*/
volume_id: string;

/**
* Provided name of the volume.
*/
volume_name: string;
}

Expand All @@ -76,12 +88,21 @@ export interface StorageCreateParams {
*/
size_tib: number;

/**
* Customizable name of the volume to create.
*/
volume_name: string;
}

export interface StorageUpdateParams {
/**
* Size of the volume in whole tebibytes (TiB).
*/
size_tib?: number;

/**
* ID of the volume to update.
*/
volume_id?: string;
}

Expand Down
8 changes: 4 additions & 4 deletions src/resources/beta/jig/jig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ export interface Deployment {
name?: string;

/**
* Object is the type identifier for this response (always "deployment")
* The object type, which is always `deployment`.
*/
object?: string;
object?: 'deployment';

/**
* Port is the container port that the deployment exposes
Expand Down Expand Up @@ -319,9 +319,9 @@ export interface JigListResponse {
data?: Array<Deployment>;

/**
* Object is the type identifier for this response (always "list")
* The object type, which is always `list`.
*/
object?: string;
object?: 'list';
}

export type JigDestroyResponse = unknown;
Expand Down
Loading