Developers
One integration. Every model in the catalog.
A consistent request format, one authentication method, and stable model IDs — so switching models is a one-line change.
Send a request
Pass a model ID and a list of messages. Change the model ID to route the same request to a different model.
Browse model IDsimport os
import requests
response = requests.post(
"https://api.modelport.example/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.environ['MODELPORT_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "modelport-demo/atlas-chat",
"messages": [
{"role": "user", "content": "Summarize this support ticket in two sentences."}
],
"max_tokens": 256,
},
timeout=30,
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])Illustrative request — endpoint pending configuration.
Sample response
response.json
{
"id": "req_demo_01",
"model": "modelport-demo/atlas-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The customer cannot reset their password..."
},
"finish_reason": "stop"
}
],
"usage": {
"input_tokens": 182,
"output_tokens": 41,
"total_tokens": 223
}
}Sample error
error.json
{
"error": {
"type": "rate_limit_exceeded",
"message": "Too many requests. Retry after the period in the Retry-After header.",
"request_id": "req_demo_02"
}
}