Быстрый старт
Эта страница доводит от API key до первого рабочего запроса.
1. Создайте ключ
Откройте dashboard rout.my, создайте API key и храните его приватно. Ключи начинаются с sk_.
2. Сохраните ключ
macOS или Linux:
bash
export ROUTMY_API_KEY="sk_your_key_here"Windows PowerShell:
powershell
$env:ROUTMY_API_KEY="sk_your_key_here"3. Выберите model ID
Получите список моделей, видимых аккаунту:
bash
curl https://api.rout.my/v1/models \
-H "Authorization: Bearer $ROUTMY_API_KEY"Скопируйте точный id из ответа. В примерах ниже provider/model-id является placeholder.
4. Отправьте chat request
bash
curl https://api.rout.my/v1/chat/completions \
-H "Authorization: Bearer $ROUTMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "provider/model-id",
"messages": [
{ "role": "user", "content": "Write one sentence about rout.my." }
]
}'Python
python
from openai import OpenAI
import os
client = OpenAI(
base_url="https://api.rout.my/v1",
api_key=os.environ["ROUTMY_API_KEY"],
)
response = client.chat.completions.create(
model="provider/model-id",
messages=[{"role": "user", "content": "Write one sentence about rout.my."}],
)
print(response.choices[0].message.content)Node.js
js
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.rout.my/v1',
apiKey: process.env.ROUTMY_API_KEY
});
const response = await client.chat.completions.create({
model: 'provider/model-id',
messages: [{ role: 'user', content: 'Write one sentence about rout.my.' }]
});
console.log(response.choices[0].message.content);Дальше
- Chat Completions для сообщений, streaming, tools и vision input.
- Embeddings для векторов.
- Images или Embed Images для изображений.
- Video для генерации видео.