# OpenAI Style

Use endpoints compatible with the OpenAI API

SilentAPI provides endpoints compatible with the OpenAI API. If your codebase uses the OpenAI SDK, change the base URL and API key. Request and response shapes follow the OpenAI API.

## Endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v1/chat/completions` | Chat completions |
| POST | `/v1/completions` | Legacy text completions |
| POST | `/v1/responses` | Responses API |
| POST | `/v1/embeddings` | Create embeddings |
| POST | `/v1/audio/speech` | Text to speech |
| POST | `/v1/audio/transcriptions` | Speech to text |
| POST | `/v1/images/generations` | Image generation |
| POST | `/v1/images/edits` | Image edits |
| GET | `/v1/models` | List available models |
| GET | `/v1/models/{id}` | Get one model |

## Chat Completions

Send an OpenAI Chat Completions API request with the `model` and `messages` fields:

```
curl https://api.silentapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-6.1-terra",
    "messages": [{"role":"user","content":"Explain how APIs work."}]
  }'
```

Response:

```
{
  "id": "chatcmpl_1719584000",
  "object": "chat.completion",
  "created": 1719584000,
  "model": "gpt-6.1-terra",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "An API is like a waiter in a restaurant..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 156,
    "total_tokens": 164
  },
  "silentapi": {
    "cost": 0.000117,
    "fallback": null
  }
}
```

## Using the OpenAI SDK

### Python

```
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.silentapi.com/v1"
)

response = client.chat.completions.create(
    model="gpt-6.1-terra",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"}
    ]
)
```

Send conversation messages in `messages`. Send system instructions as a message with `role: "system"`. Use `prompt` only with the Completions API.

## Web Search

GPT 6.2 Astra, GPT 6.2 Sol, GPT 6.1 Terra, and GPT 6 Luna support web search. Set `useWebSearch: true` or send `web_search_options: {}`, and the same options also work with streaming.

```
{
  "model": "gpt-6.1-terra",
  "messages": [{"role":"user","content":"Find the latest release notes for Python."}],
  "useWebSearch": true
}
```

Search adds the model's listed search price to token charges. SilentAPI bills the reported number of search calls, including zero. When the search integration does not report a count, an enabled search request counts as one call. Citations do not determine the charge. In chat, enable Web search in the model options.

## Embeddings

Send text in the `input` field. Use `gemini-embedding-2` or `text-embedding-3-small`.

```
curl https://api.silentapi.com/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"model":"gemini-embedding-2","input":"SilentAPI API documentation"}'
```

`encoding_format: "base64"` works on every model. `dimensions` is sent to models that support it. See [Embeddings](https://silentapi.com/docs/media#embedding-options) in Parameter Handling.

## Text to Speech

Send text in the `input` field. The response is audio.

```
curl https://api.silentapi.com/v1/audio/speech \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"model":"gemini-3.8-flash-tts","input":"Your request is ready.","voice":"Kore","response_format":"wav"}' \
  -o speech.wav
```

Speech requests accept `mp3`, `wav`, `opus`, `aac`, `flac`, and `pcm`, including common aliases such as `audio/wav`, `audio/mpeg` and `.MP3`. If the requested format is unavailable, SilentAPI returns a supported format. `X-SilentAPI-Format` shows the actual format, and `X-SilentAPI-Notice` explains a fallback. The audio bytes and `Content-Type` always describe the format returned. See [Speech](https://silentapi.com/docs/media#speech-options) in Parameter Handling.

## Speech to Text

Send an audio file in the multipart `file` field. Use `gpt-transcribe`.

```
curl https://api.silentapi.com/v1/audio/transcriptions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@recording.mp3" \
  -F "model=gpt-transcribe"
```

`response_format` can be `json`, `text`, `verbose_json`, `srt`, or `vtt` on every model. See [Transcription](https://silentapi.com/docs/media#transcription-options) in Parameter Handling.

## Current Models

Use `gpt-6.2-sol` for balanced work. These GPT models are available:

| Model | Reasoning levels |
| --- | --- |
| gpt-6.2-sol | `low`, `medium`, `high`, `xhigh`, `max` |
| gpt-6.2-astra | `low`, `medium`, `high`, `xhigh`, `max` |
| gpt-6.1-terra | `none`, `low`, `medium`, `high`, `xhigh`, `max` |
| gpt-6-luna | `none`, `low`, `medium`, `high`, `xhigh`, `max` |

Read [[ Services ]](https://silentapi.com/services) or the [model list](#model-discovery) for the current models and levels.

Reasoning controls differ by model. The model list exposes supported levels in `silentapi.reasoning` and the documented default in `silentapi.reasoning_default`. API requests without a reasoning level use that default. Chat starts with Kimi K3.1 Pro and High reasoning; your saved preference takes priority. Kimi K3, Kimi K3.1 Pro, GLM 5.3 and GLM 5.3 Flash support `low`, `high` and `max`, with `max` as their API default. Toggle-only models use On and Off. Models with fixed reasoning do not receive an effort control.

`gpt-6.2-sol` supports function calling. Send function definitions in `tools`, and your application runs the functions that the model requests.

## Supported Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| model | string | The model ID (see [Services](https://silentapi.com/services)) |
| messages | array | Multi-turn conversation messages |
| temperature | number | Sampling temperature (0 to 2) |
| max_tokens | integer | Maximum output tokens |
| max_completion_tokens | integer | Maximum completion tokens (GPT 6 models) |
| top_p | number | Nucleus sampling parameter |
| reasoning_effort | string | Reasoning level: `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. See [Reasoning](#reasoning). |
| response_format | object | JSON Schema or JSON object mode |
| tools | array | Function calling tool definitions |
| stream | boolean | Enable SSE streaming (see [Streaming](https://silentapi.com/docs/streaming)) |
| webhook_url | string | Receive the response payload as a POST callback |

## Parameter Handling

Some values are valid in the OpenAI API but not on every model. SilentAPI changes them so the request does not fail:

| Parameter | Handling |
| --- | --- |
| temperature | Limited to 0 to 2 |
| top_p, min_p | Limited to 0 to 1 |
| frequency_penalty, presence_penalty | Limited to -2 to 2 |
| repetition_penalty | Limited to 0 to 2 |
| max_tokens, max_completion_tokens | A decimal value becomes the whole number below it. A value below 1 is ignored. |
| Numbers sent as text | Changed to numbers, for example `"0.5"` becomes `0.5`. A value that is not a number is ignored. |
| reasoning_effort, reasoning.effort | Supported values stay unchanged. Unsupported values move up to the next supported level, or stop at the highest available level. Unsupported `none` uses the lowest level. Missing or unrecognised values use the documented model default. `Extra High`, `extra-high` and `x_high` mean `xhigh`. See [Reasoning](#reasoning). |

For media endpoints, see [Parameter Handling](https://silentapi.com/docs/media#parameter-handling) in Media and OCR.

## Reasoning

Chat models accept a reasoning level. The field depends on the endpoint:

| Endpoint | Field |
| --- | --- |
| Chat Completions API | `reasoning_effort` |
| Responses API | `reasoning.effort` |
| Native model routes, such as `/v1/google/gemini-4-neon` | `reasoning_effort`, or the alias `thinkingLevel` |
| Anthropic Messages API | `thinking`. See [Anthropic Style](https://silentapi.com/docs/anthropic#reasoning). |
| Gemini `generateContent` | `generationConfig.thinkingConfig`. See [Gemini Style](https://silentapi.com/docs/gemini#reasoning). |

```
curl https://api.silentapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-6.2-sol",
    "messages": [{"role":"user","content":"Plan a three-step database migration."}],
    "reasoning_effort": "high"
  }'
```

| Value | Label |
| --- | --- |
| none | None. Off on models that support only on or off. |
| minimal | Minimal |
| low | Low |
| medium | Medium |
| high | High |
| xhigh | Extra High |
| max | Max |
| on | On. Used by models that support only on or off. |

Each model supports its own set of levels. Read them in `silentapi.reasoning` in the [model list](#model-discovery). SilentAPI changes the request to fit the model:

| Model levels | Result |
| --- | --- |
| A list of levels, for example `["low", "medium", "high"]` | SilentAPI uses the requested level when the model supports it. Otherwise it uses the closest supported level. When two levels are equally close, it uses the higher level. |
| `["none", "on"]` | The model accepts only on or off. `none` turns reasoning off. Any other level turns it on. |
| `[]` | The model always reasons. SilentAPI ignores the requested level. |

| Model levels | Request | Level used |
| --- | --- | --- |
| `["low", "medium", "high"]` | `xhigh` | `high` |
| `["low", "medium", "high"]` | `none` | `low` |
| `["none", "on"]` | `high` | On |
| `[]` | `low` | The model default |

SilentAPI also accepts these aliases:

| Request value | Same as |
| --- | --- |
| on, enabled, true | `on`. On a model with a list of levels, SilentAPI uses `medium` or the closest supported level. |
| off, disabled, false | `none` |

SilentAPI ignores a value that is not in these tables. The model then uses its default.

Chat Completions also accepts a `reasoning` object. SilentAPI reads it when `reasoning_effort` is absent:

| Field | Handling |
| --- | --- |
| reasoning.effort | Same as `reasoning_effort` |
| reasoning.max_tokens | A token budget. SilentAPI changes it to a level with the [budget table](https://silentapi.com/docs/anthropic#reasoning), then to the closest level the model supports. |
| reasoning.enabled | `true` is the same as `on`. `false` is the same as `none`. |

A model that cannot turn reasoning off gets its lowest level for `none`. A model that always reasons with a fixed level gets no reasoning fields. Other fields in `reasoning`, such as `exclude`, are kept.

## Image Generation

```
curl https://api.silentapi.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-image-2.6-flare",
    "prompt": "A serene mountain landscape at sunset",
    "n": 1,
    "size": "1024x1024"
  }'
```

SilentAPI changes `size`, `aspect_ratio`, `n`, `response_format`, and `output_format` to fit each image model. See [Image Generation](https://silentapi.com/docs/media#image-options) in Parameter Handling.

## Video

Video generation runs as a job. Create the job, poll its status until it completes, and then download the MP4 file.

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v1/videos` | Create a video job |
| GET | `/v1/videos/{id}` | Get the job status |
| GET | `/v1/videos/{id}/content` | Download the finished video (MP4) |

```
curl https://api.silentapi.com/v1/videos \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "grok-imagine-video-1.5-lite",
    "prompt": "A paper boat drifting down a rainy street",
    "duration": 6,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }'
```

The API returns `202 Accepted`:

```
{
  "id": "video_abc123",
  "status": "processing",
  "status_url": "/v1/videos/video_abc123"
}
```

Poll the status until the job is done:

```
curl https://api.silentapi.com/v1/videos/video_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Download the video:

```
curl https://api.silentapi.com/v1/videos/video_abc123/content \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o video.mp4
```

## Model Discovery

`GET /public/models` lists every model in the OpenAI list format. It needs no API key. Use it in tools and apps that read a model list. Browser apps can call it from any origin.

```
curl https://api.silentapi.com/public/models
```

`GET /v1/models` returns the same list but needs an API key, and `GET /v1/models/{id}` returns one item.

```
curl https://api.silentapi.com/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"
```

The response is `{"object": "list", "data": [...]}`. Example item. Prices are examples:

```
{
  "id": "gemini-4-neon",
  "object": "model",
  "created": 1790000000,
  "owned_by": "silentapi",
  "name": "Gemini 4 Neon",
  "display_name": "Gemini 4 Neon",
  "context_length": 1048576,
  "max_output_tokens": 65536,
  "input_modalities": ["text", "image", "video", "file", "audio"],
  "output_modalities": ["text"],
  "pricing": {
    "prompt": "0.00000375",
    "completion": "0.0000188",
    "input_cache_read": "1.88e-7"
  },
  "silentapi": {
    "model_name": "Gemini 4 Neon",
    "vendor": "Google AI",
    "family": "Gemini 4",
    "category": "multimodal",
    "resilient": true,
    "privacy": "e2e",
    "privacy_label": "End-to-end ZDR",
    "reasoning": ["low", "medium", "high", "xhigh"]
  }
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| id | string | Model ID. Send it in the `model` field. |
| object | string | Always `model` |
| created | integer | Unix time in seconds |
| owned_by | string | Always `silentapi` |
| name | string | Model name |
| display_name | string | Model name. Same as `name`. |
| context_length | integer or null | Maximum context in tokens |
| max_output_tokens | integer or null | Maximum output tokens |
| input_modalities | array | Input types, for example `text` or `image` |
| output_modalities | array | Output types |
| pricing | object | Token prices. Absent when the model has no token prices. |
| silentapi | object | SilentAPI model details |

`pricing` has these fields. Each price is in USD per token, as a string. A price can use exponent notation, for example `9.38e-7`.

| Field | Type | Meaning |
| --- | --- | --- |
| prompt | string | Price of one input token |
| completion | string | Price of one output token |
| input_cache_read | string | Price of one cached input token. Only when it applies. |
| input_cache_write | string | Price of one cache write token. Only when it applies. |

`silentapi` has these fields:

| Field | Type | Meaning |
| --- | --- | --- |
| model_name | string | Model name |
| vendor | string | Model vendor |
| family | string | Model family |
| category | string | Service type, for example `multimodal`, `text`, `image`, or `embedding` |
| privacy | string | `e2e` or `silentapi` |
| privacy_label | string | End-to-end ZDR or SilentAPI protected. See [Privacy Labels](https://silentapi.com/docs/overview). |
| resilient | boolean | `true` when fallback models exist |
| reasoning | array | Supported reasoning levels. Chat models only. See [Reasoning](#reasoning). |

### Model Catalog

`GET /public/catalog` returns one machine-readable entry for every public model, without an API key. Each entry lists its capabilities (input and output types, streaming, tools, and reasoning levels), the context and output limits, prices in USD per token and in credits, the privacy label, and a lifecycle block with `status`, `deprecated_at`, `retires_at`, and `replacement`. A model that is not deprecated has the status `active` and null dates.

```
curl https://api.silentapi.com/public/catalog
```

## Cross-Style Usage

Use any supported text or multimodal model with the OpenAI Chat Completions API. For example, `gemini-4-neon` returns the OpenAI response format.

Use the separate media endpoints for embeddings, images, speech, and video.

Source: https://silentapi.com/docs/openai
