Skip to main content
ShuttleAI is fully compatible with the OpenAI SDK. Just change the base URL and API key — everything else works out of the box.

Prerequisites

Installation

pip install openai

Your first request

from openai import OpenAI

client = OpenAI(
    api_key="shuttle-xxx",
    base_url="https://api.shuttleai.com/v1"
)

response = client.chat.completions.create(
    model="shuttleai/auto",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is ShuttleAI?"}
    ]
)

print(response.choices[0].message.content)

Response format

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1677858242,
  "model": "shuttleai/auto",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "ShuttleAI is a unified AI API platform..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 45,
    "total_tokens": 69
  }
}

Using a specific model

Replace "shuttleai/auto" with any model ID to target a specific model:
# Use GPT-5.2 directly
response = client.chat.completions.create(
    model="gpt-5.2",
    messages=[{"role": "user", "content": "Hello!"}]
)
Use the shuttleai/auto model (ShuttleAI Auto) to let our smart router automatically pick the best model for your task. It’s the most cost-efficient way to use the API. Learn more →

Next steps