MMOOZZGG.com

Neural network API

LLM API integration: how to connect it to your systems step by step

7 min read9 sources

LLM API integration connects a neural network to your working systems: choose a model and provider, get a key and keep it on the server, send a first request, embed the call into a CRM, 1C or a bot, and set limits with a log. The first request takes one short Python example; most of the work falls on step 4. Below are five steps with a code example and links to the providers’ documentation as of 16 October 2026.

In short: five steps

The order is the same for any model and any system; only the address, the key and the model name change:

  • Model and provider: where the data will be processed, what volume, what request format.
  • Key: get it in the provider’s account and keep it only on the server.
  • First request: check the connection from code, before any integrations.
  • Connection: link the CRM, 1C, website or bot to your server, and the server to the API.
  • Operation: limits, retries on errors, a log and cost control.

Step 1: model and provider

Start with the data. If requests will contain customers’ personal data, a foreign cloud means a cross-border transfer under 152-FZ, Russia’s personal data law. Then it is simpler to take an open model on your own servers or in your own data center, where requests do not leave your network.

Choose an OpenAI-compatible format. As of 16 October 2026 the DeepSeek API accepts this format: you only change the address (https://api.deepseek.com) and the key in the usual library. vLLM brings up the same interfaces on your server, and an open model connects to existing code with no rewrite.

If you need an OpenAI model specifically, the account is opened for a legal entity in a country where the provider works: as of 16 October 2026 Russia is not on the list of OpenAI API countries. What is officially available is covered on the page about API access from Russia.

Volume decides the rest. Count how many requests a day will come from the CRM, the bot and the website, compare provider rates in the API price comparison, and your own server in the local AI cost calculator.

Step 2: the key and where to keep it

The provider issues the key in your account. It opens access to the account and to payment, so keep it only on the server: in an environment variable or a secrets store. In its API reference, OpenAI asks you not to expose the key in browser and app code, and Alibaba Cloud warns that a key in code raises the risk of a leak.

Leaks happen not only with keys. On 2 May 2023 Samsung banned generative AI for staff after engineers uploaded internal source code to ChatGPT. The rule for integration: the request carries only what the model needs to answer.

  • Do not put the key into the code of a website, mobile app or bot that the user sees.
  • Create a separate key for each system: CRM, website, bot. If one leaks, you revoke one.
  • Set a spending limit in the provider’s account: OpenAI and Anthropic have one as of 16 October 2026.
  • Rotate keys on a schedule: issue a new one, switch the systems, revoke the old one.

Step 3: first request

Install the openai library for Python and put the key in the DEEPSEEK_API_KEY environment variable. The example below sends a request to DeepSeek; for your own vLLM server, only base_url and the model name change.

If an answer came back, the connection works. Error 401 means a wrong key or a key from another region, and 429 means the limit was exceeded. The timeout parameter in the example keeps a request from hanging for more than 30 seconds.

DeepSeek has the same example for Node.js, and a curl request goes to the /chat/completions method with the key in the Authorization: Bearer header. This way you can check the connection from the server even before writing code.

import os
from openai import OpenAI

client = OpenAI(
    base_url=”https://api.deepseek.com”,
    api_key=os.environ[“DEEPSEEK_API_KEY”],
    timeout=30,
)

reply = client.chat.completions.create(
    model=”deepseek-flash”,
    messages=[
        {“role”: “system”, “content”: “You are a sales team assistant. Answer briefly.”},
        {“role”: “user”, “content”: “A customer asks about the delivery time for 200 units”},
    ],
)
print(reply.choices[0].message.content)

Step 4: connecting to a CRM, 1C or a bot

A neural network does not go into the CRM by itself. Between the system and the API sits your server code or a ready integration: it takes data from the system, sends a request to the model and writes the answer back.

Start with one scenario: for example, a draft reply to a customer in the CRM that a manager checks before sending. This way you see the model’s quality on live data without risking customer chats.

Setups for popular systems are collected in the integrations section, and connecting AI to 1C is covered separately. There you also see which permissions and events each system needs.

  • CRM: a new-request event (webhook) starts a request to the model, and the answer goes into the deal card or a task for the manager.
  • 1C: exchange through HTTP services or exchange files; the model reads documents and fills in fields.
  • Telegram bot: the server gets a message, sends it to the model and returns the answer to the user. The key stays on the server; the bot does not have it.
  • Website: a form or chat calls your server, and the server calls the API. A direct API call from the browser exposes the key.

Step 5: limits, errors, log

Providers count limits in requests and tokens per minute, and Google also counts requests per day for Gemini. Going over returns error 429. In such a response Anthropic sends the retry-after header: the number of seconds to wait before a retry (as of 16 October 2026).

At Anthropic, when the monthly spending cap is reached, requests get 429 without the retry-after header, and retries will not help until the next month starts or the limit is raised. The log must tell this case apart from an ordinary limit.

If the API runs on your own server with vLLM, you set the limits yourself, and the log stays inside the company.

For large volumes we provide a dedicated API on DeepSeek, Qwen and other open models: OpenAI format, and you see the infrastructure, the logs and how requests are processed.

  • Retries: on 429 and network failures, repeat the request with a growing pause, not at once.
  • Timeout: set a maximum response time so the CRM does not hang, like timeout=30 in the example.
  • Log: record the time, system, model, number of tokens, error code and duration. Do not put request text with personal data in the log, or mask it.
  • Costs: alerts and a hard limit in the provider’s account. At OpenAI, a hard limit stops requests when the amount is reached.

Questions and answers

How long does LLM API integration take? The first request from the example above goes out as soon as you have the key. Embedding it into a CRM, 1C or a bot depends on the system: you need to link events, permissions and error handling.

Plan separate time to test quality on your real requests.

Can you connect a neural network to 1C? Yes. 1C, a Russian accounting system, calls your server through HTTP services or file exchange; the server sends a request to the model and returns the answer to a document or a directory.

The API key is kept on the server, not in the 1C database.

Sources and dates

Contact us