Ana içeriğe atla

Bu tarayıcı artık desteklenmiyor.

En son özelliklerden, güvenlik güncelleştirmelerinden ve teknik destekten faydalanmak için Microsoft Edge’e yükseltin.

Microsoft Edge'i indirin Internet Explorer ve Microsoft Edge hakkında daha fazla bilgi
microsoft-foundry.rest.security.o-auth2-auth

Assistants

Create an assistant

POST /openai/v1/assistants Kullanım Dışı

Creates an assistant from the supplied request.

İstek Gövdesi

The request body.

Content-Type: application/json
model string | enum gerekli Kullanım Dışı

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.

Aşağıdakilerden biri:
string Kullanım Dışı
enum Kullanım Dışı
gpt-5gpt-5-minigpt-5-nanogpt-5-2025-08-07gpt-5-mini-2025-08-07gpt-5-nano-2025-08-07gpt-4.1gpt-4.1-minigpt-4.1-nanogpt-4.1-2025-04-14gpt-4.1-mini-2025-04-14gpt-4.1-nano-2025-04-14o3-minio3-mini-2025-01-31o1o1-2024-12-17gpt-4ogpt-4o-2024-11-20gpt-4o-2024-08-06gpt-4o-2024-05-13gpt-4o-minigpt-4o-mini-2024-07-18gpt-4.5-previewgpt-4.5-preview-2025-02-27gpt-4-turbogpt-4-turbo-2024-04-09gpt-4-0125-previewgpt-4-turbo-previewgpt-4-1106-previewgpt-4-vision-previewgpt-4gpt-4-0314gpt-4-0613gpt-4-32kgpt-4-32k-0314gpt-4-32k-0613gpt-3.5-turbogpt-3.5-turbo-16kgpt-3.5-turbo-0613gpt-3.5-turbo-1106gpt-3.5-turbo-0125gpt-3.5-turbo-16k-0613
name string | null Kullanım Dışı
description string | null Kullanım Dışı
instructions string | null Kullanım Dışı
reasoning_effort string | enum | null Kullanım Dışı

Constrains effort on reasoning for reasoning models. Currently supported values are none, minimal, low, medium, high, xhigh, and max. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. Not all reasoning models support every value. See the reasoning guide for model-specific support.

Aşağıdakilerden biri:
string Kullanım Dışı
enum Kullanım Dışı
noneminimallowmediumhighxhighmax
tools OpenAI.AssistantTool[] Kullanım Dışı

A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types code_interpreter, file_search, or function.

tool_resources OpenAI.CreateAssistantRequestToolResources | null Kullanım Dışı
code_interpreter OpenAI.CreateAssistantRequestToolResourcesCodeInterpreter Kullanım Dışı
file_ids string[] Kullanım Dışı
file_search OpenAI.CreateAssistantRequestToolResourcesFileSearch Kullanım Dışı
vector_store_ids string[] Kullanım Dışı
vector_stores OpenAI.CreateAssistantRequestToolResourcesFileSearchVectorStores[] Kullanım Dışı
metadata OpenAI.Metadata | null Kullanım Dışı

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

[key: string] string Kullanım Dışı
temperature number | null Kullanım Dışı
top_p number | null Kullanım Dışı
response_format enum | OpenAI.ResponseFormatText | OpenAI.ResponseFormatJsonObject | OpenAI.ResponseFormatJsonSchema | null Kullanım Dışı

Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106. Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide. Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON. Important:* when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

Aşağıdakilerden biri:
enum Kullanım Dışı
auto
type enum gerekli Kullanım Dışı

The type of response format being defined. Always text.

text
type enum gerekli Kullanım Dışı

The type of response format being defined. Always json_object.

json_object
type enum gerekli Kullanım Dışı

The type of response format being defined. Always json_schema.

json_schema
json_schema OpenAI.ResponseFormatJsonSchemaJsonSchema gerekli Kullanım Dışı
description string Kullanım Dışı
name string gerekli Kullanım Dışı
schema OpenAI.ResponseFormatJsonSchemaSchema Kullanım Dışı

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

strict boolean | null Kullanım Dışı

Yanıtlar

The request has succeeded.

Gövde

Content-Type: application/json
id string gerekli Kullanım Dışı

The identifier, which can be referenced in API endpoints.

object enum gerekli Kullanım Dışı

The object type, which is always assistant.

assistant
created_at integer gerekli Kullanım Dışı

The Unix timestamp (in seconds) for when the assistant was created.

name string | null gerekli Kullanım Dışı
description string | null gerekli Kullanım Dışı
model string gerekli Kullanım Dışı

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.

instructions string | null gerekli Kullanım Dışı
tools OpenAI.AssistantTool[] gerekli Kullanım Dışı

A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types code_interpreter, file_search, or function.

tool_resources OpenAI.AssistantObjectToolResources | null Kullanım Dışı
code_interpreter OpenAI.AssistantObjectToolResourcesCodeInterpreter Kullanım Dışı
file_ids string[] Kullanım Dışı
file_search OpenAI.AssistantObjectToolResourcesFileSearch Kullanım Dışı
vector_store_ids string[] Kullanım Dışı
metadata OpenAI.Metadata | null gerekli Kullanım Dışı

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

[key: string] string Kullanım Dışı
temperature number | null Kullanım Dışı
top_p number | null Kullanım Dışı
response_format enum | OpenAI.ResponseFormatText | OpenAI.ResponseFormatJsonObject | OpenAI.ResponseFormatJsonSchema | null Kullanım Dışı

Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106. Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide. Setting to { "type": "json_object" } enables JSON mode, which ensures the message the model generates is valid JSON. Important:* when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

Aşağıdakilerden biri:
enum Kullanım Dışı
auto
type enum gerekli Kullanım Dışı

The type of response format being defined. Always text.

text
type enum gerekli Kullanım Dışı

The type of response format being defined. Always json_object.

json_object
type enum gerekli Kullanım Dışı

The type of response format being defined. Always json_schema.

json_schema
json_schema OpenAI.ResponseFormatJsonSchemaJsonSchema gerekli Kullanım Dışı
description string Kullanım Dışı
name string gerekli Kullanım Dışı
schema OpenAI.ResponseFormatJsonSchemaSchema Kullanım Dışı

The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.

strict boolean | null Kullanım Dışı

Client error

Gövde

Content-Type: application/json
error OpenAI.Error gerekli Kullanım Dışı
code string | null gerekli Kullanım Dışı
message string gerekli Kullanım Dışı
param string | null Kullanım Dışı
type string Kullanım Dışı
misalignment OpenAI.MisalignmentErrorDetailsResource Kullanım Dışı
review_target string | null Kullanım Dışı
error_type string | enum Kullanım Dışı
Aşağıdakilerden biri:
string Kullanım Dışı
enum Kullanım Dışı
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string Kullanım Dışı

The public explanation for this block.

steer OpenAI._MisalignmentSteer Kullanım Dışı
message string gerekli Kullanım Dışı

The public continuation instruction.

details OpenAI.Error[] Kullanım Dışı
additionalInfo object Kullanım Dışı
debugInfo object Kullanım Dışı

Server error

Gövde

Content-Type: application/json
error OpenAI.Error gerekli Kullanım Dışı
code string | null gerekli Kullanım Dışı
message string gerekli Kullanım Dışı
param string | null Kullanım Dışı
type string Kullanım Dışı
misalignment OpenAI.MisalignmentErrorDetailsResource Kullanım Dışı
review_target string | null Kullanım Dışı
error_type string | enum Kullanım Dışı
Aşağıdakilerden biri:
string Kullanım Dışı
enum Kullanım Dışı
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string Kullanım Dışı

The public explanation for this block.

steer OpenAI._MisalignmentSteer Kullanım Dışı
message string gerekli Kullanım Dışı

The public continuation instruction.

details OpenAI.Error[] Kullanım Dışı
additionalInfo object Kullanım Dışı
debugInfo object Kullanım Dışı

İstek

curl "https://api.openai.com/v1/assistants" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "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-4o"
  }'
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
assistant = client.beta.assistants.create(
    model="gpt-4o",
)
print(assistant.id)
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistant = await openai.beta.assistants.create({
    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-4o",
  });

  console.log(myAssistant);
}

main();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const assistant = await client.beta.assistants.create({ model: 'gpt-4o' });

console.log(assistant.id);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
    "github.com/openai/openai-go/shared"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    assistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
        Model: shared.ChatModelGPT4o,
    })
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", assistant.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.ChatModel;
import com.openai.models.beta.assistants.Assistant;
import com.openai.models.beta.assistants.AssistantCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        AssistantCreateParams params = AssistantCreateParams.builder()
            .model(ChatModel.GPT_4O)
            .build();
        Assistant assistant = client.beta().assistants().create(params);
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

assistant = openai.beta.assistants.create(model: :"gpt-4o")

puts(assistant)

Response

{
  "id": "asst_abc123",
  "object": "assistant",
  "created_at": 1698984975,
  "name": "Math Tutor",
  "description": null,
  "model": "gpt-4o",
  "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "metadata": {},
  "top_p": 1.0,
  "temperature": 1.0,
  "response_format": "auto"
}

İstek

curl https://api.openai.com/v1/assistants \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
    "tools": [{"type": "file_search"}],
    "tool_resources": {"file_search": {"vector_store_ids": ["vs_123"]}},
    "model": "gpt-4o"
  }'
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
assistant = client.beta.assistants.create(
    model="gpt-4o",
)
print(assistant.id)
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistant = await openai.beta.assistants.create({
    instructions:
      "You are an HR bot, and you have access to files to answer employee questions about company policies.",
    name: "HR Helper",
    tools: [{ type: "file_search" }],
    tool_resources: {
      file_search: {
        vector_store_ids: ["vs_123"]
      }
    },
    model: "gpt-4o"
  });

  console.log(myAssistant);
}

main();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const assistant = await client.beta.assistants.create({ model: 'gpt-4o' });

console.log(assistant.id);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
    "github.com/openai/openai-go/shared"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    assistant, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
        Model: shared.ChatModelGPT4o,
    })
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", assistant.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.ChatModel;
import com.openai.models.beta.assistants.Assistant;
import com.openai.models.beta.assistants.AssistantCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        AssistantCreateParams params = AssistantCreateParams.builder()
            .model(ChatModel.GPT_4O)
            .build();
        Assistant assistant = client.beta().assistants().create(params);
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

assistant = openai.beta.assistants.create(model: :"gpt-4o")

puts(assistant)

Response

{
  "id": "asst_abc123",
  "object": "assistant",
  "created_at": 1699009403,
  "name": "HR Helper",
  "description": null,
  "model": "gpt-4o",
  "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
  "tools": [
    {
      "type": "file_search"
    }
  ],
  "tool_resources": {
    "file_search": {
      "vector_store_ids": ["vs_123"]
    }
  },
  "metadata": {},
  "top_p": 1.0,
  "temperature": 1.0,
  "response_format": "auto"
}
tr-tr
Gizlilik Tercihleriniz
  • AI Bildirim
  • Önceki Sürümler
  • Blog
  • Katkıda Bulunun
  • Gizlilik
  • Tüketici Sağlığı Gizliliği
  • Kullanım Koşulları
  • Ticari Markalar
  • © Microsoft 2026