Skip to main content

Overview

The proxy chat completions endpoint provides OpenAI-compatible chat completions with additional features like authentication, rate limiting, budgets, and centralized logging.

Endpoint

Alternate routes:
  • POST /chat/completions
  • POST /engines/{model}/chat/completions
  • POST /openai/deployments/{model}/chat/completions

Authentication

string
required
Bearer token for authentication.

Request Headers

string
default:"application/json"
Content type of the request body.
string
Team ID for team-based access control.
string
JSON stringified metadata for request tracking.
string
End-user ID for tracking and analytics.
string
Comma-separated tags for request categorization.

Request Body

The request body follows the OpenAI chat completions format:
string
required
Model to use for completion.
array
required
Array of message objects.
number
Sampling temperature (0-2).
integer
Maximum tokens to generate.
boolean
default:"false"
Whether to stream the response.
array
Tools available for function calling.
See completion() API for all available parameters.

Response

Success Response (200)

string
Unique identifier for the completion.
string
Object type (“chat.completion” or “chat.completion.chunk” for streaming).
integer
Unix timestamp of creation.
string
Model used for the completion.
array
Array of completion choices.
object
Token usage information.

Error Responses

Invalid or missing authentication token.
Rate limit exceeded.
Invalid request parameters.

Examples

Basic Request

Python Request

Streaming Request

With Metadata

Function Calling

Proxy-Specific Features

Budget Tracking

The proxy automatically tracks spending against key/team budgets:

Rate Limiting

Keys can have TPM (tokens per minute) and RPM (requests per minute) limits:

Model Aliases

Use proxy-defined model aliases:

Automatic Retries & Fallbacks

Proxy handles retries and fallbacks automatically:

Monitoring & Logging

All requests are logged with:
  • Request/response details
  • Token usage
  • Costs
  • Latency
  • Errors
  • User/team information
  • Custom metadata
Access logs through:
  • Admin UI at /ui
  • Spend tracking endpoints
  • Custom callback integrations