> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adskull.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI-compatible API

> Drop AdSkull into any OpenAI SDK or OpenAI-shaped tool by setting base_url. Works with Cline, Roo Code, Continue, Aider, Cursor, OpenWebUI, LiteLLM, LangChain, n8n, and more.

AdSkull exposes a façade at `https://api.adskull.io/openai/v1` that speaks
the OpenAI Chat Completions protocol. Anywhere you can configure a custom
`base_url` and `api_key`, you can use AdSkull.

```
base_url = https://api.adskull.io/openai/v1
api_key  = sk_live_...   (your AdSkull API key)
model    = claude-opus-4.7   (or any AdSkull LLM model ID)
```

## Endpoints

| Method | Endpoint                      | Notes                                                                      |
| ------ | ----------------------------- | -------------------------------------------------------------------------- |
| `GET`  | `/openai/v1/models`           | OpenAI list-shape catalog.                                                 |
| `POST` | `/openai/v1/chat/completions` | Sync + streaming. Sends `chat.completion.chunk` events for `stream: true`. |
| `POST` | `/openai/v1/completions`      | Returns 501. Use `/chat/completions`.                                      |
| `POST` | `/openai/v1/embeddings`       | Returns 501.                                                               |

## OpenAI Python SDK

```python theme={"theme":"github-dark"}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.adskull.io/openai/v1",
    api_key="sk_live_...",
)
resp = client.chat.completions.create(
    model="claude-opus-4.7",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
print(resp.usage.millicredits_charged)  # AdSkull-only extension
```

## Cline (VS Code)

In Cline settings → API Provider, choose **OpenAI Compatible**:

* **Base URL:** `https://api.adskull.io/openai/v1`
* **API Key:** your AdSkull `sk_live_...`
* **Model:** `claude-opus-4.7` (or any AdSkull LLM model)

## Roo Code (VS Code)

Settings → Provider → **OpenAI Compatible**:

* **API Base URL:** `https://api.adskull.io/openai/v1`
* **API Key:** your AdSkull key
* **Model:** any AdSkull model ID — for example `claude-opus-4.7`, `claude-sonnet-4.6`, `gpt-5-mini`, `gpt-5-nano`, `gpt-5.4-nano`, `gpt-4.1-mini`, or `gemini-3-pro`.

## Continue (VS Code / JetBrains)

`~/.continue/config.json`:

```json theme={"theme":"github-dark"}
{
  "models": [
    {
      "title": "AdSkull (Claude Opus 4.7)",
      "provider": "openai",
      "apiBase": "https://api.adskull.io/openai/v1",
      "apiKey": "sk_live_...",
      "model": "claude-opus-4.7"
    }
  ]
}
```

## Aider

```bash theme={"theme":"github-dark"}
aider \
  --openai-api-base https://api.adskull.io/openai/v1 \
  --openai-api-key sk_live_... \
  --model claude-opus-4.7
```

## Cursor (custom OpenAI)

Settings → Models → **+ Add Model** → choose **OpenAI**:

* **Base URL:** `https://api.adskull.io/openai/v1`
* **API Key:** your AdSkull key
* **Model name:** `claude-opus-4.7` (or any AdSkull model)

## OpenWebUI

Admin → Connections → **OpenAI API**:

* **URL:** `https://api.adskull.io/openai/v1`
* **Key:** your AdSkull key

## LiteLLM

```python theme={"theme":"github-dark"}
import litellm

litellm.api_base = "https://api.adskull.io/openai/v1"
resp = litellm.completion(
    model="openai/claude-opus-4.7",
    api_key="sk_live_...",
    messages=[{"role": "user", "content": "Hello"}],
)
```

## LangChain

```python theme={"theme":"github-dark"}
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.adskull.io/openai/v1",
    api_key="sk_live_...",
    model="claude-opus-4.7",
)
```

## n8n

In an **OpenAI Chat Model** node:

* **Credential → Base URL:** `https://api.adskull.io/openai/v1`
* **Credential → API Key:** your AdSkull key
* **Model:** any AdSkull model ID

## Vision / multimodal

OpenAI's `image_url` block is honored, plus `input_audio`, `input_video`, and
`file` blocks for Gemini models:

```json theme={"theme":"github-dark"}
{
  "model": "gemini-3-pro",
  "messages": [
    { "role": "user", "content": [
      { "type": "text", "text": "What's in this image?" },
      { "type": "image_url", "image_url": { "url": "https://example.com/x.jpg" } }
    ]}
  ]
}
```

## Streaming

`"stream": true` returns standard OpenAI `chat.completion.chunk` SSE
terminated by `data: [DONE]`. The final chunk includes our `usage` extension
with `millicredits_charged` and `credits_charged`.

## What's different from real OpenAI

* `model` accepts AdSkull IDs (e.g. `claude-opus-4.7`), not OpenAI IDs.
* `embeddings` and legacy `completions` return `501`.
* `usage` includes `millicredits_charged` and `credits_charged` extensions.
* No `organization` header is required.
