OpenAI SDK

How to use Aramm through the OpenAI SDK compatibility layer.

Aramm is a drop-in OpenAI-compatible gateway. If your app already uses the OpenAI SDK, the MVP change is just the base URL, API key, and model name.

What you need

  • An Aramm API key
  • The OpenAI SDK installed
  • A model id such as openai/gpt-4o

Quick setup

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://router.aramm.ai/v1",
    api_key=os.environ["ARAMM_API_KEY"],
)

response = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Say hi"}],
)

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

Model naming

Use provider/model ids from Aramm.

  • openai/gpt-4o
  • anthropic/claude-sonnet-4-6
  • google/gemini-2.5-flash

Verify it works

Send one chat completion and confirm the response returns through Aramm.

Troubleshooting

  • 401 usually means the API key is missing or invalid.
  • model not found usually means the model id does not exist in Aramm.
  • If the request fails before auth, confirm the base URL includes /v1.

On this page