InferenceGetting started
First request
How to send your first request to a model with curl, Python or JavaScript and get a reply.
This page shows the shortest path from an API key to a model reply. You will need a key from the console and any one of three tools: curl, the OpenAI SDK for Python, or the OpenAI SDK for JavaScript.
Setup
Create a key in the console and put it in the YENISEI_KEY environment
variable. How to do this is described on the API key page.
Request
curl https://api.yenisei.ru/v1/chat/completions \
-H "Authorization: Bearer $YENISEI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "yenisei-100",
"messages": [{"role": "user", "content": "Hello!"}]
}'
from openai import OpenAI
import os
client = OpenAI(
base_url="https://api.yenisei.ru/v1",
api_key=os.environ["YENISEI_KEY"],
)
resp = client.chat.completions.create(
model="yenisei-100",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://api.yenisei.ru/v1",
apiKey: process.env.YENISEI_KEY,
})
const resp = await client.chat.completions.create({
model: "yenisei-100",
messages: [{ role: "user", content: "Hello!" }],
})
console.log(resp.choices[0].message.content)
What's next
- To receive the reply in parts, as in a chat, turn on streaming.
- All request parameters are described on the Chat Completions page.
- The Models method shows which models are available on your plan.