v1
chat

Create Chat Completion

Changed on

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]

post/v1/chat/completions

Request

  • Base URL
    https://api.dedaluslabs.ai
  • Auth
    HTTP bearer

Request body

audioobject nullable

Parameters for audio output. Required when audio output is requested with `mo...

frequency_penaltynumber nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on the...

function_callstring nullable

Deprecated in favor of tool_choice. Controls which (if any) function is ca...

logit_biasobject nullable

Modify the likelihood of specified tokens appearing in the completion. Accep...

logprobsboolean nullable

Whether to return log probabilities of the output tokens or not. If true, ret...

max_completion_tokensinteger nullable

Maximum tokens in completion (newer parameter name)

max_tokensinteger nullable

Maximum tokens in completion

metadataobject nullable

Set of 16 key-value pairs that can be attached to an object. This can be usef...

modalitiesstring[] nullable

Output types that you would like the model to generate. Most models are capab...

ninteger nullable

How many chat completion choices to generate for each input message. Note tha...

parallel_tool_callsboolean nullable

Whether to enable parallel tool calls (Anthropic uses inverted polarity)

presence_penaltynumber nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on whe...

prompt_cache_keystring nullable

Used by OpenAI to cache responses for similar requests to optimize your cache...

prompt_cache_retentionstring nullable

The retention policy for the prompt cache. Set to 24h to enable extended pr...

reasoning_effortstring nullable

Constrains effort on reasoning for [reasoning models](https://platform.openai...

safety_identifierstring nullable

A stable identifier used to help detect users of your application that may be...

seedinteger nullable

Random seed for deterministic output

service_tierstring nullable

Service tier for request processing

storeboolean nullable

Whether or not to store the output of this chat completion request for use in...

streamboolean nullable

Enable streaming response

stream_optionsobject nullable

Options for streaming response. Only set this when you set stream: true.

temperaturenumber nullable

Sampling temperature (0-2 for most providers)

top_kinteger nullable

Top-k sampling parameter

top_logprobsinteger nullable

An integer between 0 and 20 specifying the number of most likely tokens to re...

top_pnumber nullable

Nucleus sampling threshold

userstring nullable

This field is being replaced by safety_identifier and prompt_cache_key. U...

verbositystring nullable

Constrains the verbosity of the model's response. Lower values will result in...

web_search_optionsobject nullable

This tool searches the web for relevant results to use in a response. Learn m...

cachedContentstring nullable

Optional. The name of the content [cached](https://ai.google.dev/gemini-api/d...

deferredboolean nullable

If set to true, the request returns a request_id. You can then get the de...

generation_configobject nullable

Generation parameters wrapper (Google-specific)

prompt_modeobject nullable

Allows toggling between the reasoning mode and no system prompt. When set to ...

safe_promptboolean nullable

Whether to inject a safety prompt before all conversations.

search_parametersobject nullable

Set the parameters to be used for searched data. If not set, no data will be ...

stop_sequencesstring[] nullable

Custom text sequences that will cause the model to stop generating. Our mode...

tool_configobject nullable

Tool calling configuration (Google-specific)

guardrailsobject[] nullable

Content filtering and safety policy configuration.

handoff_configobject nullable

Configuration for multi-model handoffs.

model_attributesobject nullable

Model attributes for routing. Maps model IDs to attribute dictionaries with values in [0.0, 1.0].

agent_attributesobject nullable

Agent attributes. Values in [0.0, 1.0].

max_turnsinteger nullable

Maximum conversation turns.

automatic_tool_executionboolean

Execute tools server-side. If false, returns raw tool calls for manual handling.

Example request

{
  "model_attributes": {
    "gpt-5": {
      "accuracy": 0.95,
      "speed": 0.6
    }
  },
  "agent_attributes": {
    "accuracy": 0.9,
    "complexity": 0.8
  },
  "max_turns": 5
}

Response

JSON or SSE stream of ChatCompletionChunk events

idstring required

A unique identifier for the chat completion.

createdinteger required

The Unix timestamp (in seconds) of when the chat completion was created.

modelstring 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' or 'priority', 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_fingerprintstring

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.

tools_executedstring[] 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_errorsobject 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.

Example response

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "The next Warriors game is tomorrow at 7:30 PM.",
        "role": "assistant"
      }
    }
  ],
  "created": 1677652288,
  "id": "chatcmpl-123",
  "model": "gpt-4o-mini",
  "object": "chat.completion",
  "tools_executed": [
    "search_events",
    "get_event_details"
  ],
  "usage": {
    "completion_tokens": 12,
    "prompt_tokens": 9,
    "total_tokens": 21
  }
}

Changes

    • breaking

      removed subschema #2 from the //// request property anyOf list

    • breaking

      removed subschema #1: Responsemodalities from the request property anyOf list

    • breaking

      removed subschema #2: Stopconfiguration from the request property anyOf list

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      the request property /// became required

    • breaking

      removed the enum value 24h of the request property /

    • breaking

      removed the enum value auto of the request property /

    • breaking

      removed the enum value auto of the request property /

    • breaking

      removed the enum value default of the request property /

    • breaking

      removed the enum value flex of the request property /

    • breaking

      removed the enum value high of the request property /

    • breaking

      removed the enum value high of the request property /

    • breaking

      removed the enum value in-memory of the request property /

    • breaking

      removed the enum value low of the request property /

    • breaking

      removed the enum value low of the request property /

    • breaking

      removed the enum value medium of the request property /

    • breaking

      removed the enum value medium of the request property /

    • breaking

      removed the enum value minimal of the request property /

    • breaking

      removed the enum value none of the request property /

    • breaking

      removed the enum value none of the request property /

    • breaking

      removed the enum value priority of the request property /

    • breaking

      removed the enum value scale of the request property /

    • breaking

      removed the enum value standard_only of the request property /

    • breaking

      request property list-of-types was narrowed by removing types string from media type application/json

    • breaking

      request property /// list-of-types was narrowed by removing types object from media type application/json

    • breaking

      request property //// list-of-types was narrowed by removing types null from media type application/json

    • breaking

      request property //// list-of-types was narrowed by removing types object from media type application/json

    • breaking

      request property /// list-of-types was narrowed by removing types null from media type application/json

    • breaking

      request property /// list-of-types was narrowed by removing types null from media type application/json

    • breaking

      request property /// list-of-types was narrowed by removing types null from media type application/json

    • breaking

      the //// request property type changed from no type to object

    • breaking

      the ///// request property type changed from object to boolean

    • breaking

      the // request property type changed from object to no type

    • breaking

      added to the //// response property oneOf list for the response status (media type: application/json)

    • warning

      the /// request property's min was set to 1024.00

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property /////

    • warning

      removed the request property //////

    • warning

      removed the request property ///

    • warning

      removed the request property ///

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added subschema #1 to the request property anyOf list

    • info

      added subschema #1 to the request property anyOf list

    • info

      the request property default value any was removed

    • info

      the request property default value auto was removed

    • info

      the request property default value content was removed

    • info

      the request property default value disabled was removed

    • info

      the request property default value enabled was removed

    • info

      the request property default value json_object was removed

    • info

      the request property default value json_schema was removed

    • info

      the request property default value none was removed

    • info

      the request property default value text was removed

    • info

      the request property default value tool was removed

    • info

      added discriminator to // request property

    • info

      added to the // request property oneOf list

    • info

      added to the /// response property anyOf list for the response status (media type: application/json)

    • info

      removed from the /// response property anyOf list for the response status (media type: application/json)

    • info

      mapped value for discriminator key custom changed from to for //// response property for the response status (media type: application/json)

    • info

      removed from the //// response property oneOf list for the response status (media type: application/json)

    • breaking

      added the new required request property ///

    • breaking

      added the new required request property ///

    • breaking

      added the new required request property ///

    • breaking

      added the new required request property ///

    • breaking

      added the new required request property ///

    • breaking

      removed from the request property anyOf list

    • breaking

      removed from the request property anyOf list

    • breaking

      removed subschema #1 from the request property anyOf list

    • breaking

      removed subschema #1 from the request property anyOf list

    • breaking

      removed subschema #1 subschema #2 from the request property anyOf list

    • breaking

      request property list-of-types was narrowed by removing types null from media type application/json

    • breaking

      request property list-of-types was narrowed by removing types object from media type application/json

    • breaking

      the / request property's max was decreased to 1.00

    • breaking

      the / request property's max was decreased to 8.00

    • breaking

      the / request property type changed from object to no type

    • breaking

      added to the //// response property oneOf list for the response status

    • warning

      the / request property's max was set to 9223372036854775808.00

    • warning

      the / request property's min was set to 0.00

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • info

      added the new optional request property

    • info

      added the new optional request property ///

    • info

      added the new optional request property ///

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added subschema #1 to the request property anyOf list

    • info

      added subschema #1 to the request property anyOf list

    • info

      added subschema #1: Messages to the request property anyOf list

    • info

      added subschema #1: Responsemodalities to the request property anyOf list

    • info

      added subschema #2 to the request property anyOf list

    • info

      the request property /// became optional

    • info

      the request property /// became optional

    • info

      the request property default value false was added

    • info

      the request property default value true was added

    • info

      the request property default value 0 was added

    • info

      the request property default value false was added

    • info

      the request property default value 1 was added

    • info

      the request property default value true was added

    • info

      the request property default value 0 was added

    • info

      the request property default value medium was added

    • info

      the request property default value auto was added

    • info

      the request property default value <|endoftext|> was added

    • info

      the request property default value false was added

    • info

      the request property default value 1 was added

    • info

      the request property default value auto was added

    • info

      the request property default value 1 was added

    • info

      the request property default value disabled was added

    • info

      the request property default value enabled was added

    • info

      the request property default value medium was added

    • info

      added discriminator to / request property

    • info

      added the new flex enum value to the request property /

    • info

      added the new minimal enum value to the request property /

    • info

      added the new none enum value to the request property /

    • info

      added the new priority enum value to the request property /

    • info

      added the new scale enum value to the request property /

    • info

      added the new standard_only enum value to the request property /

    • info

      request property list-of-types was widened by adding types string to media type application/json

    • info

      request property list-of-types was widened by adding types null to media type application/json

    • info

      added to the / request property oneOf list

    • info

      mapped value for discriminator key custom changed from to for //// response property for the response status

    • info

      mapped value for discriminator key function changed from to for //// response property for the response status

    • info

      response property choices/items/message/content list-of-types was narrowed by removing types array from media type application/json of response 200

    • info

      removed from the //// response property oneOf list for the response status