Create Chat Completion
Creates a model response for the given chat conversation. All requests are TEE-protected.Request Body
Parameter | Type | Required | Description |
---|---|---|---|
model | string | Yes | Model ID (e.g., gpt-4 , phala/qwen-2.5-7b-instruct ) |
messages | array | Yes | Array of message objects |
temperature | number | No | Sampling temperature (0-2), default 1 |
max_tokens | integer | No | Maximum tokens to generate |
stream | boolean | No | Stream responses, default false |
top_p | number | No | Nucleus sampling (0-1) |
n | integer | No | Number of completions, default 1 |
stop | string/array | No | Stop sequences |
presence_penalty | number | No | Presence penalty (-2 to 2) |
frequency_penalty | number | No | Frequency penalty (-2 to 2) |
tools | array | No | Function calling tools |
tool_choice | string/object | No | Control tool usage |
response_format | object | No | Output format ({"type": "json_object"} ) |
Message Object
Example Requests
Response
Streaming
Enablestream: true
for real-time responses:
Vision (Multimodal)
Use vision models with images:Function Calling
Define tools/functions for the model to call:Function Calling Guide
Learn more about function calling →
Error Handling
Supported Models
- OpenAI:
gpt-4-turbo
,gpt-4
,gpt-3.5-turbo
- Anthropic:
anthropic/claude-3.5-sonnet
- Google:
google/gemini-1.5-pro
- Meta:
meta-llama/llama-3.3-70b-instruct
- Phala TEE:
phala/deepseek-chat-v3-0324
- +200 more models
All Models
View all 218+ supported models →