# API Reference

Parasail offers a direct drop-in replacement for OpenAI's batch API. The same documentation, guides, and cookbooks apply.

You can use OpenAI's or community-built client libraries for your preferred language.

The only workflow changes are:

* Use the Parasail URL: `https://api.saas.parasail.io`
* Use your Parasail API key. Create one [here](https://www.saas.parasail.io/keys).
* Use an open model that Parasail supports instead of ChatGPT.

## OpenAI API reference

[OpenAI Batch API reference](https://platform.openai.com/docs/api-reference/batch)

[OpenAI Files API reference](https://platform.openai.com/docs/api-reference/files)

## Client Setup

{% tabs %}
{% tab title="Python" %}

```python
# pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://api.saas.parasail.io/v1",
    api_key="$PARASAIL_API_KEY",
)
```

{% endtab %}
{% endtabs %}

### Chat Completions vs Text Completions

As long as vLLM keeps support for both, Parasail has support for both endpoints.

`/completions` endpoint provides the completion for a **single** **prompt** and takes a single string as an input, whereas the `/chat/completions` provides the responses for a given **dialog** and requires the input in a specific format corresponding to the message history.

```
/v1/completions is for single prompt. you can use this endpoints if your app provides those services

-translation
-text or code generation
-revise a message
-write an email

On the other hand you use /v1/chat/completions if your app provides those services

-chatgpt style chatbots
-virtual assistant for customer service
-interactive surveys and forms
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parasail.io/parasail-docs/batch/api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
