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

# Responses

# Responses

Response types returned by the Gateway methods.

## CompleteChatHandlerResponseType

Returned by `gateway.completeChat()`.

```typescript theme={null}
{
  response: MessageType,   // The assistant's response message
  usage: {
    promptTokens: number,
    completionTokens: number,
    totalTokens: number,
  },
  toolCalls?: ToolCallType[],  // If the model requested tool calls
}
```

### Fields

**response** `MessageType` *required*

The assistant's response message. See [Message Types](https://www.adaline.ai/docs/reference/gateway/v2/types/messages.md).

**usage** `object` *required*

Token usage statistics.

**Properties**

**promptTokens** `number`

Input tokens used.

**completionTokens** `number`

Output tokens generated.

**totalTokens** `number`

Total tokens (input + output).

**toolCalls** `ToolCallType[]`

Tool calls requested by the model. Pass these to `gateway.getToolResponses()` to execute them.

## StreamChatHandlerResponseType

Yielded by the async generator from `gateway.streamChat()`.

```typescript theme={null}
{
  response: string,    // The text chunk
  usage?: {            // Only present in the final chunk
    promptTokens: number,
    completionTokens: number,
    totalTokens: number,
  },
  toolCalls?: ToolCallType[],  // Only present in the final chunk
}
```

## GetEmbeddingsHandlerResponseType

Returned by `gateway.getEmbeddings()`.

```typescript theme={null}
{
  embeddings: number[][],  // Array of embedding vectors
  usage: {
    promptTokens: number,
    totalTokens: number,
  },
}
```

## GatewayError

The error class thrown by all Gateway methods.

```typescript theme={null}
import { GatewayError } from "@adaline/gateway";

try {
  const response = await gateway.completeChat({ ... });
} catch (error) {
  if (error instanceof GatewayError) {
    console.error(error.message);
    console.error(error.cause);   // Original provider error
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.