User GuideAPI ReferenceAI Applications

OpenAI Compatibility Protocol

Learn how to connect third-party clients, CLIs, scripts, and official SDKs to OpenRely via standard OpenAI protocols (including /v1/chat/completions and /v1/responses).

Protocol Overview

The OpenRely API is natively and fully compatible with the official OpenAI API protocol specifications. Over 90% of desktop clients (such as Chatbox, NextChat, Cherry Studio), terminal tools, and mainstream development libraries (such as LangChain, LlamaIndex) adopt this protocol by default.

Through the OpenAI protocol, you can not only orchestrate GPT series models, but also invoke all mainstream models like Claude and Gemini across providers, without needing to adapt to different vendor data structures.


📌 Core Connection Specifications

ParameterStandard ValueDescription
API Base URLhttps://api.openrely.ai/v1If the client automatically appends /v1, enter https://api.openrely.ai
Authentication HeadersAuthorization: Bearer sk-••••Enter your OpenRely API Key
Data FormatContent-Type: application/jsonStandard JSON request and response bodies

⚡ Core Endpoints and Request Examples

1. Chat Completions

The most classic and widely supported conversation endpoint, compatible with multi-turn conversations, streaming output, and tool calls.

  • Endpoint: POST /v1/chat/completions
  • Full URL: https://api.openrely.ai/v1/chat/completions

Request Example

curl -X POST "https://api.openrely.ai/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-••••" \
  -d '{
    "model": "gpt",
    "messages": [
      { "role": "user", "content": "Hello OpenRely!" }
    ]
  }'

Response Example

{
  "id": "chatcmpl-9xyz...",
  "object": "chat.completion",
  "created": 1725890000,
  "model": "gpt",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 9,
    "total_tokens": 19
  }
}

2. Responses API

The next-generation Responses endpoint introduced by OpenAI (e.g., used by some modern agent architectures or Codex systems).

  • Endpoint: POST /v1/responses
  • Full URL: https://api.openrely.ai/v1/responses

Request Example

curl -X POST "https://api.openrely.ai/v1/responses" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-••••" \
  -d '{
    "model": "gpt",
    "input": "Analyze current system latency"
  }'

Response Example

{
  "id": "resp-01ab...",
  "object": "response",
  "created": 1725890100,
  "model": "gpt",
  "output": [
    {
      "type": "output_text",
      "text": "Response workflow ready."
    }
  ],
  "usage": {
    "input_tokens": 12,
    "output_tokens": 19,
    "total_tokens": 31
  }
}

🛠️ Quick Integration with Clients and SDKs

from openai import OpenAI

client = OpenAI(
    base_url="https://api.openrely.ai/v1",
    api_key="sk-your-openrely-key",
)

response = client.chat.completions.create(
    model="gpt",
    messages=[{"role": "user", "content": "Hello, OpenRely!"}],
)

print(response.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.openrely.ai/v1',
  apiKey: 'sk-your-openrely-key',
});

const completion = await client.chat.completions.create({
  model: 'gpt',
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(completion.choices[0].message.content);

For CLI agents and scripts adhering to standard OpenAI environment variable specifications, simply export the variables directly:

export OPENAI_BASE_URL="https://api.openrely.ai/v1"
export OPENAI_API_KEY="sk-your-openrely-key"

Was this page helpful?

OpenAI Compatibility Protocol | OpenRely Docs