لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/ai.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

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 for your own provider keys (BYOK), connect your credentials.

This is an API, not a chat interface. There is no chat window for talking to a model in your Vibecode account — you don't need to look for one. You enter the request (prompt) in your AI tool, agent, or code (Cursor, 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 | Base URL: https://vibecode.bitrix24.com/v1 | Authorization: the X-Api-Key header or Authorization: Bearer YOUR_API_KEY

You can pay with a subscription. Every router model can be paid for not only from the account wallet but also with the Cowork/Code subscription — including from your own agent. Get the subscription key on the Cowork/Code page; configuring popular agents is covered in Your own agent on the subscription.

OpenAI SDK compatibility

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

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

By default the SDK passes the key in the Authorization: Bearer header — Vibecode accepts both (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

  • Chat completions — generating a model response in synchronous or streaming mode (Server-Sent Events)
  • Models — the list of available models and details of a single model
  • Speech recognition — converting audio to text via Whisper Large v3 Turbo
  • Embeddings — converting text into vector representations (OpenAI format)
  • Your own keys (BYOK) — connecting your own provider keys
  • Usage and limits — statistics per key, the company's monthly quota, and off-peak hours
  • Your own agent on the subscription — connecting a third-party agent (OpenCode, Crush, Cline, Aider) billed against the Cowork/Code subscription instead of the account wallet
  • OpenAI SDK compatibility — configuring Cursor, IDE agents, and any OpenAI-compatible clients
  • Model lifecycle — the behavior of ACTIVE / DEPRECATED / DISABLED and the related headers
  • Migration from legacy routes — for projects that still call /v1/ai/chat/completions and similar routes

Quick start

1. Generate a response with a free model

Terminal
curl -X POST https://vibecode.bitrix24.com/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 available models

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

Returns only the models that have provider credentials configured in your account. 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.com/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 to the deal timeline.

Step 1. Speech recognition

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

Response:

JSON
{
  "text": "Hello, this is Acme LLC. We want a CRM for 50 users, budget up to 500,000 per month."
}

Step 2. Lead classification with guaranteed `JSON`

Terminal
curl -X POST https://vibecode.bitrix24.com/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": "Acme LLC. CRM for 50 users, budget up to 500,000 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 a budget of 500,000 per month.\"}"
      }
    }
  ],
  "usage": {"prompt_tokens": 92, "completion_tokens": 36, "total_tokens": 128}
}

Step 3. Write the result to the deal timeline

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

Terminal
curl -X POST https://vibecode.bitrix24.com/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 a budget of 500,000 per month."
  }'

All three endpoints work with the same API key and the same authorization — no separate integrations are required.


Endpoint reference

Method Path Description
MethodPOST Path/v1/chat/completions DescriptionGenerate a model response — synchronously or as a stream
MethodGET Path/v1/models DescriptionList of available models
MethodGET Path/v1/models/:modelId DescriptionDetails of a specific model
MethodPOST Path/v1/audio/transcriptions DescriptionSpeech recognition via Whisper
MethodPOST Path/v1/embeddings DescriptionVector embeddings of text
MethodGET Path/v1/ai/usage DescriptionAI usage statistics per key
MethodGET Path/v1/ai/quota DescriptionPercentage of the monthly AI quota and a per-model breakdown
MethodGET Path/v1/off-peak DescriptionOff-peak hours schedule for the AI quota
MethodGET Path/v1/ai/providers DescriptionList of providers for BYOK
MethodGET Path/v1/ai/credentials DescriptionList of your own provider keys
MethodPOST Path/v1/ai/credentials DescriptionConnect a provider key (with verification)
MethodPATCH Path/v1/ai/credentials/:id DescriptionUpdate a provider key
MethodDELETE Path/v1/ai/credentials/:id DescriptionDelete a provider key
MethodPOST Path/v1/ai/credentials/:id/test DescriptionTest a provider key
MethodGET Path/v1/ai/credentials/:id/usage DescriptionUsage statistics per key
MethodPOST Path/v1/ai/credentials/:id/fetch-models DescriptionLoad the model catalog from a Custom provider
MethodGET Path/v1/ai/credentials/:id/models DescriptionList of models bound to a key
MethodPOST Path/v1/ai/credentials/:id/models DescriptionAdd a model to a key manually
MethodDELETE Path/v1/ai/credentials/:credId/models/:modelRowId DescriptionDelete a model bound to a key

Error codes

Endpoints fall into two groups by their 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 following 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"
  }
}

These endpoints return their own expected errors in the V1 format. An unexpected 5xx server error on any /v1/ai/* route is returned in the raw OpenAI format. It also works the other way round: quota and pacing rejections (402 ai_quota_exhausted, 429 ai_pacing_limited) on the OpenAI-compatible endpoints arrive in the envelope with success: false. An error handler must accept both envelopes on either route family.

Code HTTP Description
Codescope_missing HTTP403 DescriptionThe API key is missing the vibe:ai scope
Codeinvalid_request HTTP400 DescriptionInvalid request parameters
Codeno_default_model HTTP400 DescriptionThe portal has no models available to call
Codeinvalid_image_payload HTTP400 DescriptionInvalid image_url in the content array
Codeinvalid_language HTTP400 DescriptionThe language code does not match ISO 639
Codeno_file HTTP400 DescriptionNo audio file was passed
Codeempty_file HTTP400 DescriptionThe file is present in the multipart request, but its body is 0 bytes. The typical cause is curl -F "file=path" without @
Codeinvalid_audio HTTP400 DescriptionThe contents of the file field in an audio transcription request are clearly not audio — for example text, a PDF document, an image or an archive. Rejected before recognition; there is no point in retrying without replacing the file
Codeai_model_not_found HTTP404 DescriptionThe model was not found or is disabled
Codenot_found HTTP404 DescriptionThe entity (BYOK key, model) was not found
Codeprovider_not_found HTTP404 DescriptionThe provider was not found or is disabled
Codeai_credentials_not_configured HTTP402 DescriptionThe model has no provider credentials — connect BYOK
Codeinsufficient_balance HTTP402 DescriptionInsufficient funds for a paid model
Codecredential_invalid HTTP422 DescriptionThe provider key failed verification
Codealready_exists HTTP409 DescriptionA key for this provider already exists
Codeagent_turn_loop_detected HTTP409 DescriptionAn agent turn on POST /v1/chat/completions is stuck in a loop: 20 or more model answers without tool_calls have accumulated after the last message with the user role. The request is not sent to the model and nothing is charged. To continue, add a new message with the user role
Codeagent_turn_awaiting_confirmation HTTP409 DescriptionThe AI agent is waiting for the user to confirm or cancel an operation: until the user answers, its key's requests to POST /v1/chat/completions are refused. The request is not sent to the model and nothing is charged
Codebase_url_invalid HTTP400 DescriptionThe Custom provider's baseUrl must use http or https
Codebase_url_private HTTP400 DescriptionThe baseUrl points to a private network or does not resolve to an IP address via DNS
Codenot_custom_provider HTTP400 DescriptionManual model registration is allowed only for a Custom provider
Codeprovider_list_models_unavailable HTTP200 DescriptionThe Custom provider does not support GET /v1/models — add models manually
Codeai_provider_rejected HTTP400 DescriptionThe provider rejected the request itself (responded 400 or 422). Retrying it unchanged will not help
Codeai_payload_too_large HTTP413 DescriptionThe request was rejected because of its size. In chat with a bitrix/* model, the body exceeds 2 MiB even after image downscaling: downscale the images — image analysis. When the provider itself rejected the request because of its size — on any AI method, models on your own key included — the response carries providerStatusCode: 413. Make the request smaller: send fewer texts or split the file into parts
Codeai_image_resize_busy HTTP429 DescriptionThe platform is already downscaling many images at once. Retry after the delay given in the Retry-After header — image analysis
Codeai_provider_unavailable HTTP502 DescriptionThe external provider answered with an error (401/403/5xx). The original status arrives in the providerStatusCode field whenever the provider answered with an HTTP status — including when the stream to the client is already open and the provider refused to establish the upstream one. The field is absent where there was no status: the error arrived as a frame from the body of an already open stream (the platform accepts only the 429 status from the body, and such a frame arrives as rate_limit_exceeded) or the failure happened while processing the provider's response
Codeai_provider_network HTTP502 DescriptionThe platform could not connect to the provider, or the connection dropped before a response (chat, embeddings, speech recognition). This response carries no providerStatusCode: the provider never answered. Retry the request
Codeai_provider_timeout HTTP503 DescriptionThe upstream did not respond in time: the Whisper timeout (15 minutes), the non-streaming request budget, or a provider 408
Codeai_congested HTTP429 DescriptionThe AI cluster pool is overloaded. The request was not executed and there is no charge — retry it after the delay given in the Retry-After header
Codeai_provider_cooldown HTTP429 DescriptionThe model cluster is temporarily unavailable and the platform pauses briefly. The request was not executed and there is no charge — retry it after the delay given in the Retry-After header. This response carries neither X-RateLimit-Scope nor X-AI-Admission
Codemodel_unavailable HTTP503 DescriptionThe model is disabled and there is no fallback

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

System errors

Applicable to any Vibecode API endpoint, including the AI Router section:

Code HTTP Description
CodeMISSING_API_KEY HTTP401 DescriptionNeither the X-Api-Key header nor Authorization: Bearer was passed
CodeINVALID_API_KEY HTTP401 DescriptionThe key is not recognized — no such key exists on the platform
CodeRATE_LIMITED HTTP429 DescriptionThe general request limit for V1 endpoints outside the AI Router was exceeded. The pause before retrying is in Retry-After
Coderate_limit_exceeded HTTP429 DescriptionThe per-minute AI Router limit for the API key or user was exceeded. The scope is in error.scope and the X-RateLimit-Scope header; the pause before retrying is in Retry-After. The same code arrives when the model cluster itself throttled the request: the body then carries the providerStatusCode field, the scope field and the X-RateLimit-Scope header are absent, and the pause comes from Retry-After
CodeINTERNAL_ERROR HTTP500 DescriptionInternal platform error. Retry the request, and if the error persists, submit a ticket

For the full list of common API errors, see Errors.


Migration from legacy routes

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

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

X-Deprecated-Use indicates the canonical path. Move the 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
Legacy pathPOST /v1/ai/chat/completions Canonical pathPOST /v1/chat/completions
Legacy pathGET /v1/ai/models Canonical pathGET /v1/models
Legacy pathGET /v1/ai/models/:modelId Canonical pathGET /v1/models/:modelId
Legacy pathPOST /v1/ai/audio/transcriptions Canonical pathPOST /v1/audio/transcriptions

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


See also