/ai (AI chat proxy)
Proxy to an OpenAI-compatible API via GitHub Models.
Methods
GET, POST
Query parameter
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | required if no messages provided |
Simple prompt text used to build messages. |
JSON request body (pass-through)
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
messages |
array | required if no query provided |
Chat history array passed to the model. |
model |
string | no | Overrides the default model. |
temperature |
number | no | Sampling temperature passed through to the model. |
max_tokens |
integer | no | Maximum tokens for the response. |
Response
{
"answer": "...generated text..."
}
Errors
-
400Missingqueryandmessages. 500Upstream API error.
Example
curl -G "https://sodeom.com/ai" --data-urlencode "query=Say hi"
curl -X POST "https://sodeom.com/ai" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Say hi"}],"temperature":0.7}'
Notes
- Requires
GITHUB_TOKENon the server. -
Default model:
gpt-4o-miniunless overridden in server config.
OpenAI SDK-compatible API
Use any OpenAI SDK or tool by pointing it at
https://sodeom.com/v1 as the base URL.
Quick start
from openai import OpenAI
client = OpenAI(
base_url="https://sodeom.com/v1",
api_key="any", # no key required, pass anything
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
Streaming
stream = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Count to 5"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/v1/models |
List available models. |
GET |
/v1/models/:id |
Retrieve a single model. |
POST |
/v1/chat/completions |
Create a chat completion (streaming supported). |
Available models
gpt-4o-mini(default)gpt-4oo1-miniMeta-Llama-3.1-8B-InstructMeta-Llama-3.1-70B-InstructMistral-smallPhi-3.5-mini-instruct
Supported parameters
| Parameter | Type | Description |
|---|---|---|
model |
string | Model ID (default: gpt-4o-mini). |
messages |
array | Required. Chat history. |
stream |
boolean | Enable SSE streaming. |
temperature |
number | Sampling temperature. |
max_tokens |
integer | Max tokens (default: 1024). |
top_p |
number | Nucleus sampling. |
stop |
string/array | Stop sequences. |
frequency_penalty |
number | Frequency penalty. |
presence_penalty |
number | Presence penalty. |
seed |
integer | Deterministic seed. |
n |
integer | Number of completions. |
curl examples
# List models
curl https://sodeom.com/v1/models
# Chat completion
curl https://sodeom.com/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'
# Streaming
curl https://sodeom.com/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Count to 5"}],
"stream": true
}'