#AI Router

A single OpenAI-compatible API for working with language models from different providers. Free Bitrix24 models are available right away — for paid models and your own provider keys (BYOK), connect your credentials.

This is an API, not a portal chat. There is no dialog window for talking to a model in the VibeCode portal — do not look for one. The request (prompt) is entered in your AI tool, agent, or code (Cursor, an IDE agent, the openai library, your own application), which calls this API at the address below. Free Bitrix24 models work the same way as paid and BYOK models — through the same API.

Scope: vibe:ai (added automatically to all API keys) | Base URL: https://vibecode.bitrix24.tech/v1 | Authorization: X-Api-Key header or Authorization: Bearer YOUR_API_KEY

#OpenAI SDK compatibility

All responses are returned in raw OpenAI format. Connect any OpenAI-compatible tool (Cursor, IDE agents, the openai library) via the standard settings:

Base URL: https://vibecode.bitrix24.tech/v1
API Key:  your vibe_api_... or vibe_app_... key

By default the SDK passes the key in the Authorization: Bearer header — VibeCode accepts both options (X-Api-Key and Authorization: Bearer). The request parameters (model, messages, temperature, tools, stream, response_format) and response fields (id, choices, usage) match the POST /v1/chat/completions contract from the OpenAI API.

#Documentation sections


#Quick start

#1. Generate a response with a free model

Terminal
curl -X POST https://vibecode.bitrix24.tech/v1/chat/completions \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bitrix/bitrixgpt-5.5",
    "messages": [{"role": "user", "content": "What is CRM?"}]
  }'

Response:

JSON
{
  "id": "chatcmpl-a1a73c6eb3f180fd",
  "object": "chat.completion",
  "created": 1777289339,
  "model": "bitrix/bitrixgpt-5.5",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "CRM is a customer relationship management system."
      }
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 18,
    "total_tokens": 30
  }
}

#2. View the available models

Terminal
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://vibecode.bitrix24.tech/v1/models

Returns only the models for which the portal has provider credentials configured. Bitrix24 models (bitrix/*) are available to everyone without separate BYOK keys; most of them are free.

#3. Check token consumption

Terminal
curl -H "X-Api-Key: YOUR_API_KEY" \
  "https://vibecode.bitrix24.tech/v1/ai/usage?days=7"

#Common use cases


#Full example: call transcription → classification → timeline entry

Scenario: get a call recording, transcribe it via Whisper, classify the lead quality via the model's JSON response, write the result into the deal timeline.

#Step 1. Speech recognition

Terminal
curl -X POST https://vibecode.bitrix24.tech/v1/audio/transcriptions \
  -H "X-Api-Key: YOUR_API_KEY" \
  -F "file=@call-recording.mp3" \
  -F "language=ru" \
  -F "response_format=json"

Response:

JSON
{
  "text": "Hello, Vector LLC here. We want CRM for 50 users, budget up to 500 thousand per month."
}

#Step 2. Lead classification with guaranteed `JSON`

Terminal
curl -X POST https://vibecode.bitrix24.tech/v1/chat/completions \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bitrix/bitrixgpt-5.5",
    "messages": [
      {
        "role": "system",
        "content": "Classify the lead from the call text. Return JSON: {\"quality\": \"high|medium|low\", \"score\": 0-100, \"reason\": \"...\"}."
      },
      {
        "role": "user",
        "content": "Vector LLC. CRM for 50 users, budget up to 500 thousand per month."
      }
    ],
    "response_format": {"type": "json_object"}
  }'

Response:

JSON
{
  "id": "chatcmpl-acdb112cf9cdf9f9",
  "object": "chat.completion",
  "model": "bitrix/bitrixgpt-5.5",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "{\"quality\":\"high\",\"score\":88,\"reason\":\"Legal entity, specific volume (50 users) and budget of 500 thousand per month.\"}"
      }
    }
  ],
  "usage": {"prompt_tokens": 92, "completion_tokens": 36, "total_tokens": 128}
}

#Step 3. Write the result into the deal timeline

Parse choices[0].message.content as JSON and send it to the timeline:

Terminal
curl -X POST https://vibecode.bitrix24.tech/v1/timeline-logs \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "entityType": "deal",
    "entityId": 1234,
    "title": "AI classification: high (88/100)",
    "text": "Legal entity, specific volume (50 users) and budget of 500 thousand per month."
  }'

All three endpoints live under one API key and one authorization — no separate integrations are required.


#Endpoint reference

Method Path Description
POST `/v1/chat/completions` Generate a model response — synchronously or as a stream
GET `/v1/models` List of available models
GET `/v1/models/:modelId` Details of a specific model
POST `/v1/audio/transcriptions` Speech recognition via Whisper
GET `/v1/ai/usage` AI usage statistics per key
GET `/v1/ai/providers` List of providers for BYOK
GET `/v1/ai/credentials` List of your own provider keys
POST `/v1/ai/credentials` Connect a provider key (with verification)
PATCH `/v1/ai/credentials/:id` Update a provider key
DELETE `/v1/ai/credentials/:id` Delete a provider key
POST `/v1/ai/credentials/:id/test` Test a provider key
GET `/v1/ai/credentials/:id/usage` Usage statistics per key
POST `/v1/ai/credentials/:id/fetch-models` Load the model catalog from a Custom provider
GET `/v1/ai/credentials/:id/models` List of models bound to a key
POST `/v1/ai/credentials/:id/models` Add a model to a key manually
DELETE `/v1/ai/credentials/:credId/models/:modelRowId` Delete a model bound to a key

#Error codes

Endpoints fall into two groups by error response format:

Raw OpenAI format (/v1/chat/completions, /v1/models, /v1/audio/transcriptions):

JSON
{
  "error": {
    "message": "...",
    "type": "invalid_request_error",
    "code": "ai_model_not_found"
  }
}

type takes the values: invalid_request_error (4xx), insufficient_quota (402), service_unavailable (503), server_error (5xx). code is always lowercase.

V1 format (/v1/ai/usage, /v1/ai/credentials/*, /v1/ai/providers):

JSON
{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Credential not found"
  }
}
Code HTTP Description
scope_missing 403 The API key is missing the vibe:ai scope
invalid_request 400 Invalid request parameters
no_default_model 400 No default model is configured — specify model explicitly
invalid_image_payload 400 Invalid image_url in the content array
invalid_language 400 Language code does not match ISO 639
no_file 400 No audio file was provided
empty_file 400 A file is present in the multipart, but the body is 0 bytes (common cause: curl -F "file=path" without @)
ai_model_not_found 404 Model not found or disabled
not_found 404 Entity (BYOK key, model) not found
provider_not_found 404 Provider not found or disabled
ai_credentials_not_configured 402 No provider credentials for the model — connect BYOK
insufficient_balance 402 Insufficient funds for the paid model
credential_invalid 422 The provider key failed verification
already_exists 409 A key for this provider already exists
base_url_invalid 400 The Custom provider's baseUrl must use http or https
base_url_private 400 baseUrl points to a private network or does not resolve to an IP address via DNS
not_custom_provider 400 Manual model registration is allowed only for a Custom provider
provider_list_models_unavailable 200 The Custom provider does not support GET /v1/models — add models manually
ai_provider_unavailable 502 The external provider returned a non-2xx or a network error (not a timeout)
ai_provider_timeout 504 The Whisper upstream did not respond within 15 minutes
model_unavailable 503 The model is disabled and there is no fallback

Whisper / /v1/audio/transcriptions: processing window — up to 15 minutes. Long / noisy audio may take several minutes. For audio longer than ~30 min, split it into parts.

#System errors

Apply to any Vibe API endpoint, including the AI Router section:

Code HTTP Description
MISSING_API_KEY 401 No X-Api-Key or Authorization: Bearer header was provided
INVALID_API_KEY 401 The key does not exist or has been revoked
RATE_LIMIT_EXCEEDED 429 Per-API-key requests-per-second limit exceeded. Retry the request after X-RateLimit-Reset seconds
INTERNAL_ERROR 500 Internal platform error — retry the request; if it persists, send a feedback ticket

The full list of common API errors — Errors.


#Migration from legacy routes

If your code still has calls like /v1/ai/chat/completions, /v1/ai/models, /v1/ai/audio/transcriptions — they keep working in backward-compatibility mode. The response headers contain:

Deprecation: true
X-Deprecated-Use: /v1/chat/completions

X-Deprecated-Use suggests the canonical path. Move your calls to the canonical routes — this removes the Deprecation header and eliminates the risk of the old path being removed in the future.

Legacy path Canonical path
POST /v1/ai/chat/completions `POST /v1/chat/completions`
GET /v1/ai/models `GET /v1/models`
GET /v1/ai/models/:modelId `GET /v1/models/:modelId`
POST /v1/ai/audio/transcriptions `POST /v1/audio/transcriptions`

The routes /v1/ai/usage, /v1/ai/credentials/*, /v1/ai/providers have no legacy equivalent — these are the canonical paths.


#See also