openapi: 3.1.0
info:
title: Inflection Inference Chat External API
version: 1.0.0
tags:
- name: External
paths:
/external/api/inference/openai/v1/chat/completions:
post:
summary: Legacy Chat Completions
description: 'Chat completions compatible endpoint for legacy Inflection models.
Provides a compatibility chat completions endpoint to talk with any Inflection model.'
operationId: external_openai_chat_endpoint_external_api_inference_openai_v1_chat_completions_post
security:
- OAuth2PasswordBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionRequest'
description: 'Note: This endpoint only supports a limited subset of the OpenAI chat completions parameters. Supported parameters are: ''model'', ''messages'', ''temperature'', ''max_tokens'', ''top_p'', ''tools'', ''response_format'', and ''stream''. Other OpenAI parameters like functions, function_call, n, presence_penalty, frequency_penalty, logit_bias, user, etc. are not supported.'
example:
model: Pi-3.1
messages:
- role: system
content: You are a helpful assistant.
- role: user
content: What is the weather like today?
temperature: 0.7
max_tokens: 150
top_p: 0.9
stream: true
responses:
'200':
description: 'Returns either the full response (`application/json`) or streams multiple `ChatCompletionStreamResponse` objects via `text/event-stream`. Note: The response format matches OpenAI''s schema but only includes the core fields. Advanced features like logprobs, etc. are not supported.'
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionResponse'
example:
id: cmpl-xyz789
object: chat.completion
created: 1627290155
model: Pi-3.1
choices:
- message:
role: assistant
content: The weather today is sunny with a high of 25°C.
finish_reason: stop
usage:
prompt_tokens: 13
completion_tokens: 10
total_tokens: 23
text/event-stream:
schema:
$ref: '#/components/schemas/ChatCompletionStreamResponse'
example: "data: {\n \"id\": \"chatcmpl-abc123\",\n \"object\": \"chat.completion.chunk\",\n \"created\": 1627290155,\n \"model\": \"Pi-3.1\",\n \"choices\": [\n {\n \"delta\": {\n \"role\": \"assistant\",\n \"content\": \"The weather today is sunny,\"\n },\n \"finish_reason\": null\n }\n ]\n}\n\ndata: {\n \"id\": \"chatcmpl-abc123\",\n \"object\": \"chat.completion.chunk\",\n \"created\": 1627290155,\n \"model\": \"Pi-3.1\",\n \"choices\": [\n {\n \"delta\": {\n \"content\": \" with a high of 25°C.\"\n },\n \"finish_reason\": \"stop\"\n }\n ]\n}"
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
x-code-samples:
- lang: curl Example
source: "curl --url https://api.inflection.ai/external/api/inference/openai/v1/chat/completions \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"model\": \"Pi-3.1\",\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"What is the weather like today?\"}\n ],\n \"temperature\": 0.7,\n \"max_tokens\": 150,\n \"top_p\": 0.9\n }'"
- lang: curl Example Streaming
source: "curl --url https://api.inflection.ai/external/api/inference/openai/v1/chat/completions \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"model\": \"Pi-3.1\",\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"What is the weather like today?\"}\n ],\n \"stream\": true,\n \"temperature\": 0.7,\n \"max_tokens\": 150,\n \"top_p\": 0.9\n }' --no-buffer"
tags:
- External
/external/api/inference:
post:
summary: Legacy API Inference Chat
description: Calls an Inflection model using the legacy chat API.
operationId: external_chat_external_api_inference_post
security:
- OAuth2PasswordBearer: []
parameters:
- name: origin_endpoint
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Origin Endpoint
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExternalChatBody'
example:
config: Pi-3.1
context:
- type: Instruction
text: You are a helpful assistant.
- type: Human
text: What is the weather like today?
temperature: 0.7
max_tokens: 150
web_search: false
responses:
'200':
description: Returns the chat response with text and optional tool calls
content:
application/json:
schema:
$ref: '#/components/schemas/ExternalChatResponse'
example:
created: 1627290155
text: The weather today is sunny with a high of 25°C.
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
x-code-samples:
- lang: curl Example
source: "curl --url https://api.inflection.ai/external/api/inference \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"config\": \"Pi-3.1\",\n \"context\": [\n {\"type\": \"Instruction\", \"text\": \"You are a helpful assistant.\"},\n {\"type\": \"Human\", \"text\": \"What is the weather like today?\"}\n ],\n \"temperature\": 0.7,\n \"max_tokens\": 150,\n \"web_search\": false\n }'"
tags:
- External
/external/api/inference/streaming:
post:
summary: Legacy API Streaming
description: Calls an Inflection model using the legacy chat streaming API.
operationId: external_streaming_external_api_inference_streaming_post
security:
- OAuth2PasswordBearer: []
parameters:
- name: origin_endpoint
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Origin Endpoint
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExternalChatBody'
example:
config: Pi-3.1
context:
- type: Instruction
text: You are a helpful assistant.
- type: Human
text: What is the weather like today?
temperature: 0.7
max_tokens: 150
web_search: false
responses:
'200':
description: Streams the chat response with text and optional tool calls
content:
text/event-stream:
schema:
type: string
example: "data: {\n \"created\": 1627290155,\n \"idx\": 0,\n \"text\": \"The weather today\",\n \"tool_calls\": null\n}\n\ndata: {\n \"created\": 1627290155,\n \"idx\": 1,\n \"text\": \" is sunny with a high of 25°C.\",\n \"tool_calls\": null\n}"
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
x-code-samples:
- lang: curl Example
source: "curl --url https://api.inflection.ai/external/api/inference/streaming \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"config\": \"Pi-3.1\",\n \"context\": [\n {\"type\": \"Instruction\", \"text\": \"You are a helpful assistant.\"},\n {\"type\": \"Human\", \"text\": \"What is the weather like today?\"}\n ],\n \"temperature\": 0.7,\n \"max_tokens\": 150,\n \"web_search\": false\n }' --no-buffer"
tags:
- External
components:
schemas:
ChatCompletionContentPartInputAudioParam:
properties:
input_audio:
$ref: '#/components/schemas/InputAudio'
type:
type: string
enum:
- input_audio
const: input_audio
title: Type
type: object
required:
- input_audio
- type
title: ChatCompletionContentPartInputAudioParam
PromptTokenUsageInfo:
properties:
cached_tokens:
anyOf:
- type: integer
- type: 'null'
title: Cached Tokens
additionalProperties: true
type: object
title: PromptTokenUsageInfo
Audio:
properties:
id:
type: string
title: Id
type: object
required:
- id
title: Audio
File:
properties:
file:
$ref: '#/components/schemas/FileFile'
type:
type: string
enum:
- file
const: file
title: Type
type: object
required:
- file
- type
title: File
ChatCompletionResponse:
properties:
id:
type: string
title: Id
object:
type: string
enum:
- chat.completion
const: chat.completion
title: Object
default: chat.completion
created:
type: integer
title: Created
model:
type: string
title: Model
choices:
items:
$ref: '#/components/schemas/ChatCompletionResponseChoice'
type: array
title: Choices
usage:
$ref: '#/components/schemas/UsageInfo'
prompt_logprobs:
anyOf:
- items:
anyOf:
- additionalProperties:
$ref: '#/components/schemas/Logprob'
type: object
- type: 'null'
type: array
- type: 'null'
title: Prompt Logprobs
kv_transfer_params:
anyOf:
- type: object
- type: 'null'
title: Kv Transfer Params
description: KVTransfer parameters.
system_fingerprint:
anyOf:
- type: string
- type: 'null'
title: System Fingerprint
time_info:
anyOf:
- type: object
- type: 'null'
title: Time Info
additionalProperties: true
type: object
required:
- model
- choices
- usage
title: ChatCompletionResponse
VideoURL:
properties:
url:
type: string
title: Url
type: object
required:
- url
title: VideoURL
ChatCompletionNamedToolChoiceParam:
properties:
function:
$ref: '#/components/schemas/ChatCompletionNamedFunction'
type:
type: string
enum:
- function
const: function
title: Type
default: function
additionalProperties: true
type: object
required:
- function
title: ChatCompletionNamedToolChoiceParam
ChatCompletionContentPartImageParam:
properties:
image_url:
$ref: '#/components/schemas/ImageURL'
type:
type: string
enum:
- image_url
const: image_url
title: Type
type: object
required:
- image_url
- type
title: ChatCompletionContentPartImageParam
StreamOptions:
properties:
include_usage:
anyOf:
- type: boolean
- type: 'null'
title: Include Usage
default: true
continuous_usage_stats:
anyOf:
- type: boolean
- type: 'null'
title: Continuous Usage Stats
default: false
additionalProperties: true
type: object
title: StreamOptions
StructuralTag:
properties:
begin:
type: string
title: Begin
schema:
anyOf:
- type: object
- type: 'null'
title: Schema
end:
type: string
title: End
additionalProperties: true
type: object
required:
- begin
- end
title: StructuralTag
ChatCompletionToolMessageParam:
properties:
content:
anyOf:
- type: string
- items:
$ref: '#/components/schemas/ChatCompletionContentPartTextParam'
type: array
title: Content
role:
type: string
enum:
- tool
const: tool
title: Role
tool_call_id:
type: string
title: Tool Call Id
type: object
required:
- content
- role
- tool_call_id
title: ChatCompletionToolMessageParam
ChatCompletionResponseStreamChoice:
properties:
index:
type: integer
title: Index
delta:
$ref: '#/components/schemas/DeltaMessage'
logprobs:
anyOf:
- $ref: '#/components/schemas/ChatCompletionLogProbs'
- type: 'null'
finish_reason:
anyOf:
- type: string
- type: 'null'
title: Finish Reason
stop_reason:
anyOf:
- type: integer
- type: string
- type: 'null'
title: Stop Reason
additionalProperties: true
type: object
required:
- index
- delta
title: ChatCompletionResponseStreamChoice
ChatCompletionFunctionMessageParam:
properties:
content:
anyOf:
- type: string
- type: 'null'
title: Content
name:
type: string
title: Name
role:
type: string
enum:
- function
const: function
title: Role
type: object
required:
- content
- name
- role
title: ChatCompletionFunctionMessageParam
ChatCompletionSystemMessageParam:
properties:
content:
anyOf:
- type: string
- items:
$ref: '#/components/schemas/ChatCompletionContentPartTextParam'
type: array
title: Content
role:
type: string
enum:
- system
const: system
title: Role
name:
type: string
title: Name
type: object
required:
- content
- role
title: ChatCompletionSystemMessageParam
Custom:
properties:
input:
type: string
title: Input
name:
type: string
title: Name
type: object
required:
- input
- name
title: Custom
DeltaMessage:
properties:
role:
anyOf:
- type: string
- type: 'null'
title: Role
content:
anyOf:
- type: string
- type: 'null'
title: Content
reasoning_content:
anyOf:
- type: string
- type: 'null'
title: Reasoning Content
tool_calls:
items:
$ref: '#/components/schemas/DeltaToolCall'
type: array
title: Tool Calls
additionalProperties: true
type: object
title: DeltaMessage
ChatMessage:
properties:
role:
type: string
title: Role
reasoning_content:
anyOf:
- type: string
- type: 'null'
title: Reasoning Content
content:
anyOf:
- type: string
- type: 'null'
title: Content
tool_calls:
items:
$ref: '#/components/schemas/ToolCall'
type: array
title: Tool Calls
additionalProperties: true
type: object
required:
- role
title: ChatMessage
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ChatCompletionContentPartTextParam:
properties:
text:
type: string
title: Text
type:
type: string
enum:
- text
const: text
title: Type
type: object
required:
- text
- type
title: ChatCompletionContentPartTextParam
ExternalMetadata:
properties:
user_timezone:
anyOf:
- type: string
- type: 'null'
title: User Timezone
user_firstname:
anyOf:
- type: string
- type: 'null'
title: User Firstname
user_country:
anyOf:
- type: string
- type: 'null'
title: User Country
user_region:
anyOf:
- type: string
- type: 'null'
title: User Region
user_city:
anyOf:
- type: string
- type: 'null'
title: User City
additionalProperties: true
type: object
title: ExternalMetadata
AudioURL:
properties:
url:
type: string
title: Url
type: object
required:
- url
title: AudioURL
ResponseFormat:
properties:
type:
type: string
enum:
- text
- json_object
- json_schema
title: Type
json_schema:
anyOf:
- $ref: '#/components/schemas/JsonSchemaResponseFormat'
- type: 'null'
additionalProperties: true
type: object
required:
- type
title: ResponseFormat
ExternalChatBody:
properties:
context:
items:
$ref: '#/components/schemas/ExternalTurn'
type: array
title: Context
config:
type: string
title: Config
default: placeholder
metadata:
anyOf:
- $ref: '#/components/schemas/ExternalMetadata'
- type: 'null'
temperature:
anyOf:
- type: number
- type: 'null'
title: Temperature
stop_tokens:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Stop Tokens
max_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Tokens
top_p:
anyOf:
- type: number
- type: 'null'
title: Top P
web_search:
type: boolean
title: Web Search
default: true
tools:
anyOf:
- items:
$ref: '#/components/schemas/ChatCompletionToolsParam'
type: array
- type: 'null'
title: Tools
default: []
server_target:
anyOf:
- type: string
- type: 'null'
title: Server Target
response_format:
anyOf:
- $ref: '#/components/schemas/ResponseFormat'
- $ref: '#/components/schemas/StructuralTagResponseFormat'
- type: 'null'
title: Response Format
schemas:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Schemas
additionalProperties: true
type: object
required:
- context
title: ExternalChatBody
ChatCompletionNamedFunction:
properties:
name:
type: string
title: Name
additionalProperties: true
type: object
required:
- name
title: ChatCompletionNamedFunction
ChatCompletionUserMessageParam:
properties:
content:
anyOf:
- type: string
- items:
anyOf:
- $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
- $ref: '#/components/schemas/ChatCompletionContentPartImageParam'
- $ref: '#/components/schemas/ChatCompletionContentPartInputAudioParam'
- $ref: '#/components/schemas/File'
type: array
title: Content
role:
type: string
enum:
- user
const: user
title: Role
name:
type: string
title: Name
type: object
required:
- content
- role
title: ChatCompletionUserMessageParam
CustomChatCompletionMessageParam:
properties:
role:
type: string
title: Role
content:
anyOf:
- type: string
- items:
anyOf:
- $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
- $ref: '#/components/schemas/ChatCompletionContentPartImageParam'
- $ref: '#/components/schemas/ChatCompletionContentPartInputAudioParam'
- $ref: '#/components/schemas/File'
- $ref: '#/components/schemas/ChatCompletionContentPartAudioParam'
- $ref: '#/components/schemas/ChatCompletionContentPartVideoParam'
- $ref: '#/components/schemas/ChatCompletionContentPartRefusalParam'
- $ref: '#/components/schemas/CustomChatCompletionContentSimpleImageParam'
- $ref: '#/components/schemas/ChatCompletionContentPartImageEmbedsParam'
- $ref: '#/components/schemas/CustomChatCompletionContentSimpleAudioParam'
- $ref: '#/components/schemas/CustomChatCompletionContentSimpleVideoParam'
- type: string
type: array
title: Content
name:
type: string
title: Name
tool_call_id:
anyOf:
- type: string
- type: 'null'
title: Tool Call Id
tool_calls:
anyOf:
- items:
$ref: '#/components/schemas/ChatCompletionMessageFunctionToolCallParam'
type: array
- type: 'null'
title: Tool Calls
type: object
required:
- role
title: CustomChatCompletionMessageParam
description: Enables custom roles in the Chat Completion API.
BaseModel:
properties: {}
type: object
title: BaseModel
LogitsProcessorConstructor:
properties:
qualname:
type: string
title: Qualname
args:
anyOf:
- items: {}
type: array
- type: 'null'
title: Args
kwargs:
anyOf:
- type: object
- type: 'null'
title: Kwargs
additionalProperties: false
type: object
required:
- qualname
title: LogitsProcessorConstructor
Logprob:
properties:
logprob:
type: number
title: Logprob
rank:
anyOf:
- type: integer
- type: 'null'
title: Rank
decoded_token:
anyOf:
- type: string
- type: 'null'
title: Decoded Token
type: object
required:
- logprob
title: Logprob
DeltaFunctionCall:
properties:
name:
anyOf:
- type: string
- type: 'null'
title: Name
arguments:
anyOf:
- type: string
- type: 'null'
title: Arguments
type: object
title: DeltaFunctionCall
FileFile:
properties:
file_data:
type: string
title: File Data
file_id:
type: string
title: File Id
filename:
type: string
title: Filename
type: object
title: FileFile
DeltaToolCall:
properties:
id:
anyOf:
- type: string
- type: 'null'
title: Id
type:
anyOf:
- type: string
enum:
- function
const: function
- type: 'null'
title: Type
index:
type: integer
title: Index
function:
anyOf:
- $ref: '#/components/schemas/DeltaFunctionCall'
- type: 'null'
additionalProperties: true
type: object
required:
- index
title: DeltaToolCall
ChatCompletionToolsParam:
properties:
type:
type: string
enum:
- function
const: function
title: Type
default: function
function:
$ref: '#/components/schemas/FunctionDefinition'
additionalProperties: true
type: object
required:
- function
title: ChatCompletionToolsParam
FunctionCall-Output:
properties:
name:
type: string
title: Name
arguments:
type: string
title: Arguments
additionalProperties: true
type: object
required:
- name
- arguments
title: FunctionCall
ChatCompletionRequest:
properties:
messages:
items:
anyOf:
- $ref: '#/components/schemas/ChatCompletionDeveloperMessageParam'
- $ref: '#/components/schemas/ChatCompletionSystemMessageParam'
- $ref: '#/components/schemas/ChatCompletionUserMessageParam'
- $ref: '#/components/schemas/ChatCompletionAssistantMessageParam'
- $ref: '#/components/schemas/ChatCompletionToolMessageParam'
- $ref: '#/components/schemas/ChatCompletionFunctionMessageParam'
- $ref: '#/components/schemas/CustomChatCompletionMessageParam'
type: array
title: Messages
model:
anyOf:
- type: string
- type: 'null'
title: Model
frequency_penalty:
anyOf:
- type: number
- type: 'null'
title: Frequency Penalty
default: 0.0
logit_bias:
anyOf:
- additionalProperties:
type: number
type: object
- type: 'null'
title: Logit Bias
logprobs:
anyOf:
- type: boolean
- type: 'null'
title: Logprobs
default: false
top_logprobs:
anyOf:
- type: integer
- type: 'null'
title: Top Logprobs
default: 0
max_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Tokens
deprecated: true
max_completion_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Completion Tokens
n:
anyOf:
- type: integer
- type: 'null'
title: N
default: 1
presence_penalty:
anyOf:
- type: number
- type: 'null'
title: Presence Penalty
default: 0.0
response_format:
anyOf:
- $ref: '#/components/schemas/ResponseFormat'
- $ref: '#/components/schemas/StructuralTagResponseFormat'
- type: 'null'
title: Response Format
seed:
anyOf:
- type: integer
maximum: 4294967295.0
minimum: 0.0
- type: 'null'
title: Seed
stop:
anyOf:
- type: string
- items:
type: string
type: array
- type: 'null'
title: Stop
default: []
stream:
anyOf:
- type: boolean
- type: 'null'
title: Stream
default: false
stream_options:
anyOf:
- $ref: '#/components/schemas/StreamOptions'
- type: 'null'
temperature:
anyOf:
- type: number
- type: 'null'
title: Temperature
top_p:
anyOf:
- type: number
- type: 'null'
title: Top P
tools:
anyOf:
- items:
$ref: '#/components/schemas/ChatCompletionToolsParam'
type: array
- type: 'null'
title: Tools
tool_choice:
anyOf:
- type: string
enum:
- none
const: none
- type: string
enum:
- auto
const: auto
- type: string
enum:
- required
const: required
- $ref: '#/components/schemas/ChatCompletionNamedToolChoiceParam'
- type: 'null'
title: Tool Choice
default: none
parallel_tool_calls:
anyOf:
- type: boolean
- type: 'null'
title: Parallel Tool Calls
default: false
user:
anyOf:
- type: string
- type: 'null'
title: User
best_of:
anyOf:
- type: integer
- type: 'null'
title: Best Of
use_beam_search:
type: boolean
title: Use Beam Search
default: false
top_k:
anyOf:
- type: integer
- type: 'null'
title: Top K
min_p:
anyOf:
- type: number
- type: 'null'
title: Min P
repetition_penalty:
anyOf:
- type: number
- type: 'null'
title: Repetition Penalty
length_penalty:
type: number
title: Length Penalty
default: 1.0
stop_token_ids:
anyOf:
- items:
type: integer
type: array
- type: 'null'
title: Stop Token Ids
default: []
include_stop_str_in_output:
type: boolean
title: Include Stop Str In Output
default: false
ignore_eos:
type: boolean
title: Ignore Eos
default: false
min_tokens:
type: integer
title: Min Tokens
default: 0
skip_special_tokens:
type: boolean
title: Skip Special Tokens
default: true
spaces_between_special_tokens:
type: boolean
title: Spaces Between Special Tokens
default: true
truncate_prompt_tokens:
anyOf:
- type: integer
minimum: 1.0
- type: 'null'
title: Truncate Prompt Tokens
prompt_logprobs:
anyOf:
- type: integer
- type: 'null'
title: Prompt Logprobs
allowed_token_ids:
anyOf:
- items:
type: integer
type: array
- type: 'null'
title: Allowed Token Ids
bad_words:
items:
type: string
type: array
title: Bad Words
echo:
type: boolean
title: Echo
description: If true, the new message will be prepended with the last message if they belong to the same role.
default: false
add_generation_prompt:
type: boolean
title: Add Generation Prompt
description: If true, the generation prompt will be added to the chat template. This is a parameter used by chat template in tokenizer config of the model.
default: true
continue_final_message:
type: boolean
titl
# --- truncated at 32 KB (53 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/inflection/refs/heads/main/openapi/inflection-external-api-openapi.yml