Skip to content
Unbound AI

Developers

An API you already know.

Unbound speaks the OpenAI format. Existing clients work by changing the base URL and the key. Requests are billed from the same balance as the app.Open the documentationAPI reference

Quick start

  1. Create a key in Settings → API → Keys. It is shown once.
  2. List the models your key can call with GET /v1/models.
  3. Send a chat completion.
curl https://api.useunbound.ai/v1/chat/completions \
  -H "Authorization: Bearer $UNBOUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model-id>",
    "messages": [{ "role": "user", "content": "Hello" }]
  }'
from openai import OpenAI

client = OpenAI(base_url="https://api.useunbound.ai/v1", api_key="<your Unbound key>")

stream = client.chat.completions.create(
    model="<model-id>",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

In local development the same routes answer at http://localhost:3000/v1.

Authentication

Send your key as a bearer token: Authorization: Bearer ub_…. Keys are stored only as a keyed hash, can be revoked instantly, and can carry a spending limit and their own rate limit. Never ship a key in browser or mobile code.

Reference

GET/v1/models

Models your key can call. A model appears only if it has a provider route authorized for API resale, so this list can be shorter than the one in the app. Each entry includes context length, modalities, privacy level and per-million-token prices.

POST/v1/chat/completions

OpenAI-compatible chat completions, streaming or not.

FieldTypeNotes
modelstringRequired. An id from /v1/models.
messagesarrayRequired. Roles: system, user, assistant, tool. Content may be a string or content parts.
streambooleanServer-sent events when true.
stream_options.include_usagebooleanAdds a final chunk with token usage.
max_tokensintegerCaps output and the amount held. Also accepted as max_completion_tokens.
temperaturenumber0 to 2.
top_pnumber0 to 1.
stop, seedForwarded when the model supports them.
tools, tool_choiceFunction calling, for models that support tools.
response_formatobjectJSON mode or JSON schema, for models that support it.
reasoning_effortstringminimal, low, medium or high, for reasoning models.

POST/v1/images/generations

OpenAI-compatible image generation. A parameter the model does not support is rejected with 400, never ignored. Send an Idempotency-Key header to make retries safe: the same key returns the same images and is charged once.

FieldTypeNotes
modelstringRequired. An image model from /v1/models.
promptstringRequired.
nintegerNumber of images, up to the model limit.
sizestringFor example 1024x1024. Mapped to the nearest aspect ratio and resolution.
aspect_ratio, resolutionstringUnbound fields, for example 16:9 and 2k. Take precedence over size.
seed, negative_promptOnly for models that support them.
response_formatstringb64_json (default) or url. URLs are signed and expire after one hour.

The exact price is held before the image is generated; if fewer images are delivered than requested, only those are charged; a failed generation is not charged.

Embeddings, decisions, speech and transcription have their own pages in the documentation. Image editing, music, video and webhook endpoints are in development and will be documented as each one ships.

Streaming

With stream: true the response is a stream of chat.completion.chunk objects ending in data: [DONE]. If you close the connection early, generation stops and you are charged only for what was produced.

Billing

Before a request is sent upstream, Unbound holds enough credit to cover the prompt plus max_tokens of output. When it finishes, the real usage is charged and the rest is returned. Set max_tokens to keep holds small. Every response carries an x-request-id header that matches the entry in your usage history.

Errors

Errors use the OpenAI envelope: an error object with message, type and code.

StatusTypeMeaning
400invalid_request_errorThe request is malformed or a parameter is out of range.
401authentication_errorThe API key is missing, revoked or expired.
402insufficient_quotaNot enough credits, or the key reached its spending limit. Nothing was charged.
403permission_errorThe key lacks the scope this endpoint needs.
404model_not_foundThe model does not exist or is not available through the API.
429rate_limit_errorToo many requests for this key. Retry after the Retry-After interval.
502server_errorThe upstream provider failed. The hold was released; you were not charged.

Clients

Any client that lets you set an OpenAI-compatible base URL can use Unbound. A custom provider entry for OpenCode looks like this:

{
  "provider": {
    "unbound": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Unbound AI",
      "options": { "baseURL": "https://api.useunbound.ai/v1" },
      "models": { "<model-id>": { "name": "<display name>" } }
    }
  }
}

Compatibility with specific third-party clients is verified per release; check the changelog.