Soba Docs

Integrate

The endpoint

Point your existing OpenAI client at Soba with one base URL, one key and the user's id on every request. What it forwards to the model, and what it does not.

Soba speaks the OpenAI API. There is no SDK to install and no provider to import.

JavaScript
// No SDK to install. Your OpenAI client already speaks to Soba.
import OpenAI from "openai";

const soba = new OpenAI({
  baseURL: "https://api.soba.so/v1", // the only line that changes
  apiKey: process.env.SOBA_KEY,
});

const response = await soba.chat.completions.create({
  messages: [
    { role: "system", content: "You are a helpful assistant" },
    { role: "user", content: "What is Soba?" },
  ],
  model: "auto",
  user: "usr_123",
});
Python
import os
from openai import OpenAI

soba = OpenAI(
    base_url="https://api.soba.so/v1",  # the only line that changes
    api_key=os.environ["SOBA_KEY"],
)

response = soba.chat.completions.create(
    messages=[
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "What is Soba?"},
    ],
    model="auto",
    user="usr_123",
)
Terminal
curl https://api.soba.so/v1/chat/completions \
  -H "Authorization: Bearer $SOBA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "user": "usr_123",
    "messages": [
      { "role": "user", "content": "What is Soba?" }
    ]
  }'

The three things that change#

baseURL https://api.soba.so/v1
apiKey A key from your dashboard, shaped sk_soba_<id>.<secret>. Not the token a paired machine holds, which is a different credential entirely
user The signed-in user's id, on every request

For chat, streamed or not, nothing else moves: your messages, images, tools and the usual settings go to the model as you wrote them. What gets through lists them.

The `user` field is not optional here

It is a hint in the OpenAI API and load-bearing in Soba: it is how a run is attributed to a person, and therefore how Soba knows whose machine the run may reach. A request without it cannot be routed to anyone's own compute, and cannot be metered against anyone's plan. See Provider terms.

Prove it in one request#

Terminal
curl https://api.soba.so/v1/chat/completions \
  -H "Authorization: Bearer $SOBA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "soba/echo", "user": "usr_123",
        "messages": [{ "role": "user", "content": "ping" }] }'

soba/echo is answered by Soba itself. It needs no paired machine and no provider key, nothing is billed for it, and it still proves the three things that actually break: the key, the base URL, and the user field.

soba/echo is a reserved name rather than a model name: POST /v1/end_users/session honours it in its user field for the same reason, proving your secret key without writing a person into your Users list. See the HTTP API.

That matters on day one, when nobody has connected a machine yet. Soba has no provider to import, so at integration time there is nothing to connect, and without echo a first request would have nowhere to land and every integration would begin with a failure.

Models#

Model
auto Runs on the AI the user chose on their machine, or its default. With nothing to route to, your providers or a refusal
soba/echo Answered by Soba. No machine, no provider key, nothing billed. The health check

Provider-specific aliases work too. auto is the one to reach for, because naming a model forces your app to know what a given user has connected. See Routing a run.

`auto` can be answered by an agent

It picks the AI the person chose on their machine, or the machine's default, and that can be Claude Code, Codex or another agent on their plan. An agent receives the conversation as text and runs its own loop, so your tool loop does not carry over. To keep a request off their plan, send route: { allow: ["user-hardware"] }: a run an agent would serve is then refused. To give an agent your tools, use soba.run().

What you get immediately#

Pointing the call site at Soba, before anyone connects anything, already gives you:

  • Metering per user, stamped with its cost class
  • Spend ceilings, checked between turns
  • A plain refusal for anyone with nothing to run on, so your existing code can serve them instead

And it gives you placement. Once the call site points at Soba, turning on bring-your-own compute later needs no code change from you: the same request starts landing on a model the user runs themselves as soon as they connect one. Using the plan they already pay for with your own tools is the one thing that needs a change at the call site, and that change is soba.run().

When nothing is reachable#

With a provider added under Models, and a plan whose route reaches it, Soba answers on your key. Otherwise the request comes back as a 409 with the code no_compute, and your code serves it with the client it already uses:

JavaScript
async function complete(params, userId) {
  try {
    return await soba.chat.completions.create({ ...params, user: userId });
  } catch (err) {
    if (err.code !== "no_compute") throw err;
    return await openai.chat.completions.create(params); // your key, your server, as today
  }
}

Soba does not count or meter a run your server sends straight to your provider. With soba.run(), catch the same code.

What gets through#

Forwarded
messages Text, image parts (data: or https: URLs), tool calls and their results
tools, tool_choice, parallel_tool_calls A response that asks for tools ends there; you run them and send the results back
response_format Passed to the model. Validate the output: not every model honours it
temperature, top_p, max_tokens, max_completion_tokens, stop, seed, presence_penalty, frequency_penalty, reasoning_effort Passed to the model. A provider's own output ceiling still applies
model, stream, user
runtime, route, effort The user's pick from the model picker, beside the rest or inside soba. An agent such as Claude Code receives the conversation as text

Anything else, such as n or logprobs, is not forwarded. A user's machine running an older Soba app reads only the text and the tools.

What this endpoint cannot do#

It serves chat/completions only: there is no /v1/responses, embeddings, audio or image generation.

chat/completions is stateless and the caller owns the loop. A model works that way. Claude Code and Codex run their own loop and never hand a tool call back to wait on an HTTP round trip, so when one of them answers here it gets the conversation as text and your tools do not come back to you as tool_calls you can rely on. Running an agent with your tools means letting Soba own the loop, which is what soba.run() is for.

Privacy · Terms · DPA · © 2026 Soba resolved = machine grant ∩ broker request