Solutions
An OpenAI-compatible API for Claude, Gemini and more
If your code uses the OpenAI SDK, you can reach Claude, Gemini, DeepSeek and other makers' models through Somnus by changing two settings: the base URL and the API key.
Two-line change
Set base_url to the Somnus gateway and use your Somnus key. Requests and responses keep the chat-completions format.
Streaming and tools
Streaming, system prompts, JSON output and tool calls use the same request fields.
One bill
Every model draws from the same prepaid balance.
The two-line change
python
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["SOMNUS_API_KEY"],
base_url="https://gateway-production-c837.up.railway.app/v1",
)
resp = client.chat.completions.create(
model="claude-sonnet-5",
messages=[
{"role": "user", "content": "Hello"}
],
)
print(resp.choices[0].message.content)Questions
How do I start?
Create an account; you get $5 of free credit and an API key.
Related
Browse more: Alternatives · Compare · Use cases · Developers · Solutions · Tools