Chat Request API

OpenAI Compatible Chat Request Format

FastRouter offers an OpenAI-compatible request schema.

Request Example

import openai
client = openai.OpenAI(
    api_key="API-KEY",
    base_url="https://go.fastrouter.ai/api/v1" 
)

response = client.chat.completions.create(
    model="openai/gpt-4.1", # model to send to the proxy
    messages = [
        {
            "role": "user",
            "content": "Write a short poem on AI"
        }
    ]
)

print(response)

Calling FastRouter Directly

Request Example

curl --location https://go.fastrouter.ai/api/v1/chat/completions \
     -H "Authorization: Bearer API-KEY" \
     -H "Content-Type: application/json" \
     -d '{
  "model": "openai/gpt-3.5-turbo",
  "messages": [
    {
      "role": "user",
      "content": "What is the meaning of life?"
    }
  ]
}'

Last updated