curl --request POST \
--url https://api.edgee.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5.2",
"messages": [
{
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_call_id": "<string>",
"refusal": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"cache_control": {
"type": "ephemeral"
}
}
],
"max_tokens": 2,
"stream": false,
"stream_options": {
"include_usage": true
},
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"tool_choice": "none",
"edgee_tool_ids": [
"edgee_current_time",
"edgee_generate_uuid"
],
"edgee_pending_id": "<string>",
"tags": [
"<string>"
],
"enable_debug": true,
"compression_model": "claude"
}
'{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "openai/gpt-5.2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"compression": {
"saved_tokens": 450,
"cost_savings": 27000,
"reduction": 48.99884991374353,
"time_ms": 12
}
}Create chat completions using the OpenAI Chat Completion API format
curl --request POST \
--url https://api.edgee.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5.2",
"messages": [
{
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_call_id": "<string>",
"refusal": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"cache_control": {
"type": "ephemeral"
}
}
],
"max_tokens": 2,
"stream": false,
"stream_options": {
"include_usage": true
},
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"tool_choice": "none",
"edgee_tool_ids": [
"edgee_current_time",
"edgee_generate_uuid"
],
"edgee_pending_id": "<string>",
"tags": [
"<string>"
],
"enable_debug": true,
"compression_model": "claude"
}
'{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "openai/gpt-5.2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"compression": {
"saved_tokens": 450,
"cost_savings": 27000,
"reduction": 48.99884991374353,
"time_ms": 12
}
}Creates a completion for the chat message. The Edgee API is OpenAI-compatible and works with any model and provider. Supports both streaming and non-streaming responses.Documentation Index
Fetch the complete documentation index at: https://www.edgee.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Comma-separated list of tags for categorizing and filtering requests in analytics and logs. Example: production,chatbot,customer-support
Enable debug mode to include additional debugging information in the response.
Compression bundle to apply. Tunes the compressor for the agentic style of the calling client.
claude, opencode, cursor, codex ID of the model to use. Format: {author_id}/{model_id} (e.g. openai/gpt-5.2)
"openai/gpt-5.2"
A list of messages comprising the conversation so far.
1Show child attributes
The maximum number of tokens that can be generated in the chat completion.
x >= 1If set, partial message deltas will be sent, as in OpenAI. Streamed chunks are sent as Server-Sent Events (SSE).
Options for streaming response.
Show child attributes
A list of tools the model may call. Currently, only function type is supported.
Show child attributes
Controls which tool (if any) the model is allowed to call. Accepts a bare string (none / auto), a typed-mode object ({ "type": "auto" | "none" }), or a specific function reference.
none, auto List of Edge Tool IDs to inject (e.g. edgee_current_time, edgee_generate_uuid). Each ID must be activated for your API key. When omitted or empty, only tools with hydration enabled for your org or API key are auto-injected. Invalid or non-activated IDs return 400 with invalid_edgee_tool_ids.
["edgee_current_time", "edgee_generate_uuid"]Pending operation ID when continuing a conversation after Edge Tool execution (e.g. when mixing client-side and Edge Tools). The gateway injects stored Edge Tool results into the message history.
Optional tags to categorize and label the request. Useful for filtering and grouping requests in analytics and logs. Can also be sent via the x-edgee-tags header as a comma-separated string.
When true, the response includes additional debug information. Equivalent to the X-Edgee-Debug header.
Selects the compression bundle to apply to the request. Equivalent to the X-Edgee-Compression-Model header.
claude, opencode, codex, cursor Chat completion created successfully
A unique identifier for the chat completion.
"chatcmpl-123"
The object type, which is always chat.completion.
chat.completion The Unix timestamp (in seconds) of when the chat completion was created.
1677652288
The model used for the chat completion.
"openai/gpt-5.2"
A list of chat completion choices. Can be more than one if n is greater than 1.
Show child attributes
Usage statistics for the completion. In streaming responses, this is only present in the final chunk when stream_options.include_usage is true.
Show child attributes
Token compression metrics. Present in the response when token compression was applied to the request. The usage.prompt_tokens field reflects the compressed token count actually billed by the provider.
Show child attributes
Present when one or more Edge Tool calls were deferred. Pass this value back as edgee_pending_id in the next request to resume the conversation with the tool results filled in.
List of Edge Tools the gateway executed inline before returning. Empty or absent when no Edge Tools ran.
Show child attributes
Was this page helpful?