Appearance
快速开始
iina.ai 提供了一个统一的 API,使您能够通过单一端点访问多种 AI 模型,同时自动处理故障转移。只需几行代码,使用您喜欢的 SDK 或框架即可快速开始。
前提条件
- 注册 IINA 账户,联系 support@iina.ai 获取试用额度。
- 获取您的 API 密钥,可在 控制台 查看。
- 选择合适的 API 端点:
- 默认端点:
iina.ai,适合海外用户或有稳定代理的用户。 - 优化端点:
acc.iina.ai,适合中国大陆用户直连使用。
- 默认端点:
调用 API
python
from openai import OpenAI
client = OpenAI(
base_url="https://iina.ai/v1",
api_key="<API_KEY>",
)
completion = client.chat.completions.create(
model="gpt-5.2",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
]
)
print(completion.choices[0].message.content)typescript
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://iina.ai/v1",
apiKey: '<API_KEY>",
});
async function main() {
const completion = await openai.chat.completions.create({
model: 'gpt-5.2',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
});
console.log(completion.choices[0].message);
}
main();shell
curl https://iina.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "gpt-5.2",
"messages": [
{
"role": "user",
"content": "What is the meaning of life?"
}
]
}'