---
title: "POST /v1/agent/generate"
method: POST
path: "/v1/agent/generate"
tags: ["Agent"]
---

# POST /v1/agent/generate

`POST /v1/agent/generate`

## Request body

- object — Simplified interface for the OpenAI Chat request format
  - `model` string
  - `messages` object[]
    - `tool_calls` object[]
      - `type` 'function', required
      - `function` object, required
        - `arguments` string, required
        - `name` string, required
      - `id` string, required
    - `tool_call_id` string
    - `name` string
    - `content` union, required
      - string
      - object[]
        - `image_url` object
          - `url` string, required
        - `text` string
        - `type` string, required
    - `role` string, required
  - `temperature` number, double
  - `top_p` number, double
  - `max_tokens` number, double
  - `max_completion_tokens` number, double
  - `stream` boolean
  - `stop` union
    - string[]
    - string
  - `tools` object[]
    - `function` object, required
      - `strict` boolean
      - `parameters` RecordStringAny — Construct a type with a set of properties K of type T
      - `description` string
      - `name` string, required
    - `type` 'function', required
  - `tool_choice` union
    - object
      - `function` object
        - `name` string, required
        - `type` 'function', required
      - `type` string, required
    - 'none' | 'auto' | 'required'
  - `parallel_tool_calls` boolean
  - `reasoning_effort` 'minimal' | 'low' | 'medium' | 'high'
  - `verbosity` 'low' | 'medium' | 'high'
  - `frequency_penalty` number, double
  - `presence_penalty` number, double
  - `logit_bias` RecordStringNumber — Construct a type with a set of properties K of type T
  - `logprobs` boolean
  - `top_logprobs` number, double
  - `n` number, double
  - `modalities` string[]
  - `prediction` unknown
  - `audio` unknown
  - `response_format` object
    - `json_schema` unknown
    - `type` string, required
  - `seed` number, double
  - `service_tier` string
  - `store` boolean
  - `stream_options` unknown
  - `metadata` RecordStringString — Construct a type with a set of properties K of type T
  - `user` string
  - `function_call` union
    - string
    - object
      - `name` string, required
  - `functions` unknown[]
    - unknown
  - `inputs` unknown
  - `environment` string
  - `prompt_id` string
  - `logRequest` boolean
  - `useAIGateway` boolean

## Response `200`

Ok

- union
  - ResultSuccessChatCompletionOrContentStringReasoningStringCallsAny
    - `data` union, required
      - ChatCompletion — Represents a chat completion response returned by model, based on the provided input.
        - `id` string, required — A unique identifier for the chat completion.
        - `choices` ChatCompletionChoice[], required — A list of chat completion choices. Can be more than one if `n` is greater than 1.
          - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', required — The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
          - `index` number, double, required — The index of the choice in the list of choices.
          - `logprobs` ChatCompletionChoiceLogprobs, required — Log probability information for the choice.
            - `content` ChatCompletionTokenLogprob[], nullable, required — A list of message content tokens with log probability information.
              - …
            - `refusal` ChatCompletionTokenLogprob[], nullable, required — A list of message refusal tokens with log probability information.
              - …
          - `message` ChatCompletionMessage, required — A chat completion message generated by the model.
            - `content` string, nullable, required — The contents of the message.
            - `refusal` string, nullable, required — The refusal message generated by the model.
            - `role` 'assistant', required — The role of the author of this message.
            - `annotations` ChatCompletionMessageAnnotation[] — Annotations for the message, when applicable, as when using the [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
              - …
            - `audio` ChatCompletionAudio — If the audio output modality is requested, this object contains data about the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).
              - …
            - `function_call` ChatCompletionMessageFunctionCall
              - …
            - `tool_calls` ChatCompletionMessageToolCall[] — The tool calls generated by the model, such as function calls.
              - …
        - `created` number, double, required — The Unix timestamp (in seconds) of when the chat completion was created.
        - `model` string, required — The model used for the chat completion.
        - `object` 'chat.completion', required — The object type, which is always `chat.completion`.
        - `service_tier` 'auto' | 'default' | 'flex' | 'scale' | 'priority' | 'null', nullable — Specifies the processing type used for serving the request. - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or 'priority', then the request will be processed with the corresponding service tier. [Contact sales](https://openai.com/contact-sales) to learn more about Priority processing. - When not set, the default behavior is 'auto'. When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
        - `system_fingerprint` string — This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
        - `usage` CompletionUsage — Usage statistics for the completion request.
          - `completion_tokens` number, double, required — Number of tokens in the generated completion.
          - `prompt_tokens` number, double, required — Number of tokens in the prompt.
          - `total_tokens` number, double, required — Total number of tokens used in the request (prompt + completion).
          - `completion_tokens_details` CompletionUsageCompletionTokensDetails — Breakdown of tokens used in a completion.
            - `accepted_prediction_tokens` number, double — When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
            - `audio_tokens` number, double — Audio input tokens generated by the model.
            - `reasoning_tokens` number, double — Tokens generated by the model for reasoning.
            - `rejected_prediction_tokens` number, double — When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.
          - `prompt_tokens_details` CompletionUsagePromptTokensDetails — Breakdown of tokens used in the prompt.
            - `audio_tokens` number, double — Audio input tokens present in the prompt.
            - `cached_tokens` number, double — Cached tokens present in the prompt.
      - object
        - `calls` unknown, required
        - `reasoning` string, required
        - `content` string, required
    - `error` null, nullable, required
  - ResultErrorString
    - `data` null, nullable, required
    - `error` string, required

---

[API](https://skmtc.net/helicone/apis/helicone-api.md) · [All operations](https://skmtc.net/helicone/apis/helicone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/helicone/helicone-api/revisions/b369e9e3e80c/schema)
