OpenAI API

Call GPT-6 and GPT-5.x in the official format

The official OpenAI SDKs, Codex, Cursor and other compatible tools only need base_url pointed at UnioAPI. Both Chat Completions and Responses are available, with fields, streaming events and error shapes matching the official API.

Call Responses with the OpenAI Python SDKpython
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.unioapi.com/v1",
    api_key=os.environ["UNIO_API_KEY"],
)

response = client.responses.create(
    model="gpt-6.1-sol",
    input="Explain prompt caching in one sentence.",
    reasoning={"effort": "low"},
)
print(response.output_text)

The OpenAI SDK's base_url includes /v1; for Chat Completions call client.chat.completions.create with the same key.

1.05M
Context window on the GPT-6 family
2 APIs
Chat Completions and Responses
4 tiers
Standard, Fast, Flex, Ultrafast
none – max
Adjustable reasoning effort

Why call OpenAI models through UnioAPI

Both official APIs

POST /v1/chat/completions and POST /v1/responses run in the official format as sent. Responses supports SSE and WebSocket, plus the /compact and /input_tokens endpoints.

1.05M context

GPT-6, GPT-6.1, GPT-5.6, GPT-5.5 and GPT-5.4 all have 1.05M context and 128K output. Requests with more than 272K input tokens are billed at long-context prices for the whole request.

Reasoning effort per model

Use reasoning_effort in Chat Completions and reasoning.effort in Responses. Each model supports its own range, shown on its model page, and values are applied as sent.

Four service tiers

Pick Standard, Fast, Flex or Ultrafast with service_tier. Flex suits offline work, and Ultrafast is available on select models. See Models and pricing for supported tiers.

Automatic prompt caching

Repeated prefixes hit the cache automatically, and GPT-5.6 and later can request a 12-hour cache lifetime through Responses.

Every call is traceable

Console request logs list the model, reasoning effort, tokens, latency and charge of each call, filterable by API key and endpoint.

Four steps to the OpenAI API

  1. Step 1

    Create an API key

    Redeem credit in the console and create an API key; each key can have its own spend cap and expiry.

    Read the docs
  2. Step 2

    Change base_url

    Set the OpenAI SDK's base_url to https://api.unioapi.com/v1 and use model IDs from the model pages, without a vendor prefix.

    Read the docs
  3. Step 3

    Pick an API

    Responses is recommended for new projects; Responses-only models such as the Pro line return 404 on Chat Completions.

    Read the docs
  4. Step 4

    Choose a tier per workload

    Try Fast for interactive work and Flex for offline jobs. If Fast or Ultrafast is unavailable at dispatch, the gateway tries the same model at Standard.

    Read the docs

Billed by actual token usage

Each call is settled from its response usage: input, cache reads, cache writes and output are priced separately, and each service tier and long context has its own prices. The model pages list current prices.

OpenAI API FAQ

Set base_url to https://api.unioapi.com/v1, use your UnioAPI key, and use model IDs from the model pages. Nothing else changes.

Further reading

Related topics

Start calling GPT with one key

Create an API key, set base_url to https://api.unioapi.com/v1, and both Chat Completions and Responses are ready.