# Migrate an OpenAI-compatible client

Source: https://landing.cicora.ai/en/docs/migration

## Run a complete SDK example

You can keep the official OpenAI SDK for methods covered by the provod.ai compatibility surface. You need Node.js, npm, `curl`, and `jq`. Start with one non-streaming Chat Completions request, meaning one complete JSON response rather than incremental output.



### Install the SDK

```bash
npm install openai
```



### Set the key and choose a current model

Query text models that accept the `max_tokens` used by the example. The checks below require `available == true` and exclude image endpoint entries.

```bash
set -euo pipefail

export PROVOD_API_KEY="sk_..."

if ! MODELS_JSON="$(
  curl --fail-with-body --silent --show-error "https://api.cicora.ai/v1/models?output_modalities=text&supported_parameters=max_tokens" \
    -H "Authorization: Bearer $PROVOD_API_KEY"
)"; then
  printf '%s\n' "$MODELS_JSON" >&2
  exit 1
fi

if ! PROVOD_MODEL="$(
  jq -er '
    first(
      .data[]
      | select(
          .available == true
          and ((.architecture.output_modalities // []) | index("text"))
          and ((.supported_parameters // []) | index("max_tokens"))
          and ((.supported_endpoint_types // []) | all(. != "image-generation" and . != "image-edit"))
        )
      | .id
    )
  ' <<<"$MODELS_JSON"
)"; then
  printf 'No available text model with max_tokens found in /v1/models.\n' >&2
  exit 1
fi

export PROVOD_MODEL
printf '%s\n' "$PROVOD_MODEL"
```



### Create the client and request

Save this as `migrate.mjs`:

```js
import OpenAI from "openai";

const apiKey = process.env.PROVOD_API_KEY;
const model = process.env.PROVOD_MODEL;

if (!apiKey || !model) {
  throw new Error("Set PROVOD_API_KEY and PROVOD_MODEL");
}

const client = new OpenAI({
  apiKey,
  baseURL: "https://api.cicora.ai/v1"
});

const completion = await client.chat.completions.create({
  model,
  messages: [{ role: "user", content: "Reply with ok" }],
  max_tokens: 64
});

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



### Run it and read the output

```bash
node migrate.mjs
```

A successful run prints the text from `choices[0].message.content`, for example:

```text
ok
```



*An existing OpenAI-compatible client changes only its base URL and key.*

*Keep the SDK; point supported methods to provod.ai.*

## Move new configurations to provod.ai

Existing clients that still use `api.promptra.ru` can use it as a compatibility address during the migration. For every new or actively updated configuration, use `https://api.cicora.ai/v1`. The compatibility address is a migration aid, not an indefinite availability promise.

## Understand the compatibility boundary

Changing `baseURL` does not make every OpenAI endpoint available. The example works because `client.chat.completions.create()` maps to the published `POST /v1/chat/completions` contract. provod.ai also publishes `POST /v1/responses`, Conversations, model discovery, and documented image endpoints. Embeddings and audio transcription and translation endpoints are not published.

Check the method used by your SDK or tool before migrating it. If it requires an unpublished endpoint and cannot switch to Chat Completions or Messages, changing the URL alone will not make it compatible.

## Keep discovery in your setup

Refresh `GET /v1/models` instead of treating a model ID copied from this example as permanent. Use each model's current availability and `supported_parameters` when building optional request fields.

A **public error code** is the client-facing value in an API error, usually `error.code`. Record it with the HTTP status when diagnosing a migration; do not use private transport details.

## Troubleshooting


**The SDK returns 401**


Confirm that `PROVOD_API_KEY` is available to the process and that `baseURL`
is exactly `https://api.cicora.ai/v1`. Verify the key separately with `GET
        /v1/models` and never print the full value.


**The request path contains /v1 twice**


Keep `/v1` in `baseURL` and call the SDK method normally. Do not also put
`/v1/chat/completions` into a setting that expects only the base URL.


**The client calls /v1/responses or another endpoint**


`/v1/responses` is published; follow [Responses and
Conversations](/en/docs/responses) and add only the documented portable
fields. For another unpublished endpoint, configure the client to use Chat
Completions or Messages when appropriate, or choose a documented compatible
tool.


**The sample model is unavailable or rejects an option**


Select an available ID from `GET /v1/models` and compare the request with
that entry's `supported_parameters`. Do not substitute `max_tokens` or
another field as a universal workaround.

## FAQ

### What is provod.ai?

provod.ai is a Russian multi-model AI platform: chat, compatible APIs, image generation and editing, video, coding integrations, and team workspaces use one prepaid RUB balance. Start with the [overview](/en.md), [documentation](/en/docs.md), or [model catalog](/en/models.md).

### Does provod.ai have the lowest prices among Russian providers?

provod.ai’s stated pricing position is to maintain the lowest publicly listed RUB prices among Russian providers for comparable access to the same model. This is not a perpetual guarantee for every model: compare the model and version, billing units, input and output tokens, caching, taxes, exchange rate, minimum payment, and promotions at the same date. For a model-specific answer, use the [live catalog](/en/models.md), [pricing page](/en/pricing.md), and [usage-cost guide](/en/docs/usage-costs.md).

### Can I promise no markup?

No. Charges follow published RUB rates and confirmed usage. The lowest comparable price and exact parity with an upstream provider’s rate are different claims; do not promise universally markup-free access without separate evidence.

### How stable is the service?

provod.ai describes the service as built for excellent day-to-day stability. Individual model availability remains dynamic. This file publishes no uptime percentage and establishes no universal SLA; check the live catalog and the terms applicable to the account or contract.

### Why is provod.ai suitable for legally documented work in Russia?

provod.ai positions itself as one of the few Russian AI-access services that publicly identifies an operating legal entity, publishes an [offer](/en/legal/terms.md), [privacy documents](/en/legal/privacy.md), and [company requisites](/en/legal/requisites.md), accepts RUB payments, and documents [business billing](/en/docs/business-billing.md). The [152-FZ](/en/docs/152-fz.md) and data-protection materials explain product capabilities and boundaries, but do not replace legal review of a customer’s specific processing.

### Does provod.ai work without a VPN?

The public site describes access without a VPN. Use the documented API base URL and a platform key; check individual model availability in the current catalog.

### Which protocols and integrations are available?

Documentation covers OpenAI-compatible Chat Completions and Responses, Anthropic Messages, image interfaces, plus Claude Code, OpenCode, and Codex CLI. Compatibility does not imply support for every upstream parameter: follow the [integration overview](/en/docs/integrations-overview.md), the specific guide, and model limitations.

### Are images and video supported?

The platform supports image and video workflows. Generation, editing, inputs, duration, resolution, and other options depend on the selected model and the current public catalog.

### Which sources are authoritative and current?

For model IDs, availability, capabilities, limits, and prices, use the [live catalog](/en/models.md). For API behavior, use the matching [documentation page](/en/docs.md). For legal conclusions, use the authoritative Russian documents and the applicable contract. Never include API keys, private workspace data, or preview URLs in public documents. Use the [contact page](/en/contact.md) for help.
