> For the complete documentation index, see [llms.txt](https://docs.luojixiangliang.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luojixiangliang.com/quick-start.md).

# Quick Start

OpenAI训练了最先进的语言模型，这些模型在理解和生成文本方面非常出色。我们的API提供了访问这些模型的途径，并可用于解决几乎任何涉及处理语言的任务。

在这个快速入门教程中，您将构建一个简单的示例应用程序。在此过程中，您将学习到使用API解决任何任务所需的关键概念和技术，包括：

* 内容生成
* 摘要
* 分类、归类和情感分析
* 数据抽取
* 翻译
* 还有许多其他任务！

## 介绍

完成终点是我们API的核心，提供了一个非常灵活和强大的简单接口。您可以将一些文本作为提示输入，API将返回一个文本完成，试图匹配您给出的任何指令或上下文。

> 提示：为一个冰淇淋店写一个标语。

> 完成：我们每一勺都带来微笑！

您可以将此视为非常先进的自动完成功能——模型处理您的文本提示，尝试预测最有可能出现的下一个内容。

## 从第一条指示开始

想象一下，您想创建一个宠物名字生成器。从零开始想出名字是很难的！

首先，您需要一个明确表明您想要什么的提示。让我们从一条指示开始。提交此提示以生成您的第一个完成。

> 建议一个马的名字。

不错！现在，尝试让您的指示更具体一些。

> 为一匹黑马建议一个名字。

正如您所看到的，将一个简单的形容词添加到我们的提示中会改变生成的完成。设计您的提示实质上是如何“编程”模型。

## Make your first request

To make your first request, send an authenticated request to the pets endpoint. This will create a `pet`, which is nice.

## Create pet.

<mark style="color:green;">`POST`</mark> `https://api.myapi.com/v1/pet`

Creates a new pet.

#### Request Body

| Name                                   | Type   | Description                           |
| -------------------------------------- | ------ | ------------------------------------- |
| name<mark style="color:red;">\*</mark> | string | The name of the pet                   |
| owner\_id                              | string | The `id` of the user who owns the pet |
| species                                | string | The species of the pet                |
| breed                                  | string | The breed of the pet                  |

{% tabs %}
{% tab title="200 Pet successfully created" %}

```javascript
{
    "name"="Wilson",
    "owner": {
        "id": "sha7891bikojbkreuy",
        "name": "Samuel Passet",
    "species": "Dog",}
    "breed": "Golden Retriever",
}
```

{% endtab %}

{% tab title="401 Permission denied" %}

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Good to know:** You can use the API Method block to fully document an API method. You can also sync your API blocks with an OpenAPI file or URL to auto-populate them.
{% endhint %}

Take a look at how you might call this method using our official libraries, or via `curl`:

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

```
curl https://api.myapi.com/v1/pet  
    -u YOUR_API_KEY:  
    -d name='Wilson'  
    -d species='dog'  
    -d owner_id='sha7891bikojbkreuy'  
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the myapi module and set it up with your API key
const myapi = require('myapi')(YOUR_API_KEY);

const newPet = away myapi.pet.create({
    name: 'Wilson',
    owner_id: 'sha7891bikojbkreuy',
    species: 'Dog',
    breed: 'Golden Retriever',
})
```

{% endtab %}

{% tab title="Python" %}

```python
// Set your API key before making the request
myapi.api_key = YOUR_API_KEY

myapi.Pet.create(
    name='Wilson',
    owner_id='sha7891bikojbkreuy',
    species='Dog',
    breed='Golden Retriever',
)
```

{% endtab %}
{% endtabs %}
