> For the complete documentation index, see [llms.txt](https://runyourai.gitbook.io/userguide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://runyourai.gitbook.io/userguide/runyour-agent/workspace/api.md).

# API 라우터

**API 라우터**는 단일 API 엔드포인트를 통해 OpenAI·Claude·Gemini·DeepSeek·Upstage 등 여러 AI 모델을 **하나의 연동으로 호출**할 수 있게 해 주는 기능입니다. 작업하기에서 사용하던 모델을 코드에서 직접 사용할 수 있으며, 모델 ID만 바꾸면 자유롭게 전환됩니다.

#### 주요 특징

<table><thead><tr><th width="167.546875">특징</th><th>설명</th></tr></thead><tbody><tr><td>OpenAI SDK 호환</td><td>Base URL과 API 키만 변경하면 기존 OpenAI SDK 코드를 수정 없이 그대로 사용</td></tr><tr><td>통합 모델 호출</td><td>여러 프로바이더의 모델을 동일한 방식으로 호출하고, 모델 ID만 바꿔 즉시 전환</td></tr><tr><td>크레딧 기반 과금</td><td>입력·출력 토큰 사용량에 따라 크레딧(C)이 자동 차감</td></tr></tbody></table>

#### 접근 경로

좌측 사이드바 상단의 **API 라우터** 메뉴를 클릭하면 키 목록과 발급 버튼이 있는 화면으로 진입합니다.

<div data-with-frame="true"><figure><img src="/files/m6orpO4EPJzL4eDvsdVx" alt=""><figcaption><p><strong>API 라우터 화면</strong> — 키를 발급하고 지원 모델을 확인합니다</p></figcaption></figure></div>

#### 이용 전제

* API 호출도 작업하기와 동일하게 **크레딧이 차감**됩니다. 충분한 크레딧이 확보되어 있어야 합니다.
* API 라우터를 사용하려면 **그룹에 소속**되어 있어야 합니다.

{% hint style="warning" %}
그룹에 소속되어 있지 않으면 키 발급·호출이 제한되며, 그룹에서 제외되면 사용 중인 API 키는 함께 제거 됩니다.
{% endhint %}

#### 빠른 시작

{% stepper %}
{% step %}

### API 키 발급하기

API 라우터 화면에서 'API Key 생성' 버튼을 클릭하고, 키의 이름과 만료일을 입력합니다. 생성된 키를 즉시 복사해 안전한 곳에 복사하고 보관합니다.

생성되는 키는 다음과 같은 형식입니다. 창을 닫으면 다시 볼 수 없으니 반드시 안전한 곳에 저장하세요!

```
runyour-v1-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-xxxxxxxx
```

{% endstep %}

{% step %}

### 키 보안 관리하기

API 키는 비밀번호와 같습니다. 노출되면 누구나 내 권한으로 모델을 호출할 수 있으니, 코드에 직접 적거나 메신저·이메일로 공유하지 마세요.

`.env` 파일이나 비밀 관리 도구에 저장하고, 외부에 공개되는 저장소에는 올리지 않도록 주의합니다. 키가 노출된 것 같다면 즉시 새 키로 교체하세요.
{% endstep %}

{% step %}

### 모델 호출하기

발급한 키를 요청 헤더에 담아 AI 모델을 호출합니다. 화면의 예시 코드를 복사한 뒤 키 부분만 바꿔 실행하면 됩니다.

정상 응답이 오면 연동이 완료된 것이고, 인증 오류(401)가 나면 키 값과 입력 형식을 다시 확인합니다.
{% endstep %}

{% step %}

### 키 관리하기

발급한 키는 'API Key' 탭에서 한눈에 확인할 수 있습니다. 키 이름, 마스킹된 값(`runyour-v1-••••3f9a`), 발급일이 표시됩니다.

더 이상 사용하지 않는 키는 비활성화하거나 삭제해 호출을 차단합니다. 삭제한 키는 복구할 수 없으니 사용 여부를 확인한 뒤 진행하세요.
{% endstep %}
{% endstepper %}

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://runyourai.gitbook.io/userguide/runyour-agent/workspace/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
