Last updated: 2026-04-20
Together AI Integration
Route Together AI API calls through SpendLil.
SpendLil proxies Together AI's API. Swap api.together.xyz for together.gateway.spendlil.ai and add X-SpendLil-Key. Together is OpenAI-compatible — use the OpenAI SDK with the Together gateway.
URL Pattern
diff Before → After
- POST https://api.together.xyz/v1/chat/completions
+ POST https://together.gateway.spendlil.ai/v1/chat/completions OpenAI SDK (Python)
python Use the OpenAI SDK with the Together gateway
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ['TOGETHER_API_KEY'],
base_url='https://together.gateway.spendlil.ai/v1',
default_headers={'X-SpendLil-Key': os.environ['SPENDLIL_KEY']},
)
response = client.chat.completions.create(
model='meta-llama/Llama-3.3-70B-Instruct-Turbo',
messages=[{'role': 'user', 'content': 'Hello'}],
)
print(response.choices[0].message.content) cURL
bash Direct HTTP request
curl https://together.gateway.spendlil.ai/v1/chat/completions \
-H "Authorization: Bearer $TOGETHER_API_KEY" \
-H "X-SpendLil-Key: $SPENDLIL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"messages": [{"role": "user", "content": "Hello"}]
}' OpenAI-compatible
Together's chat completions API mirrors OpenAI's schema. Any OpenAI SDK or tool that accepts a base_url override will work unchanged.