SandBase Chat Completions API

OpenAI-compatible LLM Gateway

GitHub OpenAPI

Operations 1

POST /v1/chat/completions Create chat completion #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sandbase-ai:sandbase-ai-chat-completions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sandbase-ai-chat-completions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: SandBase Chat Completions API
  description: 'SandBase is an agent-native platform for connecting Agents to the real world.

    Use one account and one key to call Models, ready-made APIs, and Agents.


    ## Authentication

    Public API requests require a SandBase API key. Use `Authorization: Bearer sk-YOUR_KEY` by default.

    Anthropic Messages and Google Gemini-compatible operations also document their native SDK-compatible key locations.


    ## SDK Compatibility

    - **LLM Gateway** (`/v1/chat/completions`): Use OpenAI SDK with `base_url="https://api.sandbase.ai/v1"`

    - **Embeddings** (`/v1/embeddings`): Use OpenAI SDK with `base_url="https://api.sandbase.ai/v1"`

    - **Images** (`/v1/images/generations`, `/v1/images/edits`): Use OpenAI SDK with `base_url="https://api.sandbase.ai/v1"`

    - **Anthropic Messages** (`/v1/messages`): Use Anthropic SDK with `base_url="https://api.sandbase.ai"`

    - **Google Gemini GenerateContent** (`/v1beta/models/{model}:generateContent`): Configure the Google Gen AI SDK to use `https://api.sandbase.ai`

    - **Agents and Sessions** (`/v1/agents`, `/v1/agents/sessions`): Follow the OpenAI Agents protocol (`OpenAI-Beta: agents=v1` is optional) plus the documented SandBase extensions

    - **Agents platform resources** (`/v1/agents*`, `/v1/mcp-connections*`, `/v1/secrets*`, `/v1/skills*`): Accept `Authorization: Bearer` or `X-API-Key` and return the `AgentsError` envelope'
  version: 1.0.0
  x-sandbase-session-contract:
    status: active
    feature: Agents platform Sessions
    description: A Session (ses_*) runs one saved Agent version in a SandBase-hosted environment. Sessions are created directly with POST /v1/agents/sessions. Internal runtime identities are never exposed.
  contact:
    name: SandBase
    url: https://www.sandbase.ai
  license:
    name: Proprietary
servers:
- url: https://api.sandbase.ai
  description: Production
security:
- BearerAuth: []
tags:
- name: Chat Completions
  description: OpenAI-compatible LLM Gateway
paths:
  /v1/chat/completions:
    post:
      operationId: createChatCompletion
      tags:
      - Chat Completions
      summary: Create chat completion
      description: OpenAI-compatible chat completions endpoint. SandBase uses model and stream for routing and preserves additional provider-compatible fields when the selected route uses the same protocol. Support for provider-specific fields can vary when SandBase translates between protocols.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: Chat completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: 'SSE stream of chat.completion.chunk events, followed by data: [DONE].'
        '400':
          description: Invalid JSON, missing model, or an invalid provider request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskCostError'
        '402':
          description: Organization spending limit reached
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/ChatCompletionError'
                - $ref: '#/components/schemas/TaskCostError'
        '403':
          description: Organization is disabled, or the API key scope does not authorize this endpoint
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/ChatCompletionError'
                - $ref: '#/components/schemas/APIKeyScopeError'
        '404':
          description: Model not found or unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskCostError'
        '500':
          description: Request persistence or organization lookup failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionError'
        '502':
          description: Invalid response from the selected provider
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionError'
        '503':
          description: No provider route succeeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionError'
components:
  schemas:
    APIKeyScopeError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          - request_id
          properties:
            code:
              type: string
              const: insufficient_scope
            message:
              type: string
            request_id:
              type: string
    ChatCompletionResponse:
      type: object
      required:
      - id
      - object
      - created
      - model
      - choices
      - usage
      additionalProperties: true
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - chat.completion
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            required:
            - index
            - message
            - finish_reason
            - logprobs
            additionalProperties: true
            properties:
              index:
                type: integer
              message:
                type: object
                required:
                - role
                - content
                additionalProperties: true
                properties:
                  role:
                    type: string
                  content:
                    type:
                    - string
                    - 'null'
                  tool_calls:
                    type: array
                  reasoning_content:
                    type:
                    - string
                    - 'null'
              finish_reason:
                type:
                - string
                - 'null'
                description: Provider finish reason. Values can vary by model and provider.
              logprobs:
                description: Token log probabilities when requested and supported; otherwise null.
        usage:
          type: object
          required:
          - prompt_tokens
          - completion_tokens
          - total_tokens
          - prompt_tokens_details
          - completion_tokens_details
          additionalProperties: true
          properties:
            prompt_tokens:
              type: integer
            completion_tokens:
              type: integer
            total_tokens:
              type: integer
            prompt_tokens_details:
              type: object
              required:
              - cached_tokens
              - cache_write_tokens
              properties:
                cached_tokens:
                  type: integer
                cache_write_tokens:
                  type: integer
            completion_tokens_details:
              type: object
              required:
              - reasoning_tokens
              properties:
                reasoning_tokens:
                  type: integer
    ChatCompletionRequest:
      type: object
      required:
      - model
      - messages
      additionalProperties: true
      description: OpenAI-compatible request. Additional provider-compatible fields are forwarded when supported by the selected route.
      properties:
        model:
          type: string
          description: Model identifier
          example: openai/gpt-5.4
        messages:
          type: array
          items:
            type: object
            required:
            - role
            additionalProperties: true
            properties:
              role:
                type: string
                description: Message role supported by the selected provider, such as system, developer, user, assistant, or tool.
              content:
                oneOf:
                - type: string
                - type: array
                  items:
                    type: object
                    additionalProperties: true
                - type: 'null'
              name:
                type: string
              tool_calls:
                type: array
              tool_call_id:
                type: string
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
        top_p:
          type: number
        max_tokens:
          type: integer
        stream:
          type: boolean
          default: false
        stop:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
        tools:
          type: array
          items:
            type: object
        mcp_servers:
          type: array
          maxItems: 20
          items:
            $ref: '#/components/schemas/MCPServer'
        tool_choice:
          oneOf:
          - type: string
          - type: object
        parallel_tool_calls:
          type: boolean
        user:
          type: string
        response_format:
          type: object
        reasoning_effort:
          type: string
          description: Provider-compatible reasoning effort setting.
        reasoning:
          type: object
          additionalProperties: true
          description: Reasoning configuration; common fields include effort and max_tokens.
        thinking:
          type: object
          additionalProperties: true
          description: Thinking configuration; common fields include type and budget_tokens.
        extra_body:
          type: object
          additionalProperties: true
          description: Provider-specific parameters used when SandBase translates the request between protocols.
        n:
          type: integer
          default: 1
        presence_penalty:
          type: number
        frequency_penalty:
          type: number
        stream_options:
          type: object
          properties:
            include_usage:
              type: boolean
    MCPServer:
      type: object
      required:
      - name
      - type
      - url
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        type:
          type: string
          enum:
          - url
        url:
          type: string
          format: uri
    TaskCostError:
      type: object
      required:
      - error
      properties:
        error:
          type: string
    ChatCompletionError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - message
          - type
          - code
          - param
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type:
              - 'null'
              - string
            param:
              type:
              - 'null'
              - string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: SandBase API key. Treat the complete credential as an opaque secret.
    AnthropicApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Supported only by `POST /v1/messages` for Anthropic SDK compatibility
    GoogleApiKey:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: Supported by Google Gemini-compatible endpoints. Takes precedence over the other key locations.
    GoogleQueryApiKey:
      type: apiKey
      in: query
      name: key
      description: Google SDK compatibility fallback. Prefer x-goog-api-key or Authorization because URLs can be logged.
    WebhookApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Accepted by the webhook Events API (/events/webhooks*). Authorization Bearer takes precedence when both are sent.
    AgentsApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Accepted only by Agents platform resources (/v1/agents*, /v1/mcp-connections*, /v1/secrets*, /v1/skills*). If Authorization is also sent, both must carry the same key.