Pinter
ENID
OpenAI Proxy
Lihat sebagai Markdown

OpenAI-Compatible Chat Completions Proxy Endpoint

POST/api/agents/openai/v1/chat/completions

Overview

100% OpenAI API compatible proxy endpoint. Allows standard OpenAI SDKs (openai-python, openai-node), Cursor, LangChain, and third-party tools to interact with Pinter agents seamlessly.

Authentication & Headers

  • Auth: Bearer Token or Developer API Key (Authorization: Bearer <api_key>)
  • Required Header: API-Version: 1

Parameters & Request Body Fields

  • model (string, required): Target agent UUID or virtual model ID.
  • messages (array of message objects, required): Chat history containing role (user, assistant, system) and content.
  • temperature (number, optional): Sampling temperature.
  • stream (boolean, optional, default: false): Set to true for OpenAI-compatible streaming chunks.

Body permintaan

application/json

modelstringwajib
messagesobject[]wajib
messages[].rolestringwajib
messages[].contentobject
messages[].namestring | null
messages[].tool_callsobject[] | null
messages[].tool_call_idstring | null
streamboolean
temperaturenumber | null
max_tokensinteger | null
top_pnumber | null
ninteger | null
stopobject | null
presence_penaltynumber | null
frequency_penaltynumber | null
userstring | null
toolsobject[] | null
tool_choiceobject | null
response_formatobject | null
{
  "model": "string",
  "messages": [
    {
      "role": "string",
      "content": null,
      "name": "string",
      "tool_calls": [
        null
      ],
      "tool_call_id": "string"
    }
  ],
  "stream": false,
  "temperature": 0,
  "max_tokens": 0,
  "top_p": 0,
  "n": 0,
  "stop": null,
  "presence_penalty": 0,
  "frequency_penalty": 0,
  "user": "string",
  "tools": [
    null
  ],
  "tool_choice": null,
  "response_format": {}
}

Respons

200 Standard OpenAI ChatCompletion response structure

400 Bad Request - The request parameters or headers are invalid (e.g. unsupported API-Version).

401 Unauthorized - Missing, invalid, or expired JWT Bearer token.

403 Forbidden - Insufficient role permissions or resource access denied by RBAC policy.

404 Not Found - The requested resource ID was not found.

422 Validation Error

detailobject[]
detail[].locstring | integer[]wajib
detail[].msgstringwajib
detail[].typestringwajib
detail[].inputobject
detail[].ctxobject
{
  "detail": [
    {
      "loc": [
        null
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Contoh

curl -X POST "$PINTER_URL/api/agents/openai/v1/chat/completions" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"string","messages":[{"role":"string","content":null,"name":"string","tool_calls":[null],"tool_call_id":"string"}],"stream":false,"temperature":0,"max_tokens":0,"top_p":0,"n":0,"stop":null,"presence_penalty":0,"frequency_penalty":0,"user":"string","tools":[null],"tool_choice":null,"response_format":{}}'