> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.oai.together.TogetherClient

<h2 id="autogen.oai.together.TogetherClient" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">TogetherClient</span>
</h2>

```python theme={null}
TogetherClient(**kwargs)
```

Client for Together.AI's API.<br />Requires api\_key or environment variable to be set

<b>Parameters:</b>

| Name       | Description |
| ---------- | ----------- |
| `**kwargs` |             |

### Static Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### get\_usage

```python theme={null}
get_usage(response) -> dict
```

Return usage summary of the response using RESPONSE\_USAGE\_KEYS.

<b>Parameters:</b>

| Name       | Description |
| ---------- | ----------- |
| `response` |             |

<br />

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### cost

```python theme={null}
cost(self, response) -> float
```

<b>Parameters:</b>

| Name       | Description |
| ---------- | ----------- |
| `response` |             |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### create

```python theme={null}
create(self, params: dict) -> ChatCompletionExtended
```

<b>Parameters:</b>

| Name     | Description    |
| -------- | -------------- |
| `params` | **Type:** dict |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### message\_retrieval

```python theme={null}
message_retrieval(self, response) -> list
```

Retrieve and return a list of strings or a list of Choice.Message from the response.<br />NOTE: if a list of Choice.Message is returned, it currently needs to contain the fields of OpenAI's ChatCompletion Message object,
since that is expected for function or tool calling in the rest of the codebase at the moment, unless a custom agent is being used.

<b>Parameters:</b>

| Name       | Description |
| ---------- | ----------- |
| `response` |             |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### parse\_params

```python theme={null}
parse_params(self, params: dict[str, Any]) -> dict[str, Any]
```

Loads the parameters for Together.AI API from the passed in parameters and returns a validated set. Checks types, ranges, and sets defaults

<b>Parameters:</b>

| Name     | Description               |
| -------- | ------------------------- |
| `params` | **Type:** dict\[str, Any] |

<br />
