INTEGRATION GUIDE

AI API integration guide: base URLs, keys, and three request formats

Create or retrieve an API key from the account entry, then send a first request through OpenAI Chat Completions, OpenAI Responses, or Anthropic Messages. Every example reads the key from an environment variable.

01 · SETUP

Create or retrieve an API key

Open https://relai.vip/login, use the account flow, and create or retrieve the API key for requests. Never put the key in frontend code, a public repository, logs, or screenshots.

Environment variables
export RELAI_API_KEY="your-key-from-account"
export RELAI_BASE_URL="https://relai.vip/v1"
export RELAI_ANTHROPIC_BASE_URL="https://relai.vip"

02 · BASE URL

Choose an endpoint by request format

OpenAI-compatiblehttps://relai.vip/v1

Chat Completions: /chat/completions
Responses: /responses

Anthropichttps://relai.vip

Messages: /v1/messages

03 · REQUESTS

Three minimal request formats

OpenAI Chat Completions

POST https://relai.vip/v1/chat/completions
curl "$RELAI_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $RELAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "messages": [{"role": "user", "content": "Reply with one short sentence."}]
  }' 

OpenAI Responses

POST https://relai.vip/v1/responses
curl "$RELAI_BASE_URL/responses" \
  -H "Authorization: Bearer $RELAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "input": "Reply with one short sentence."
  }' 

Anthropic Messages

POST https://relai.vip/v1/messages
curl "$RELAI_ANTHROPIC_BASE_URL/v1/messages" \
  -H "x-api-key: $RELAI_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 64,
    "messages": [{"role": "user", "content": "Reply with one short sentence."}]
  }' 

04 · TROUBLESHOOTING

Troubleshooting 401, 429, and 5xx

401

Check the key, Authorization / x-api-key headers, and account state. Do not retry 401 automatically.

429

Use bounded exponential backoff and retain request IDs.

5xx

Keep the response and request ID, use bounded backoff, and do not repeat a write that may already have executed.

05 · LIMITS

Compatibility boundaries

The service provides OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages request formats. Whether a specific model supports a format, parameter, context length, or response shape must be confirmed in the live model plaza and with a real request. “OpenAI-compatible” does not mean identical to the official API.

Pre-launch checks

Validate authentication, model IDs, request formats, error handling, and timeouts before production traffic. Check the signed-in model plaza for prices and group availability.

FAQ

Frequently asked questions

Which base URL should OpenAI-compatible requests use?

Use https://relai.vip/v1 as the base URL. For example, the full Chat Completions path is https://relai.vip/v1/chat/completions.

Which base URL should Anthropic Messages use?

Use https://relai.vip as the Anthropic SDK base URL. The Messages request path is https://relai.vip/v1/messages.

Which three request formats are supported?

OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages are supported. Whether a particular model supports a particular format must be confirmed in the live model plaza and by an actual request.

Does “OpenAI-compatible” mean identical to the official API?

No. It means the request entry follows the relevant API format. Model implementations, routing, supported parameters, context limits, and responses may still differ. Validate the target model with a real request before launch.

How should 401, 429, or 5xx responses be handled?

For 401, check the key, request headers, and account state; do not retry automatically. For 429 and 5xx, use bounded exponential backoff and retain request IDs. Do not repeatedly submit a write or tool action that may already have executed.