Ornn Inference
Early accessOne API for frontier models.
Send a chat completion as a market order on Ornn's token market. Requests take the familiar messages array and responses come back OpenAI-shaped, so your existing code moves over in a few lines.
The API
A chat completion is an order
Every request names a model, an order type, and the messages. Authenticate with your Ornn API key.
import os
import httpx
response = httpx.post(
"https://api.ornn.com/v1/inference/chat/completions",
headers={"Authorization": f"Bearer {os.environ['ORNN_API_KEY']}"},
json={
"model_id": "openai/gpt-4o-mini",
"order_type": "market",
"messages": [
{"role": "user", "content": "Write a haiku about GPUs."},
],
},
timeout=120,
)
print(response.json()["choices"][0]["message"]["content"])Response
{
"id": "chatcmpl-7f3a9c",
"object": "chat.completion",
"created": 1792051200,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Silicon warms up..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 17,
"total_tokens": 31
}
}model_id- The model to run, written as maker/model.
order_typemarketfills right away at the current price.messages- The conversation so far: system, user, assistant, and tool turns.
stream- Set to true to receive the completion as server-sent events.
tools- OpenAI-shaped function tools, with tool_choice to steer them.
max_tokens, temperature, top_p, stop- The sampling controls you already use.
order_type: limitComing soon- Set
limit_price, the most you'll pay, and the order fills only at or under it.
Pricing
Pay per token
You pay for the input and output tokens each order uses. Prices are per million tokens.
| Model | Made by | Input / 1M tokens | Output / 1M tokens |
|---|---|---|---|
GPT-4oopenai/gpt-4o | OpenAI | Coming soon | Coming soon |
GPT-4o miniopenai/gpt-4o-mini | OpenAI | Coming soon | Coming soon |
Open-weight models
Open-weight models are coming
Open-weight models on Ornn Serverless
Coming soonOpen-weight models will be served on Ornn Serverless. Until then, you can run your own open-weight model today with an @app.server unit.