> For the complete documentation index, see [llms.txt](https://flampt.gitbook.io/prsaw2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flampt.gitbook.io/prsaw2/master.md).

# Quickstart

## Installation

The library can be installed using the python package manager `pip`

```bash
pip install prsaw2
```

## Examples

Firstly make sure to [have an API key from here](https://api.pgamerx.com/register)

Here are few examples to get you started.

## Getting an AI response

```python
import prsaw2

client = prsaw2.Client(key='api-key-here')

response = client.get_ai_response("Hi there")
client.close()  # Not necessary
print(response)
```

## Getting a random joke

```python
import prsaw2

client = prsaw2.Client(key='api-key-here')

response = client.get_joke(type="any")
client.close()  # Not necessary
print(response.joke)
```

## Getting a random image

```python
import prsaw2

client = prsaw2.Client(key='api-key-here')

response = client.get_image(type="any")
client.close()
print(response)
```

## Async support

The library also supports async usage.

```python
import prsaw2
import asyncio

client = prsaw2.AsyncClient(key="api-key-here")

async def coro():
  response = await client.get_ai_response("Hello world")
  await client.close()  
  print(response)

loop = asyncio.get_event_loop()
loop.run_until_complete(coro())
```
