# Call from the SDK

Call OpenAI / Anthropic-compatible LLMs by simply **swapping the base URL** of your SDK (SaaS only).

## Introduction

Here are the quickest steps to use the LLM Gateway. You can call an LLM in just three steps.

> **The LLM Gateway and the Agent API are different**
>
> The LLM Gateway (`/llm/v1/...`) is a **raw LLM call** (a governance proxy) compatible with OpenAI / Anthropic. It is a separate service from the [Agent API](https://developers.fd.agenticstar.tm.softbank.jp/en/docs/saas/api/agent/quickstart/call-api.md) (`/api/v1/chat/completions`), which runs autonomous agents. If you need tool execution or deliverables, use the Agent API.

> **Prerequisites**
>
> - [Setup](https://developers.fd.agenticstar.tm.softbank.jp/en/docs/saas/api/llm-gateway/guide/setup.md) is complete
>
>   <!-- -->
>
>   - An administrator has **defined the available models** in the admin console
>   - An **LLM Gateway client** has been created in Console and an **API key (`agtstr_...`)** has been obtained

## Step 1: Check Available Models

Available models are defined by an administrator. Retrieve the list with `GET /v1/models`.

```bash
curl https://api.fd.agenticstar.tm.softbank.jp/llm/v1/models \
  -H "Authorization: Bearer agtstr_..."
```

## Step 2: Call the LLM

Specify the model ID you retrieved and make the call.

**Chat completion**

**OpenAI SDK**

```python
from openai import OpenAI

client = OpenAI(
  api_key="agtstr_...",
  base_url="https://api.fd.agenticstar.tm.softbank.jp/llm/v1",
)

resp = client.chat.completions.create(
  model="<model ID from GET /v1/models>",
  messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
```

**Anthropic SDK**

```python
from anthropic import Anthropic

client = Anthropic(
  api_key="agtstr_...",
  base_url="https://api.fd.agenticstar.tm.softbank.jp/llm",
)

msg = client.messages.create(
  model="<model ID from GET /v1/models>",
  max_tokens=1024,
  messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content)
```

**curl**

```curl
curl https://api.fd.agenticstar.tm.softbank.jp/llm/v1/chat/completions \
-H "Authorization: Bearer agtstr_..." \
-H "Content-Type: application/json" \
-d '{"model": "<model ID>", "messages": [{"role": "user", "content": "Hello"}]}'
```

> **Authentication Methods**
>
> In addition to `Authorization: Bearer agtstr_...`, the Anthropic SDK also accepts `x-api-key: agtstr_...`. You can also authenticate with the Client Credentials flow using a Client ID / Client Secret.

## Step 3: Streaming

Enable `stream` to receive tokens incrementally over SSE.

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

## Next Steps

For more detailed specifications and setup steps, see the following documentation.

[API Reference→](https://developers.fd.agenticstar.tm.softbank.jp/en/docs/saas/api/llm-gateway/reference/api-reference.md)

[Specifications for all endpoints, errors, and limits](https://developers.fd.agenticstar.tm.softbank.jp/en/docs/saas/api/llm-gateway/reference/api-reference.md)

[Setup→](https://developers.fd.agenticstar.tm.softbank.jp/en/docs/saas/api/llm-gateway/guide/setup.md)

[Preparation steps for administrators and developers](https://developers.fd.agenticstar.tm.softbank.jp/en/docs/saas/api/llm-gateway/guide/setup.md)
