Skip to main content

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

  1. Connect a Solana wallet on autonaisol.xyz/dashboard
  2. Sign the login message to activate your session
  3. Create an API key (starts with auton_sk_)
  4. Set OPENAI_API_KEY (or your agent's equivalent) to that key
  5. Set OPENAI_BASE_URL to https://api.autonaisol.xyz/api/v1/gateway/v1
  6. Send chat completion requests as normal

Base URL

SettingValue
API basehttps://api.autonaisol.xyz
OpenAI-compatible basehttps://api.autonaisol.xyz/api/v1/gateway/v1
Chat completionshttps://api.autonaisol.xyz/api/v1/gateway/v1/chat/completions
Auth headerAuthorization: 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.

ModelTier
deepseek/deepseek-chatDEEPSEEK_JULY26
deepseek/deepseek-coderDEEPSEEK_JULY26
deepseek/deepseek-r1DEEPSEEK_JULY26
meta-llama/llama-3.3-70b-instructLLAMA_AUG26
meta-llama/llama-3.1-70b-instructLLAMA_AUG26
meta-llama/llama-3.1-8b-instructLLAMA_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_BASE and OPENAI_API_KEY env 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:

StatusCodeMeaning
401invalid_api_keyMissing, malformed, or revoked API key
402payment_requiredNo forward balance, expired contract, or zero tokens remaining
400missing_modelmodel field missing from request body
400Model 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/v1

Never commit API keys. Use your platform's secrets manager (Railway, Vercel, Docker secrets, etc.).

Billing for agents

  • Each completion deducts usage.total_tokens from 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/config

See the full REST reference on the API page and gateway details on Gateway.