# Welcome

Welcome to the ZeroCodeAi Docs! ZeroCodeAi makes it easy to run models with only a few lines of code. We offer a variety of generative AI services to help you build your products.

* **Ai models** - Use the API to run various models out of the box. **You only pay per token.**

### OpenAI compatibility

ZeroCodeAi's Api is compatible with OpenAI's client libraries, making it easy to try out our models on existing applications.

### Authentication

Bearer Token Authentication is required for all endpoints. Get your token at [**https://zerocodeai.app/dashboard**](https://zerocodeai.app/dashboard), If you don't have an account, you can register for free. New accounts come with free credits to get started.&#x20;

### Configuring OpenAI to use ZeroCodeAi API

To start using ZeroCodeAi with OpenAI's client libraries, pass in your ZeroCodeAi API key to the `api_key` option, and change the base url to `https://api.zerocodeai.app/v1`<br>

**Install the OpenAI SDK**

{% tabs %}
{% tab title="JavaScript / Typescript" %}

```javascript
npm install openai
```

{% endtab %}

{% tab title="Python" %}

```python
pip install openai
```

{% endtab %}
{% endtabs %}

**Make your first API request**

{% tabs %}
{% tab title="JavaScript / Typescript" %}

```javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ZEROCODEAI_API_KEY,
  baseURL: "https://api.zerocodeai.app/v1",
});

const completion = await client.chat.completions.create({
    model: "openai/gpt-4o-mini",
    messages: [
        { role: "system", content: "You are a helpful assistant." },
        {
            role: "user",
            content: "Tell me a joke",
        },
    ],
});

console.log(completion.choices[0].message);
```

{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import os
import openai

client = openai.OpenAI(
  api_key=os.environ.get("ZEROCODEAI_API_KEY"),
  base_url="https://api.zerocodeai.app/v1",
)

completion = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {
            "role": "user",
            "content": "Tell me a joke"
        }
    ]
)

print(completion.choices[0].message)
```

{% endcode %}
{% endtab %}

{% tab title="Curl" %}

```sh
curl "https://api.zerocodeai.app/v1/chat/completions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ZEROCODEAI_API_KEY" \
    -d '{
        "model": "openai/gpt-4o-mini",
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant."
            },
            {
                "role": "user",
                "content": "Tell me a joke"
            }
        ]
    }'
```

{% endtab %}
{% endtabs %}


---

# 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.zerocodeai.app/readme.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.
