Ugrás a fő tartalomhoz

Ezt a böngészőt már nem támogatjuk.

Frissítsen a Microsoft Edge-re, hogy kihasználhassa a legújabb funkciókat, a biztonsági frissítéseket és a technikai támogatást.

A Microsoft Edge letöltése További információk az Internet Explorerről és a Microsoft Edge-ről
microsoft-foundry.rest.security.o-auth2-auth

Conversations

Create a conversation

POST /openai/v1/conversations

Creates a new conversation resource.

Fejlécparaméterek

x-ms-user-identity string

Opaque per-user identity string used to scope endpoint-scoped data to a specific end user. The caller must have the agents/endpoints/UserIdentityImpersonation/action RBAC permission.

Kérelem törzse

Content-Type: application/json
metadata OpenAI.Metadata | null

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
items OpenAI.InputItem[] | null

Válaszok

The request has succeeded.

Törzs

Content-Type: application/json
id string kötelező

The unique ID of the conversation.

object enum kötelező

The object type, which is always conversation.

conversation
metadata OpenAI.Metadata kötelező

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
created_at integer kötelező

The time at which the conversation was created, measured in seconds since the Unix epoch.

Client error

Törzs

Content-Type: application/json
error OpenAI.Error kötelező
code string | null kötelező
message string kötelező
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
A következők bármelyike:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string kötelező

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Törzs

Content-Type: application/json
error OpenAI.Error kötelező
code string | null kötelező
message string kötelező
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
A következők bármelyike:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string kötelező

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Kérés

curl https://api.openai.com/v1/conversations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "metadata": {"topic": "demo"},
    "items": [
      {
        "type": "message",
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'
import OpenAI from "openai";
const client = new OpenAI();

const conversation = await client.conversations.create({
  metadata: { topic: "demo" },
  items: [
    { type: "message", role: "user", content: "Hello!" }
  ],
});
console.log(conversation);
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
conversation = client.conversations.create()
print(conversation.id)
using System;
using System.Collections.Generic;
using OpenAI.Conversations;

OpenAIConversationClient client = new(
    apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")
);

Conversation conversation = client.CreateConversation(
    new CreateConversationOptions
    {
        Metadata = new Dictionary<string, string>
        {
            { "topic", "demo" }
        },
        Items =
        {
            new ConversationMessageInput
            {
                Role = "user",
                Content = "Hello!",
            }
        }
    }
);
Console.WriteLine(conversation.Id);
import OpenAI from 'openai';

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

const conversation = await client.conversations.create();

console.log(conversation.id);
package main

import (
    "context"
    "fmt"

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

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    conversation, err := client.Conversations.New(context.TODO(), conversations.ConversationNewParams{})
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", conversation.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.conversations.Conversation;
import com.openai.models.conversations.ConversationCreateParams;

public final class Main {
    private Main() {}

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

        Conversation conversation = client.conversations().create();
    }
}
require "openai"

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

conversation = openai.conversations.create

puts(conversation)

Válasz

{
  "id": "conv_123",
  "object": "conversation",
  "created_at": 1741900000,
  "metadata": {"topic": "demo"}
}
hu-hu
Az Ön adatvédelmi választási lehetőségei
  • AI-jogi nyilatkozat
  • Korábbi verziók
  • Blog
  • Közreműködés
  • Adatvédelem
  • A Consumer Health adatvédelmi nyilatkozata
  • Használati feltételek
  • Védjegyek
  • © Microsoft 2026