> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agicto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Send your first OpenAI-compatible request with AGICTO API

This guide helps you send your first AGICTO API request in the OpenAI-compatible format. You will set the API Key, use the correct Base URL, and verify a Chat completions response.

## Prerequisites

* You have an AGICTO API Key
* Your account has available balance or quota
* Your environment can reach AGICTO API

## 1. Set your API Key

Send your API Key in the `Authorization` header.

```http theme={null}
Authorization: Bearer $API_KEY
```

<Tip>
  Do not expose your API Key in client-side code, public repositories, or logs.
</Tip>

## 2. Use the Base URL

The AGICTO API Base URL is:

```text theme={null}
https://api.agicto.cn/v1/
```

Copy the Base URL shown in the console. Example requests use the full URL.

This page uses Chat completions. The full request URL is:

```text theme={null}
https://api.agicto.cn/v1/chat/completions
```

## 3. Send a Chat request

Replace `$API_KEY` with your API Key. Replace `model` with a model available to your account.

```bash theme={null}
curl https://api.agicto.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "Say hello in one sentence."
      }
    ]
  }'
```

## 4. Use the OpenAI SDK

<CodeGroup>
  ```js Node.js theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.AGICTO_API_KEY,
    baseURL: "https://api.agicto.cn/v1/"
  });

  const completion = await client.chat.completions.create({
    model: "gpt-4o",
    messages: [{ role: "user", content: "Say hello in one sentence." }]
  });

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

  ```python Python theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["AGICTO_API_KEY"],
      base_url="https://api.agicto.cn/v1/",
  )

  completion = client.chat.completions.create(
      model="gpt-4o",
      messages=[{"role": "user", "content": "Say hello in one sentence."}],
  )

  print(completion.choices[0].message.content)
  ```
</CodeGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="OpenAI compatibility" icon="code" href="/en/openai-compatible">
    Learn how to migrate existing OpenAI SDK code.
  </Card>

  <Card title="API reference" icon="book-open" href="/api-reference/introduction">
    Browse endpoint details synced from Apifox.
  </Card>
</CardGroup>
