# SDKs

Learn how to use Retell’s Node.js and Python SDKs

While you can use our [REST API](https://docs.retellai.com/api-references/create-phone-call) for most operations, we recommend using our SDKs to speed up development and reduce code complexity. Our SDKs provide typed methods and a more structured approach to integrating with Retell.

[**​**](https://docs.retellai.com/get-started/sdk#available-sdks-and-requirements)**Available SDKs & Requirements**

* **Node.js TypeScript SDK**
  * [NPM Package](https://www.npmjs.com/package/retell-sdk)
  * Requires Node.js version 18.10.0 or higher
* **Python SDK**
  * [PyPI Package](https://pypi.org/project/retell-sdk/)
  * Requires Python 3.x

1

Get Your API Key

Navigate to the “API Keys” tab in your dashboard to obtain your API key.

<figure><img src="https://project-44.gitbook.io/~gitbook/image?url=https%3A%2F%2Fmintlify.s3.us-west-1.amazonaws.com%2Fretellai%2Fimages%2Fapi_key.png&#x26;width=300&#x26;dpr=4&#x26;quality=100&#x26;sign=39021d3&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2

Install the SDK

Choose your preferred language and install the SDK:

Node ClientPython Client

Copy

```
npm i retell-sdk
```

3

Initialize the Client

Create a new client instance using your API key:

Node ClientPython Client

Copy

```python
import Retell from 'retell-sdk';

const retellClient = new Retell({
  apiKey: "YOUR_API_KEY",
});
```

4

Make API Calls

Here’s an example of making a phone call using the SDK:

Node ClientPython Client

Copy

```python
try {
  const response = await retellClient.call.createPhoneCall({
    from_number: '+14157774444',
    to_number: '+12137774445',
  });
  console.log('Call initiated:', response);
} catch (error) {
  console.error('Error making call:', error);
}
```

[**​**](https://docs.retellai.com/get-started/sdk#sdk-vs-rest-api-example)**SDK vs REST API Example**

To illustrate the benefits of using our SDK, here’s a comparison of creating an agent using both methods:

[**​**](https://docs.retellai.com/get-started/sdk#using-rest-api-more-verbose)**Using REST API (More Verbose)**

Copy

```python
const options = {
  method: 'POST',
  headers: {
    Authorization: '<authorization>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    response_engine: {
      type: 'retell-llm',
      llm_id: 'llm_234sdertfsdsfsdf'
    },
    agent_name: 'Jarvis',
    voice_id: '11labs-Adrian',
    // ... many more configuration options
  })
};

fetch('https://api.retellai.com/create-agent', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

[**​**](https://docs.retellai.com/get-started/sdk#using-sdk-more-concise)**Using SDK (More Concise)**

Copy

```python
import Retell from 'retell-sdk';

const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
});

async function main() {
  const params: Retell.AgentCreateParams = {
    response_engine: { 
      llm_id: 'llm_234sdertfsdsfsdf',
      type: 'retell-llm'
    },
    voice_id: '11labs-Adrian',
  };
  const agentResponse = await client.agent.create(params);
}
```

[**​**](https://docs.retellai.com/get-started/sdk#best-practices)**Best Practices**

1. **Error Handling**: Always wrap SDK calls in try-catch blocks
2. **Type Safety**: Take advantage of TypeScript types in the Node.js SDK
3. **API Reference**: Refer to our [API documentation](https://docs.retellai.com/api-references/create-phone-call) for all available parameters

[**​**](https://docs.retellai.com/get-started/sdk#additional-resources)**Additional Resources**

Find more SDK examples in our test suites to learn more about how to use the SDK:

* [Node.js SDK Examples](https://github.com/RetellAI/retell-typescript-sdk/tree/main/tests/api-resources)
* [Python SDK Examples](https://github.com/RetellAI/retell-python-sdk/tree/main/tests/api_resources)
