For Agents
For Agents
Any agent, bot, or automation that speaks the OpenAI Chat Completions API can route inference through Auton. Point it at the gateway, pass an Auton API key, and usage deducts from your forward compute balance at the locked rate you purchased.
No SDK required — if it works with OpenAI, it works with Auton.
Quick start
- Connect a Solana wallet on autonaisol.xyz/dashboard
- Sign the login message to activate your session
- Create an API key (starts with
auton_sk_) - Set
OPENAI_API_KEY(or your agent's equivalent) to that key - Set
OPENAI_BASE_URLtohttps://api.autonaisol.xyz/api/v1/gateway/v1 - Send chat completion requests as normal
Base URL
| Setting | Value |
|---|---|
| API base | https://api.autonaisol.xyz |
| OpenAI-compatible base | https://api.autonaisol.xyz/api/v1/gateway/v1 |
| Chat completions | https://api.autonaisol.xyz/api/v1/gateway/v1/chat/completions |
| Auth header | Authorization: Bearer auton_sk_... |
curl
curl https://api.autonaisol.xyz/api/v1/gateway/v1/chat/completions \
-H "Authorization: Bearer $AUTON_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-chat",
"messages": [
{"role": "system", "content": "You are a helpful agent."},
{"role": "user", "content": "Summarize what Auton does in one sentence."}
],
"max_tokens": 100
}'OpenAI SDK (Node / Python)
Use the official OpenAI client with a custom baseURL. Your agent code stays unchanged — only env vars differ.
TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AUTON_API_KEY, // auton_sk_...
baseURL: "https://api.autonaisol.xyz/api/v1/gateway/v1",
});
const response = await client.chat.completions.create({
model: "deepseek/deepseek-chat",
messages: [{ role: "user", content: "Hello from my agent" }],
});
console.log(response.choices[0].message.content);Python
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["AUTON_API_KEY"],
base_url="https://api.autonaisol.xyz/api/v1/gateway/v1",
)
response = client.chat.completions.create(
model="deepseek/deepseek-chat",
messages=[{"role": "user", "content": "Hello from my agent"}],
)
print(response.choices[0].message.content)Streaming
Set stream: true in the request body. The gateway returns Server-Sent Events in OpenAI format. Token usage is deducted after the stream completes.
const stream = await client.chat.completions.create({
model: "deepseek/deepseek-chat",
messages: [{ role: "user", content: "Write a haiku about compute." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Supported models
Each model maps to a forward contract tier. Your wallet must hold an active balance for that tier or the gateway returns 402 Payment Required.
| Model | Tier |
|---|---|
deepseek/deepseek-chat | DEEPSEEK_JULY26 |
deepseek/deepseek-coder | DEEPSEEK_JULY26 |
deepseek/deepseek-r1 | DEEPSEEK_JULY26 |
meta-llama/llama-3.3-70b-instruct | LLAMA_AUG26 |
meta-llama/llama-3.1-70b-instruct | LLAMA_AUG26 |
meta-llama/llama-3.1-8b-instruct | LLAMA_AUG26 |
Agent frameworks
Any framework that accepts a custom OpenAI base URL and API key works out of the box:
- Cursor / Claude Code / Windsurf — set custom OpenAI endpoint in provider settings
- LangChain —
ChatOpenAI(openai_api_base=..., openai_api_key=...) - LlamaIndex —
OpenAI(api_base=..., api_key=...) - AutoGPT / CrewAI / LangGraph — set
OPENAI_API_BASEandOPENAI_API_KEYenv vars - Custom agents — any HTTP client that POSTs to
/chat/completions
LangChain (Python)
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="deepseek/deepseek-chat",
openai_api_key=os.environ["AUTON_API_KEY"],
openai_api_base="https://api.autonaisol.xyz/api/v1/gateway/v1",
)
llm.invoke("What is a compute forward contract?")Error responses
Agents should handle these HTTP status codes:
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing, malformed, or revoked API key |
| 402 | payment_required | No forward balance, expired contract, or zero tokens remaining |
| 400 | missing_model | model field missing from request body |
| 400 | — | Model not mapped to an active tier |
{
"error": {
"message": "Insufficient compute token balance",
"type": "insufficient_compute_balance",
"code": "payment_required"
}
}Environment variables
Recommended env vars for agent deployments:
AUTON_API_KEY=auton_sk_your_key_here
OPENAI_API_KEY=auton_sk_your_key_here # alias for OpenAI-compatible tools
OPENAI_BASE_URL=https://api.autonaisol.xyz/api/v1/gateway/v1Never commit API keys. Use your platform's secrets manager (Railway, Vercel, Docker secrets, etc.).
Billing for agents
- Each completion deducts
usage.total_tokensfrom your forward balance for the matching tier - Balances are token-denominated — purchased at a locked rate on the marketplace
- When balance hits zero, agents receive
402— top up by purchasing more capacity - Usage is logged per request in
usage_logs(visible via dashboard)
Health checks
Agents and orchestrators can probe backend availability before routing traffic:
GET https://api.autonaisol.xyz/health
GET https://api.autonaisol.xyz/health/db
GET https://api.autonaisol.xyz/api/v1/configSee the full REST reference on the API page and gateway details on Gateway.