vapi-server-sdk


Namevapi-server-sdk JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2025-01-21 23:33:56
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Vapi Python Library

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FVapiAI%2Fserver-sdk-python)
[![pypi](https://img.shields.io/pypi/v/vapi_server_sdk)](https://pypi.python.org/pypi/vapi_server_sdk)

The Vapi Python library provides convenient access to the Vapi API from Python.

## Installation

```sh
pip install vapi_server_sdk
```

## Reference

A full reference for this library is available [here](./reference.md).

## Usage

Instantiate and use the client with the following:

```python
from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.calls.create()
```

## Async Client

The SDK also exports an `async` client so that you can make non-blocking calls to our API.

```python
import asyncio

from vapi import AsyncVapi

client = AsyncVapi(
    token="YOUR_TOKEN",
)


async def main() -> None:
    await client.calls.create()


asyncio.run(main())
```

## Exception Handling

When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
will be thrown.

```python
from vapi.core.api_error import ApiError

try:
    client.calls.create(...)
except ApiError as e:
    print(e.status_code)
    print(e.body)
```

## Pagination

Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.

```python
from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
response = client.logs.get()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page
```

## Advanced

### Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
retry limit (default: 2).

A request is deemed retriable when any of the following HTTP status codes is returned:

- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)

Use the `max_retries` request option to configure this behavior.

```python
client.calls.create(..., request_options={
    "max_retries": 1
})
```

### Timeouts

The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.

```python

from vapi import Vapi

client = Vapi(
    ...,
    timeout=20.0,
)


# Override timeout for a specific method
client.calls.create(..., request_options={
    "timeout_in_seconds": 1
})
```

### Custom Client

You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
and transports.
```python
import httpx
from vapi import Vapi

client = Vapi(
    ...,
    httpx_client=httpx.Client(
        proxies="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)
```

## Contributing

While we value open-source contributions to this SDK, this library is generated programmatically.
Additions made directly to this library would have to be moved over to our generation code,
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "vapi-server-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7c/ba/a846081f7f1260af76b67d7a670f194d36940dbe8bc1e38e88c3b528725d/vapi_server_sdk-0.4.0.tar.gz",
    "platform": null,
    "description": "# Vapi Python Library\n\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FVapiAI%2Fserver-sdk-python)\n[![pypi](https://img.shields.io/pypi/v/vapi_server_sdk)](https://pypi.python.org/pypi/vapi_server_sdk)\n\nThe Vapi Python library provides convenient access to the Vapi API from Python.\n\n## Installation\n\n```sh\npip install vapi_server_sdk\n```\n\n## Reference\n\nA full reference for this library is available [here](./reference.md).\n\n## Usage\n\nInstantiate and use the client with the following:\n\n```python\nfrom vapi import Vapi\n\nclient = Vapi(\n    token=\"YOUR_TOKEN\",\n)\nclient.calls.create()\n```\n\n## Async Client\n\nThe SDK also exports an `async` client so that you can make non-blocking calls to our API.\n\n```python\nimport asyncio\n\nfrom vapi import AsyncVapi\n\nclient = AsyncVapi(\n    token=\"YOUR_TOKEN\",\n)\n\n\nasync def main() -> None:\n    await client.calls.create()\n\n\nasyncio.run(main())\n```\n\n## Exception Handling\n\nWhen the API returns a non-success status code (4xx or 5xx response), a subclass of the following error\nwill be thrown.\n\n```python\nfrom vapi.core.api_error import ApiError\n\ntry:\n    client.calls.create(...)\nexcept ApiError as e:\n    print(e.status_code)\n    print(e.body)\n```\n\n## Pagination\n\nPaginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.\n\n```python\nfrom vapi import Vapi\n\nclient = Vapi(\n    token=\"YOUR_TOKEN\",\n)\nresponse = client.logs.get()\nfor item in response:\n    yield item\n# alternatively, you can paginate page-by-page\nfor page in response.iter_pages():\n    yield page\n```\n\n## Advanced\n\n### Retries\n\nThe SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long\nas the request is deemed retriable and the number of retry attempts has not grown larger than the configured\nretry limit (default: 2).\n\nA request is deemed retriable when any of the following HTTP status codes is returned:\n\n- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)\n\nUse the `max_retries` request option to configure this behavior.\n\n```python\nclient.calls.create(..., request_options={\n    \"max_retries\": 1\n})\n```\n\n### Timeouts\n\nThe SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.\n\n```python\n\nfrom vapi import Vapi\n\nclient = Vapi(\n    ...,\n    timeout=20.0,\n)\n\n\n# Override timeout for a specific method\nclient.calls.create(..., request_options={\n    \"timeout_in_seconds\": 1\n})\n```\n\n### Custom Client\n\nYou can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies\nand transports.\n```python\nimport httpx\nfrom vapi import Vapi\n\nclient = Vapi(\n    ...,\n    httpx_client=httpx.Client(\n        proxies=\"http://my.test.proxy.example.com\",\n        transport=httpx.HTTPTransport(local_address=\"0.0.0.0\"),\n    ),\n)\n```\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nAdditions made directly to this library would have to be moved over to our generation code,\notherwise they would be overwritten upon the next generated release. Feel free to open a PR as\na proof of concept, but know that we will not be able to merge it as-is. We suggest opening\nan issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "afd74fde4e92641c70de8759445b4922f58719c87f285922786a03ae45ee9fab",
                "md5": "b1d49766cbe5fc3df81e2d30b53c0cbb",
                "sha256": "ad288f380ac76097b96192e759f568b77534a52ba12c274ca7b10ad51c2572fb"
            },
            "downloads": -1,
            "filename": "vapi_server_sdk-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1d49766cbe5fc3df81e2d30b53c0cbb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 624736,
            "upload_time": "2025-01-21T23:33:54",
            "upload_time_iso_8601": "2025-01-21T23:33:54.935522Z",
            "url": "https://files.pythonhosted.org/packages/af/d7/4fde4e92641c70de8759445b4922f58719c87f285922786a03ae45ee9fab/vapi_server_sdk-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7cbaa846081f7f1260af76b67d7a670f194d36940dbe8bc1e38e88c3b528725d",
                "md5": "bdcaf83e52eace0c86fc93f767818146",
                "sha256": "224f243b9d0d105ea2c54d60c2d347274d8dac1ca1b095b030adeb44b9efb352"
            },
            "downloads": -1,
            "filename": "vapi_server_sdk-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bdcaf83e52eace0c86fc93f767818146",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 221776,
            "upload_time": "2025-01-21T23:33:56",
            "upload_time_iso_8601": "2025-01-21T23:33:56.322109Z",
            "url": "https://files.pythonhosted.org/packages/7c/ba/a846081f7f1260af76b67d7a670f194d36940dbe8bc1e38e88c3b528725d/vapi_server_sdk-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-21 23:33:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "vapi-server-sdk"
}
        
Elapsed time: 0.83827s