Pular para o conteúdo principal

Não há mais suporte para esse navegador.

Atualize o Microsoft Edge para aproveitar os recursos, o suporte técnico e as atualizações de segurança mais recentes.

Baixar o Microsoft Edge Mais informações sobre o Internet Explorer e o Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Threads, Assistants

Get a run step

GET /openai/v1/threads/{thread_id}/runs/{run_id}/steps/{step_id}

Retrieves a run step by its identifier.

Parâmetros de caminho

thread_id string exigido

The ID of the thread to which the run and run step belongs.

run_id string exigido

The ID of the run to which the run step belongs.

step_id string exigido

The ID of the run step to retrieve.

Parâmetros de consulta

include[] enum[]

A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. See the file search tool documentation for more information.

Respostas

The request has succeeded.

Corpo

Content-Type: application/json
id string exigido

The identifier of the run step, which can be referenced in API endpoints.

object enum exigido

The object type, which is always thread.run.step.

thread.run.step
created_at integer exigido

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

assistant_id string exigido

The ID of the assistant associated with the run step.

thread_id string exigido

The ID of the thread that was run.

run_id string exigido

The ID of the run that this run step is a part of.

type enum exigido

The type of run step, which can be either message_creation or tool_calls.

message_creationtool_calls
status enum exigido

The status of the run step, which can be either in_progress, cancelled, failed, completed, or expired.

in_progresscancelledfailedcompletedexpired
step_details OpenAI.RunStepDetailsMessageCreationObject | OpenAI.RunStepDetailsToolCallsObject exigido

The details of the run step.

Um dos seguintes:
type enum exigido

Always message_creation.

message_creation
message_creation OpenAI.RunStepDetailsMessageCreationObjectMessageCreation exigido
message_id string exigido
type enum exigido

Always tool_calls.

tool_calls
tool_calls OpenAI.RunStepDetailsToolCall[] exigido

An array of tool calls the run step was involved in. These can be associated with one of three types of tools: code_interpreter, file_search, or function.

last_error OpenAI.RunStepObjectLastError | null exigido
code enum exigido
server_errorrate_limit_exceeded
message string exigido
expired_at integer | null exigido
cancelled_at integer | null exigido
failed_at integer | null exigido
completed_at integer | null exigido
metadata OpenAI.Metadata | null exigido

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
usage OpenAI.RunStepCompletionUsage exigido

Usage statistics related to the run step. This value will be null while the run step's status is in_progress.

completion_tokens integer exigido
prompt_tokens integer exigido
total_tokens integer exigido

Client error

Corpo

Content-Type: application/json
error OpenAI.Error exigido
code string | null exigido
message string exigido
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Qualquer uma das seguintes opções:
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 exigido

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Corpo

Content-Type: application/json
error OpenAI.Error exigido
code string | null exigido
message string exigido
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Qualquer uma das seguintes opções:
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 exigido

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Solicitar

curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
run_step = client.beta.threads.runs.steps.retrieve(
    step_id="step_id",
    thread_id="thread_id",
    run_id="run_id",
)
print(run_step.id)
import OpenAI from "openai";
const openai = new OpenAI();

async function main() {
  const runStep = await openai.beta.threads.runs.steps.retrieve(
    "step_abc123",
    { thread_id: "thread_abc123", run_id: "run_abc123" }
  );
  console.log(runStep);
}

main();
import OpenAI from 'openai';

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

const runStep = await client.beta.threads.runs.steps.retrieve('step_id', {
  thread_id: 'thread_id',
  run_id: 'run_id',
});

console.log(runStep.id);
package main

import (
    "context"
    "fmt"

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

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    runStep, err := client.Beta.Threads.Runs.Steps.Get(
        context.TODO(),
        "thread_id",
        "run_id",
        "step_id",
        openai.BetaThreadRunStepGetParams{},
    )
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", runStep.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.beta.threads.runs.steps.RunStep;
import com.openai.models.beta.threads.runs.steps.StepRetrieveParams;

public final class Main {
    private Main() {}

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

        StepRetrieveParams params = StepRetrieveParams.builder()
            .threadId("thread_id")
            .runId("run_id")
            .stepId("step_id")
            .build();
        RunStep runStep = client.beta().threads().runs().steps().retrieve(params);
    }
}
require "openai"

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

run_step = openai.beta.threads.runs.steps.retrieve("step_id", thread_id: "thread_id", run_id: "run_id")

puts(run_step)

Resposta

{
  "id": "step_abc123",
  "object": "thread.run.step",
  "created_at": 1699063291,
  "run_id": "run_abc123",
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "type": "message_creation",
  "status": "completed",
  "cancelled_at": null,
  "completed_at": 1699063291,
  "expired_at": null,
  "failed_at": null,
  "last_error": null,
  "step_details": {
    "type": "message_creation",
    "message_creation": {
      "message_id": "msg_abc123"
    }
  },
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 456,
    "total_tokens": 579
  }
}
pt-br
Suas escolhas de privacidade
  • Aviso de isenção de responsabilidade sobre a IA
  • Versões anteriores
  • Blog
  • Contribuir
  • Privacidade
  • Privacidade da Integridade do Consumidor
  • Termos de Uso
  • Marcas Comerciais
  • © Microsoft 2026