Multi-Turn Chat
The Chat API is fully based on LMDeploy. You can refer to the LMDeploy documentation for private deployment of the same API.
🚀 News
Intern-S2-Preview-397B Released: The Intern-S2-Preview family now includes a 397B-parameter model. Continuing the family's focus on scientific multimodal reasoning and general agent capabilities, Intern-S2-Preview-397B offers a new option for more complex tasks.
- Set
modeltointern-s2-preview-397bto use this model. Deep-thinking mode is enabled by default. - Use
thinking_mode(boolean) to toggle deep-thinking mode (intern-s2-preview-397b/intern-s2-preview-35b/intern-s2-preview/intern-s1-pro/intern-s1/intern-s1-minionly). - For Intern-S2-Preview-397B agent workloads, such as integration with harnesses like
openclawor tasks that rely heavily on tool calls, keepthinking_modeenabled by default. We do not recommend using its agent capabilities with thinking mode disabled.
Rate Limit
- API Rate Limit: By default, each user is limited to 30 requests per minute. If you require a higher request limit, you can apply for an upgraded rate limit configuration at Rate Limiting Policy.
Request Examples
Currently, the Intern ChatAPI is compatible with some methods of the OpenAI Python SDK, and more adaptations are in progress... We still recommend using native Python requests or curl requests to access the Intern API.
For users opting to use the OpenAI SDK, please install it first:
pip install openai
Non-Streaming Request
(1) Python Example
- Python Requests
import requests
import json
url = 'https://chat.intern-ai.org.cn/api/v1/chat/completions'
headers = {
'Content-Type': 'application/json',
"Authorization": "Bearer eyJ0eXBlIjoiSl...please provide a valid token!"
}
data = {
"model": "intern-latest",
"messages": [{
"role": "user",
"content": "Hello!"
}],
"n": 1,
"temperature": 0.8,
"top_p": 0.9
}
res = requests.post(url, headers=headers, data=json.dumps(data))
print(res.status_code)
print(res.json())
print(res.json()["choices"][0]['message']["content"])
- Applying OpenAI Python SDK
from openai import OpenAI
client = OpenAI(
api_key="eyJ0eXBlIjoiSl...please provide a valid token!", # Token is passed here without 'Bearer'
base_url="https://chat.intern-ai.org.cn/api/v1/",
)
chat_rsp = client.chat.completions.create(
model="intern-latest",
messages=[{"role": "user", "content": "hello"}],
)
for choice in chat_rsp.choices:
print(choice.message.content)
Parameter Description:
- Supports
model,messages,n,temperature,top_p,stream,max_tokens,tools - Other parameters are not supported yet
(2) CLI Example
openai -b "https://chat.intern-ai.org.cn/api/v1/" \
-k "eyJ0eXBlIjoiSl...please provide a valid token!" \
api chat.completions.create \
-m "intern-latest" \
-g user hello
Note:
- Supports parameters
-g ROLE CONTENT -m MODEL [-n N] [-t TEMPERATURE] [-P TOP_P] --stop STOPis currently not supported