- 起步
- 介绍
- 导言
- 身份验证
- 发出请求
- 参数详情
- 音频(Audio)
- 聊天(Chat)
- 自动补全(Completions)
- 嵌入(Embeddings)
- 微调(Fine-tuning)
- 图像(Images)
- 模型(Models)
- 文件(Files)
- 审查(Moderations)
- 助手测试版(AssistantsBeta)
- 线程数(Threads)
- 留言(Messages)
- 运行(Runs)
- 已弃用-音频(Audio)
- English
- Authentication
- Making requests
- Streaming
- Debugging requests
- Backward compatibility
- Administration
- Introduction
- Batch
- Models
- Invites
- Chat
- Users
- Projects
- Project users
- Project service accounts
- Project API keys
- Audit logs
- Usage
- Project rate limits
- Completions
- Uploads
- Images
- Embeddings
- Audio
- Files
- Fine-tuning
- Moderations
- Assistants (v1)
- Threads (v1)
- Messages (v1)
- Runs (v1)
Create assistant (v1)
POST
https://api.openai.com/v1/assistants
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Header Params
Content-Type
string
required
Example:
application/json
Authorization
string
required
Example:
Bearer $OPENAI_API_KEY
OpenAI-Beta
string
required
Example:
assistants=v1
Body Params application/json
instructions
string
required
name
string
required
tools
array [object {1}]
required
code_interpreter
, retrieval
, or function
.type
string
optional
model
string
required
Example
{
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"name": "Math Tutor",
"tools": [
{
"type": "code_interpreter"
}
],
"model": "gpt-4-turbo"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/assistants' \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'OpenAI-Beta: assistants=v1' \
--header 'Content-Type: application/json' \
--data-raw '{
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"name": "Math Tutor",
"tools": [{"type": "code_interpreter"}],
"model": "gpt-4-turbo"
}'
Responses
🟢200Success
application/json
Body
id
string
required
object
string
required
created_at
integer
required
name
string
required
description
null
required
model
string
required
instructions
string
required
tools
array [object {1}]
required
type
string
optional
file_ids
array[string]
required
metadata
object
required
top_p
integer
required
temperature
integer
required
response_format
string
required
Example
{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1698984975,
"name": "Math Tutor",
"description": null,
"model": "gpt-4-turbo",
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"tools": [
{
"type": "code_interpreter"
}
],
"file_ids": [],
"metadata": {},
"top_p": 1,
"temperature": 1,
"response_format": "auto"
}
Modified at 2024-12-13 10:20:37