---
title: "Create Chat Completion"
method: POST
path: "/v1/chat/completions"
tags: ["v1", "chat"]
---

# Create Chat Completion

`POST /v1/chat/completions`

Create a chat completion.

Generates a model response for the given conversation and configuration.
Supports OpenAI-compatible parameters and provider-specific extensions.

Headers:
  - Authorization: bearer key for the calling account.
  - Optional BYOK or provider headers if applicable.

Behavior:
  - If multiple models are supplied, the first one is used, and the agent may hand off to another model.
  - Tools may be invoked on the server or signaled for the client to run.
  - Streaming responses emit incremental deltas; non-streaming returns a single object.
  - Usage metrics are computed when available and returned in the response.

Responses:
  - 200 OK: JSON completion object with choices, message content, and usage.
  - 400 Bad Request: validation error.
  - 401 Unauthorized: authentication failed.
  - 402 Payment Required or 429 Too Many Requests: quota, balance, or rate limit issue.
  - 500 Internal Server Error: unexpected failure.

Billing:
  - Token usage metered by the selected model(s).
  - Tool calls and MCP sessions may be billed separately.
  - Streaming is settled after the stream ends via an async task.

Example (non-streaming HTTP):
  POST /v1/chat/completions
  Content-Type: application/json
  Authorization: Bearer <key>

  {
    "model": "provider/model-name",
    "messages": [{"role": "user", "content": "Hello"}]
  }

  200 OK
  {
    "id": "cmpl_123",
    "object": "chat.completion",
    "choices": [
      {"index": 0, "message": {"role": "assistant", "content": "Hi there!"}, "finish_reason": "stop"}
    ],
    "usage": {"prompt_tokens": 3, "completion_tokens": 4, "total_tokens": 7}
  }

Example (streaming over SSE):
  POST /v1/chat/completions
  Accept: text/event-stream

  data: {"id":"cmpl_123","choices":[{"index":0,"delta":{"content":"Hi"}}]}
  data: {"id":"cmpl_123","choices":[{"index":0,"delta":{"content":" there!"}}]}
  data: [DONE]

## Request body

- ChatCompletionRequest — ChatCompletion request schema. Supports OpenAI-compatible parameters, provider-specific extensions, server-side execution, and agent orchestration features.
  - `audio` object, nullable — Parameters for audio output. Required when audio output is requested with `mo...
  - `frequency_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on the...
  - `function_call` string, nullable — Deprecated in favor of `tool_choice`. Controls which (if any) function is ca...
  - `functions` ChatCompletionFunctions[], nullable — Deprecated in favor of `tools`. A list of functions the model may generate J...
    - `description` string — A description of what the function does, used by the model to choose when and how to call the function.
    - `name` string, required — The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
    - `parameters` FunctionParameters — The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list.
  - `logit_bias` object, nullable — Modify the likelihood of specified tokens appearing in the completion. Accep...
  - `logprobs` boolean, nullable — Whether to return log probabilities of the output tokens or not. If true, ret...
  - `max_completion_tokens` integer, nullable — Maximum tokens in completion (newer parameter name)
  - `max_tokens` integer, nullable — Maximum tokens in completion
  - `messages` union[], nullable — Conversation history (OpenAI: messages, Google: contents, Responses: input)
    - union
      - ChatCompletionRequestDeveloperMessage — Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, `developer` messages replace the previous `system` messages. Fields: - content (required): str | Annotated[list[ChatCompletionRequestMessageContentPartText], MinLen(1)] - role (required): Literal["developer"] - name (optional): str
        - `content` union, required — The contents of the developer message.
          - string
          - ChatCompletionRequestMessageContentPartText[]
            - `type` 'text', required — The type of the content part.
            - `text` string, required — The text content.
        - `role` 'developer', required — The role of the messages author, in this case `developer`.
        - `name` string — An optional name for the participant. Provides the model information to differentiate between participants of the same role.
      - ChatCompletionRequestSystemMessage — Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use `developer` messages for this purpose instead. Fields: - content (required): str | Annotated[list[ChatCompletionRequestSystemMessageContentPart], MinLen(1)] - role (required): Literal["system"] - name (optional): str
        - `content` union, required — The contents of the system message.
          - string
          - ChatCompletionRequestMessageContentPartText[]
            - `type` 'text', required — The type of the content part.
            - `text` string, required — The text content.
        - `role` 'system', required — The role of the messages author, in this case `system`.
        - `name` string — An optional name for the participant. Provides the model information to differentiate between participants of the same role.
      - ChatCompletionRequestUserMessage — Messages sent by an end user, containing prompts or additional context information. Fields: - content (required): str | Annotated[list[ChatCompletionRequestUserMessageContentPart], MinLen(1)] - role (required): Literal["user"] - name (optional): str
        - `content` union, required — The contents of the user message.
          - string
          - union[]
            - union
              - …
        - `role` 'user', required — The role of the messages author, in this case `user`.
        - `name` string — An optional name for the participant. Provides the model information to differentiate between participants of the same role.
      - ChatCompletionRequestAssistantMessage — Messages sent by the model in response to user messages. Fields: - content (optional): str | Annotated[list[ChatCompletionRequestAssistantMessageContentPart], MinLen(1)] | None - refusal (optional): str | None - role (required): Literal["assistant"] - name (optional): str - audio (optional): Audio | None - tool_calls (optional): ChatCompletionMessageToolCalls - function_call (optional): FunctionCallInline | None
        - `content` union — The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.
          - string
          - union[]
            - union
              - …
        - `refusal` string, nullable — The refusal message by the assistant.
        - `role` 'assistant', required — The role of the messages author, in this case `assistant`.
        - `name` string — An optional name for the participant. Provides the model information to differentiate between participants of the same role.
        - `audio` object, nullable — Data about a previous audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio). Fields: - id (required): str
          - `id` string, required — Unique identifier for a previous audio response from the model.
        - `tool_calls` union[] — The tool calls generated by the model, such as function calls.
          - union
            - ChatCompletionMessageToolCallInput — A call to a function tool created by the model. Fields: - id (required): str - type (required): Literal["function"] - function (required): ChatCompletionMessageToolCallFunction
              - …
            - ChatCompletionMessageCustomToolCall — A call to a custom tool created by the model. Fields: - id (required): str - type (required): Literal["custom"] - custom (required): Custom
              - …
        - `function_call` object, nullable — Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. Fields: - arguments (required): str - name (required): str
          - `arguments` string, required — The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
          - `name` string, required — The name of the function to call.
      - ChatCompletionRequestToolMessage — Schema for ChatCompletionRequestToolMessage. Fields: - role (required): Literal["tool"] - content (required): str | Annotated[list[ChatCompletionRequestToolMessageContentPart], MinLen(1)] - tool_call_id (required): str
        - `role` 'tool', required — The role of the messages author, in this case `tool`.
        - `content` union, required — The contents of the tool message.
          - string
          - ChatCompletionRequestMessageContentPartText[]
            - `type` 'text', required — The type of the content part.
            - `text` string, required — The text content.
        - `tool_call_id` string, required — Tool call that this message is responding to.
      - ChatCompletionRequestFunctionMessage — Schema for ChatCompletionRequestFunctionMessage. Fields: - role (required): Literal["function"] - content (required): str | None - name (required): str
        - `role` 'function', required — The role of the messages author, in this case `function`.
        - `content` string, nullable, required — The contents of the function message.
        - `name` string, required — The name of the function to call.
  - `metadata` object, nullable — Set of 16 key-value pairs that can be attached to an object. This can be usef...
  - `modalities` string[], nullable — Output types that you would like the model to generate. Most models are capab...
  - `model` union, required — Model identifier. Accepts model ID strings, lists for routing, or DedalusModel objects with per-model settings.
    - union — Dedalus model choice - either a string ID or DedalusModel configuration object.
      - string — Model identifier string (e.g., 'openai/gpt-5', 'anthropic/claude-3-5-sonnet').
      - DedalusModel — Structured model selection entry used in request payloads. Supports OpenAI-style semantics (string model id) while enabling optional per-model default settings for Dedalus multi-model routing.
        - `model` string, required — Model identifier with provider prefix (e.g., 'openai/gpt-5', 'anthropic/claude-3-5-sonnet').
        - `settings` ModelSettings
          - `temperature` number, nullable
          - `top_p` number, nullable
          - `frequency_penalty` number, nullable
          - `presence_penalty` number, nullable
          - `stop` union
            - string
            - string[]
          - `seed` integer, nullable
          - `logit_bias` object, nullable
          - `logprobs` boolean, nullable
          - `top_logprobs` integer, nullable
          - `n` integer, nullable
          - `user` string, nullable
          - `response_format` object, nullable
          - `stream` boolean, nullable
          - `stream_options` object, nullable
          - `audio` object, nullable
          - `service_tier` string, nullable
          - `prediction` object, nullable
          - `tool_choice` union
            - 'auto' | 'required' | 'none'
            - string
            - object
            - MCPToolChoice
              - …
          - `parallel_tool_calls` boolean, nullable
          - `truncation` 'auto' | 'disabled', nullable
          - `max_tokens` integer, nullable
          - `max_completion_tokens` integer, nullable
          - `reasoning` Reasoning
            - `effort` 'minimal' | 'low' | 'medium' | 'high', nullable
            - `generate_summary` 'auto' | 'concise' | 'detailed', nullable
            - `summary` 'auto' | 'concise' | 'detailed', nullable
          - `reasoning_effort` string, nullable
          - `metadata` object, nullable
          - `store` boolean, nullable
          - `include_usage` boolean, nullable
          - `timeout` number, nullable
          - `prompt_cache_key` string, nullable
          - `safety_identifier` string, nullable
          - `verbosity` string, nullable
          - `web_search_options` object, nullable
          - `response_include` string[], nullable
          - `use_responses` boolean
          - `extra_query` QueryParams
          - `extra_headers` HeaderParams
          - `extra_args` object, nullable
          - `attributes` object
          - `voice` string, nullable
          - `modalities` string[], nullable
          - `input_audio_format` string, nullable
          - `output_audio_format` string, nullable
          - `input_audio_transcription` object, nullable
          - `turn_detection` object, nullable
          - `thinking` object, nullable
          - `top_k` integer, nullable
          - `generation_config` object, nullable
          - `system_instruction` object, nullable
          - `safety_settings` object[], nullable
          - `tool_config` object, nullable
          - `search_parameters` object, nullable
          - `deferred` boolean, nullable
          - `structured_output` unknown
    - DedalusModelChoice[]
      - union — Dedalus model choice - either a string ID or DedalusModel configuration object.
        - string — Model identifier string (e.g., 'openai/gpt-5', 'anthropic/claude-3-5-sonnet').
        - DedalusModel — Structured model selection entry used in request payloads. Supports OpenAI-style semantics (string model id) while enabling optional per-model default settings for Dedalus multi-model routing.
          - `model` string, required — Model identifier with provider prefix (e.g., 'openai/gpt-5', 'anthropic/claude-3-5-sonnet').
          - `settings` ModelSettings
            - `temperature` number, nullable
            - `top_p` number, nullable
            - `frequency_penalty` number, nullable
            - `presence_penalty` number, nullable
            - `stop` union
              - …
            - `seed` integer, nullable
            - `logit_bias` object, nullable
            - `logprobs` boolean, nullable
            - `top_logprobs` integer, nullable
            - `n` integer, nullable
            - `user` string, nullable
            - `response_format` object, nullable
            - `stream` boolean, nullable
            - `stream_options` object, nullable
            - `audio` object, nullable
            - `service_tier` string, nullable
            - `prediction` object, nullable
            - `tool_choice` union
              - …
            - `parallel_tool_calls` boolean, nullable
            - `truncation` 'auto' | 'disabled', nullable
            - `max_tokens` integer, nullable
            - `max_completion_tokens` integer, nullable
            - `reasoning` Reasoning
              - …
            - `reasoning_effort` string, nullable
            - `metadata` object, nullable
            - `store` boolean, nullable
            - `include_usage` boolean, nullable
            - `timeout` number, nullable
            - `prompt_cache_key` string, nullable
            - `safety_identifier` string, nullable
            - `verbosity` string, nullable
            - `web_search_options` object, nullable
            - `response_include` string[], nullable
            - `use_responses` boolean
            - `extra_query` QueryParams
            - `extra_headers` HeaderParams
            - `extra_args` object, nullable
            - `attributes` object
            - `voice` string, nullable
            - `modalities` string[], nullable
            - `input_audio_format` string, nullable
            - `output_audio_format` string, nullable
            - `input_audio_transcription` object, nullable
            - `turn_detection` object, nullable
            - `thinking` object, nullable
            - `top_k` integer, nullable
            - `generation_config` object, nullable
            - `system_instruction` object, nullable
            - `safety_settings` object[], nullable
              - …
            - `tool_config` object, nullable
            - `search_parameters` object, nullable
            - `deferred` boolean, nullable
            - `structured_output` unknown
  - `n` integer, nullable — How many chat completion choices to generate for each input message. Note tha...
  - `parallel_tool_calls` boolean, nullable — Whether to enable parallel tool calls (Anthropic uses inverted polarity)
  - `prediction` PredictionContent — Static predicted output content, such as the content of a text file that is being regenerated. Fields: - type (required): Literal["content"] - content (required): str | Annotated[list[ChatCompletionRequestMessageContentPartText], MinLen(1)]
    - `type` 'content', required — The type of the predicted content you want to provide. This type is currently always `content`.
    - `content` union, required — The content that should be matched when generating a model response. If generated tokens would match this content, the entire model response can be returned much more quickly.
      - string
      - ChatCompletionRequestMessageContentPartText[]
        - `type` 'text', required — The type of the content part.
        - `text` string, required — The text content.
  - `presence_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on whe...
  - `prompt_cache_key` string, nullable — Used by OpenAI to cache responses for similar requests to optimize your cache...
  - `prompt_cache_retention` string, nullable — The retention policy for the prompt cache. Set to `24h` to enable extended pr...
  - `reasoning_effort` string, nullable — Constrains effort on reasoning for [reasoning models](https://platform.openai...
  - `response_format` union — An object specifying the format that the model must output. Setting to `{ "...
    - ResponseFormatText — Default response format. Used to generate text responses. Fields: - type (required): Literal["text"]
      - `type` 'text', required — The type of response format being defined. Always `text`.
    - ResponseFormatJsonSchema — JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). Fields: - type (required): Literal["json_schema"] - json_schema (required): JSONSchema
      - `type` 'json_schema', required — The type of response format being defined. Always `json_schema`.
      - `json_schema` JSONSchema, required — Structured Outputs configuration options, including a JSON Schema. Fields: - description (optional): str - name (required): str - schema (optional): ResponseFormatJsonSchemaSchema - strict (optional): bool | None
        - `description` string — A description of what the response format is for, used by the model to determine how to respond in the format.
        - `name` string, required — The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
        - `schema` ResponseFormatJsonSchemaSchema — The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas [here](https://json-schema.org/).
        - `strict` boolean, nullable — Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
    - ResponseFormatJsonObject — JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so. Fields: - type (required): Literal["json_object"]
      - `type` 'json_object', required — The type of response format being defined. Always `json_object`.
  - `safety_identifier` string, nullable — A stable identifier used to help detect users of your application that may be...
  - `seed` integer, nullable — Random seed for deterministic output
  - `service_tier` string, nullable — Service tier for request processing
  - `stop` union — Not supported with latest reasoning models `o3` and `o4-mini`. Up to 4 seque...
    - string[]
    - string
  - `store` boolean, nullable — Whether or not to store the output of this chat completion request for use in...
  - `stream` boolean, nullable — Enable streaming response
  - `stream_options` object, nullable — Options for streaming response. Only set this when you set `stream: true`.
  - `system_instruction` union — System instruction/prompt
    - object
    - string
  - `temperature` number, nullable — Sampling temperature (0-2 for most providers)
  - `tool_choice` union — Controls which (if any) tool is called by the model. `none` means the model w...
    - ToolChoiceAuto — The model will automatically decide whether to use tools. Fields: - disable_parallel_tool_use (optional): bool - type (required): Literal["auto"]
      - `disable_parallel_tool_use` boolean — Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output at most one tool use.
      - `type` 'auto', required
    - ToolChoiceAny — The model will use any available tools. Fields: - disable_parallel_tool_use (optional): bool - type (required): Literal["any"]
      - `disable_parallel_tool_use` boolean — Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
      - `type` 'any', required
    - ToolChoiceTool — The model will use the specified tool with `tool_choice.name`. Fields: - disable_parallel_tool_use (optional): bool - name (required): str - type (required): Literal["tool"]
      - `disable_parallel_tool_use` boolean — Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
      - `name` string, required — The name of the tool to use.
      - `type` 'tool', required
    - ToolChoiceNone — The model will not be allowed to use tools. Fields: - type (required): Literal["none"]
      - `type` 'none', required
  - `tools` union[], nullable — Available tools/functions for the model
    - union
      - ChatCompletionTool — A function tool that can be used to generate a response. Fields: - type (required): Literal["function"] - function (required): FunctionObject
        - `type` 'function', required — The type of the tool. Currently, only `function` is supported.
        - `function` FunctionObject, required — Schema for FunctionObject. Fields: - description (optional): str - name (required): str - parameters (optional): FunctionParameters - strict (optional): bool | None
          - `description` string — A description of what the function does, used by the model to choose when and how to call the function.
          - `name` string, required — The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
          - `parameters` FunctionParameters — The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list.
          - `strict` boolean, nullable — Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling).
      - CustomToolChatCompletions — A custom tool that processes input using a specified format. Fields: - type (required): Literal["custom"] - custom (required): CustomToolProperties
        - `type` 'custom', required — The type of the custom tool. Always `custom`.
        - `custom` CustomToolProperties, required — Properties of the custom tool. Fields: - name (required): str - description (optional): str - format (optional): FormatUnion_ecfe4be0
          - `name` string, required — The name of the custom tool, used to identify it in tool calls.
          - `description` string — Optional description of the custom tool, used to provide more context.
          - `format` union — The input format for the custom tool. Default is unconstrained text.
            - object — Unconstrained free-form text. Fields: - type (required): Literal["text"]
              - …
            - object — A grammar defined by the user. Fields: - type (required): Literal["grammar"] - grammar (required): GrammarFormatGrammarFormat
              - …
  - `top_k` integer, nullable — Top-k sampling parameter
  - `top_logprobs` integer, nullable — An integer between 0 and 20 specifying the number of most likely tokens to re...
  - `top_p` number, nullable — Nucleus sampling threshold
  - `user` string, nullable — This field is being replaced by `safety_identifier` and `prompt_cache_key`. U...
  - `verbosity` string, nullable — Constrains the verbosity of the model's response. Lower values will result in...
  - `web_search_options` object, nullable — This tool searches the web for relevant results to use in a response. Learn m...
  - `cachedContent` string, nullable — Optional. The name of the content [cached](https://ai.google.dev/gemini-api/d...
  - `deferred` boolean, nullable — If set to `true`, the request returns a `request_id`. You can then get the de...
  - `generation_config` object, nullable — Generation parameters wrapper (Google-specific)
  - `prompt_mode` object, nullable — Allows toggling between the reasoning mode and no system prompt. When set to ...
  - `safe_prompt` boolean, nullable — Whether to inject a safety prompt before all conversations.
  - `safety_settings` SafetySetting[], nullable — Safety/content filtering settings (Google-specific)
    - `category` 'HARM_CATEGORY_UNSPECIFIED' | 'HARM_CATEGORY_DEROGATORY' | 'HARM_CATEGORY_TOXICITY' | 'HARM_CATEGORY_VIOLENCE' | 'HARM_CATEGORY_SEXUAL' | 'HARM_CATEGORY_MEDICAL' | 'HARM_CATEGORY_DANGEROUS' | 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_CIVIC_INTEGRITY', required — Required. The category for this setting.
    - `threshold` 'HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE' | 'OFF', required — Required. Controls the probability threshold at which harm is blocked.
  - `search_parameters` object, nullable — Set the parameters to be used for searched data. If not set, no data will be ...
  - `stop_sequences` string[], nullable — Custom text sequences that will cause the model to stop generating. Our mode...
  - `thinking` union — Extended thinking configuration (Anthropic-specific)
    - ThinkingConfigEnabled — Schema for ThinkingConfigEnabled. Fields: - budget_tokens (required): int - type (required): Literal["enabled"]
      - `budget_tokens` integer, required — Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details.
      - `type` 'enabled', required
    - ThinkingConfigDisabled — Schema for ThinkingConfigDisabled. Fields: - type (required): Literal["disabled"]
      - `type` 'disabled', required
  - `tool_config` object, nullable — Tool calling configuration (Google-specific)
  - `mcp_servers` union — MCP server identifiers. Accepts URLs, repository slugs, or server IDs.
    - string
    - string[]
  - `guardrails` object[], nullable — Content filtering and safety policy configuration.
  - `handoff_config` object, nullable — Configuration for multi-model handoffs.
  - `model_attributes` object, nullable — Model attributes for routing. Maps model IDs to attribute dictionaries with values in [0.0, 1.0].
  - `agent_attributes` object, nullable — Agent attributes. Values in [0.0, 1.0].
  - `max_turns` integer, nullable — Maximum conversation turns.
  - `automatic_tool_execution` boolean — Execute tools server-side. If false, returns raw tool calls for manual handling.

## Response `200`

JSON or SSE stream of ChatCompletionChunk events

- ChatCompletion — Chat completion response for Dedalus API. OpenAI-compatible chat completion response with Dedalus extensions. Maintains full compatibility with OpenAI API while providing additional features like server-side tool execution tracking and MCP error reporting.
  - `id` string, required — A unique identifier for the chat completion.
  - `choices` Choice[], 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', nullable — 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` integer, required — The index of the choice in the list of choices.
    - `message` ChatCompletionResponseMessage, required — A chat completion message generated by the model. Fields: - content (required): str | None - refusal (required): str | None - tool_calls (optional): ChatCompletionMessageToolCalls - annotations (optional): list[AnnotationsItem] - role (required): Literal["assistant"] - function_call (optional): FunctionCall - audio (optional): Audio | None
      - `content` string, nullable, required — The contents of the message.
      - `refusal` string, nullable, required — The refusal message generated by the model.
      - `tool_calls` union[] — The tool calls generated by the model, such as function calls.
        - union
          - ChatCompletionMessageToolCallOutput — A call to a function tool created by the model. Fields: - id (required): str - type (required): Literal["function"] - function (required): Function
            - `id` string, required — The ID of the tool call.
            - `type` 'function', required — The type of the tool. Currently, only `function` is supported.
            - `function` Function, required — The function that the model called. Fields: - name (required): str - arguments (required): str
              - …
          - ChatCompletionMessageCustomToolCall — A call to a custom tool created by the model. Fields: - id (required): str - type (required): Literal["custom"] - custom (required): Custom
            - `id` string, required — The ID of the tool call.
            - `type` 'custom', required — The type of the tool. Always `custom`.
            - `custom` Custom, required — The custom tool that the model called. Fields: - name (required): str - input (required): str
              - …
      - `annotations` AnnotationsItem[] — 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).
        - `type` 'url_citation', required — The type of the URL citation. Always `url_citation`.
        - `url_citation` UrlCitation, required — A URL citation when using web search. Fields: - end_index (required): int - start_index (required): int - url (required): str - title (required): str
          - `end_index` integer, required — The index of the last character of the URL citation in the message.
          - `start_index` integer, required — The index of the first character of the URL citation in the message.
          - `url` string, required — The URL of the web resource.
          - `title` string, required — The title of the web resource.
      - `role` 'assistant', required — The role of the author of this message.
      - `function_call` FunctionCall — Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. Fields: - arguments (required): str - name (required): str
        - `arguments` string, required — The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
        - `name` string, required — The name of the function to call.
      - `audio` object, nullable — 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). Fields: - id (required): str - expires_at (required): int - data (required): str - transcript (required): str
        - `id` string, required — Unique identifier for this audio response.
        - `expires_at` integer, required — The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations.
        - `data` string, required — Base64 encoded audio bytes generated by the model, in the format specified in the request.
        - `transcript` string, required — Transcript of the audio generated by the model.
    - `logprobs` object, nullable — Log probability information for the choice.
      - `content` ChatCompletionTokenLogprob[], nullable — A list of message content tokens with log probability information.
        - `token` string, required — The token.
        - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
        - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
        - `top_logprobs` TopLogprob[], required — List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
          - `token` string, required — The token.
          - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
          - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
      - `refusal` ChatCompletionTokenLogprob[], nullable — A list of message refusal tokens with log probability information.
        - `token` string, required — The token.
        - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
        - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
        - `top_logprobs` TopLogprob[], required — List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
          - `token` string, required — The token.
          - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
          - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
  - `created` integer, required — The Unix timestamp (in seconds) of when the chat completion was created.
  - `model` string, required — The model used for the chat completion.
  - `service_tier` 'auto' | 'default' | 'flex' | 'scale' | 'priority', 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](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. - 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.
  - `object` 'chat.completion', required — The object type, which is always `chat.completion`.
  - `usage` CompletionUsage — Usage statistics for the completion request. Fields: - completion_tokens (required): int - prompt_tokens (required): int - total_tokens (required): int - completion_tokens_details (optional): CompletionTokensDetails - prompt_tokens_details (optional): PromptTokensDetails
    - `completion_tokens` integer, required — Number of tokens in the generated completion.
    - `prompt_tokens` integer, required — Number of tokens in the prompt.
    - `total_tokens` integer, required — Total number of tokens used in the request (prompt + completion).
    - `completion_tokens_details` CompletionTokensDetails — Breakdown of tokens used in a completion. Fields: - accepted_prediction_tokens (optional): int - audio_tokens (optional): int - reasoning_tokens (optional): int - rejected_prediction_tokens (optional): int
      - `accepted_prediction_tokens` integer — When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
      - `audio_tokens` integer — Audio input tokens generated by the model.
      - `reasoning_tokens` integer — Tokens generated by the model for reasoning.
      - `rejected_prediction_tokens` integer — 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` PromptTokensDetails — Breakdown of tokens used in the prompt. Fields: - audio_tokens (optional): int - cached_tokens (optional): int
      - `audio_tokens` integer — Audio input tokens present in the prompt.
      - `cached_tokens` integer — Cached tokens present in the prompt.
  - `tools_executed` string[], nullable — List of tool names that were executed server-side (e.g., MCP tools). Only present when tools were executed on the server rather than returned for client-side execution.
  - `mcp_server_errors` object, nullable — Information about MCP server failures, if any occurred during the request. Contains details about which servers failed and why, along with recommendations for the user. Only present when MCP server failures occurred.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/dedalus-labs/apis/dedalus-api.md) · [All operations](https://skmtc.net/dedalus-labs/apis/dedalus-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/dedalus-labs/dedalus-api/versions/81ffcde15f4c/schema)
