Skip to main content
POST
/
chat
/
completions
Create chat completion
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    model: '<string>',
    messages: [
      {
        role: 'system',
        content: '<string>',
        name: '<string>',
        tool_calls: [
          {
            id: '<string>',
            type: 'function',
            function: {
              name: '<string>',
              arguments: '<string>',
              description: '<string>',
              parameters: {}
            }
          }
        ],
        tool_call_id: '<string>'
      }
    ],
    system: '<string>',
    reasoning: {
      effort: 'medium',
      summary: 'auto',
      enabled: true,
      max_tokens: 1,
      include_thoughts: true,
      includeThoughts: true
    },
    frequency_penalty: 0,
    logit_bias: {},
    max_output_tokens: 2,
    max_completion_tokens: 2,
    max_tokens: 2,
    meta: false,
    debug: {
      enabled: true,
      return_upstream_request: true,
      return_upstream_response: true,
      trace: true,
      trace_level: 'summary'
    },
    presence_penalty: 0,
    seed: 0,
    stream: false,
    stream_options: {},
    temperature: 1,
    tools: [{type: 'function'}],
    max_tool_calls: 2,
    parallel_tool_calls: true,
    tool_choice: '<string>',
    top_k: 2,
    logprobs: false,
    top_logprobs: 10,
    top_p: 0.5,
    response_format: '<string>',
    modalities: ['<string>'],
    response_modalities: ['<string>'],
    responseModalities: ['<string>'],
    image_config: {
      aspect_ratio: '<string>',
      aspectRatio: '<string>',
      image_size: '0.5K',
      imageSize: '0.5K',
      include_rai_reason: true,
      includeRaiReason: true,
      font_inputs: [{font_url: '<string>', text: '<string>'}],
      fontInputs: [{fontUrl: '<string>', text: '<string>'}],
      super_resolution_references: ['<string>'],
      superResolutionReferences: ['<string>'],
      reference_images: [{}],
      referenceImages: [{}]
    },
    imageConfig: {
      aspect_ratio: '<string>',
      aspectRatio: '<string>',
      image_size: '0.5K',
      imageSize: '0.5K',
      include_rai_reason: true,
      includeRaiReason: true,
      font_inputs: [{font_url: '<string>', text: '<string>'}],
      fontInputs: [{fontUrl: '<string>', text: '<string>'}],
      super_resolution_references: ['<string>'],
      superResolutionReferences: ['<string>'],
      reference_images: [{}],
      referenceImages: [{}]
    },
    thinking: {
      type: 'enabled',
      enabled: true,
      include_thoughts: true,
      includeThoughts: true,
      effort: 'none',
      max_tokens: 1,
      maxTokens: 1,
      budget_tokens: 1,
      budgetTokens: 1
    },
    usage: true,
    provider: {
      order: ['<string>'],
      only: ['<string>'],
      ignore: ['<string>'],
      include_alpha: true
    },
    user_id: '<string>',
    user: '<string>',
    service_tier: 'standard',
    speed: '<string>'
  })
};

fetch('https://api.phaseo.app/v1/chat/completions', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "system",
        "content": "<string>",
        "name": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "type": "function",
            "function": {
              "name": "<string>",
              "arguments": "<string>",
              "description": "<string>",
              "parameters": {}
            }
          }
        ],
        "tool_call_id": "<string>"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer token authentication

Body

application/json
model
string
required
messages
object[]
required
Minimum array length: 1
system
string
reasoning
object
frequency_penalty
number
Required range: -2 <= x <= 2
logit_bias
object
max_output_tokens
integer
Required range: x >= 1
max_completion_tokens
integer
Required range: x >= 1
max_tokens
integer
Required range: x >= 1
meta
boolean
default:false
debug
object

Gateway debug controls. These flags are never forwarded upstream.

presence_penalty
number
Required range: -2 <= x <= 2
seed
integer
Required range: -9223372036854776000 <= x <= 9223372036854776000
stream
boolean
default:false
stream_options
object
temperature
number
default:1
Required range: 0 <= x <= 2
tools
object[]
max_tool_calls
integer
Required range: x >= 1
parallel_tool_calls
boolean
default:true
tool_choice
top_k
integer
Required range: x >= 1
logprobs
boolean
default:false
top_logprobs
integer
Required range: 0 <= x <= 20
top_p
number
Required range: 0 <= x <= 1
response_format
modalities
string[]
response_modalities
string[]
responseModalities
string[]
image_config
object
imageConfig
object
thinking
object
usage
boolean
provider
object

Provider routing preferences for gateway selection.

user_id
string
user
string
service_tier
enum<string>
default:standard
Available options:
auto,
default,
flex,
standard,
priority
speed
string

Response

200 - application/json

Chat completion response

id
string
object
string
created
integer
model
string
choices
object[]
usage
object
Last modified on December 12, 2025