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

# DSPy

> DSPy에서 TokenLab을 OpenAI 호환 언어 모델로 구성하기

## 개요

DSPy는 TokenLab의 OpenAI 호환 `/v1` 엔드포인트와 함께 `openai/` 공급자 접두사를 사용하여 TokenLab을 호출할 수 있습니다.

<Note>
  **유형**: 프로그래밍 프레임워크

  **기본 경로**: OpenAI 호환 언어 모델 호출

  **지원 신뢰도**: 지원되는 사용자 지정 엔드포인트 경로
</Note>

## 환경 설정

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## DSPy 구성

```python theme={null}
import os

import dspy

lm = dspy.LM(
    "openai/claude-sonnet-5",
    api_key=os.environ["TOKENLAB_API_KEY"],
    api_base="https://api.tokenlab.sh/v1",
)

dspy.configure(lm=lm)
```

## 모듈 사용

```python theme={null}
qa = dspy.ChainOfThought("question -> answer")

response = qa(question="What should I monitor in an LLM gateway?")
print(response.answer)
```

## 모델 제안

빠른 실험을 위해서는 `gpt-5.4-mini`를, 더 강력한 추론 과정을 위해서는 `claude-sonnet-5`를, 빠른 반복 루프를 위해서는 `deepseek-v4-flash`를 사용하세요.
