OpenRouter

OpenRouter

OpenRouter의 모델을 Docker Agent에서 사용하는 방법을 설명해요. 여러 프로바이더의 모델을 OpenAI 호환 API 하나로 쓸 수 있어요.

출처: 문서

본문

OpenRouter는 여러 프로바이더의 모델을 OpenAI 호환 API로 사용할 수 있게 해줘요. Docker Agent에는 OpenRouter를 기본 제공 alias 프로바이더로 지원하고 있어요.

설정

  • OpenRouter에서 API 키를 받으세요.
export OPENROUTER_API_KEY=your-api-key

사용법

인라인 문법

OpenRouter를 쓰는 가장 간단한 방법:

agents:
  root:
    model: openrouter/meta-llama/llama-3.3-70b-instruct
    description: Assistant using OpenRouter
    instruction: You are a helpful assistant.

OpenRouter 모델 ID는 보통 상위 프로바이더 이름을 포함해요(예: anthropic/claude-sonnet-4-5 또는 meta-llama/llama-3.3-70b-instruct). Docker Agent는 첫 번째 슬래시만 나누기 때문에 전체 상위 모델 ID가 보존돼요.

네임드 모델 (Named Model)

파라미터를 더 세밀하게 제어하려면:

models:
  openrouter_llama:
    provider: openrouter
    model: meta-llama/llama-3.3-70b-instruct
    temperature: 0.7
    max_tokens: 8192

agents:
  root:
    model: openrouter_llama
    description: Assistant using OpenRouter
    instruction: You are a helpful assistant.

가격과 모델 메타데이터

Docker Agent는 models.dev에서 OpenRouter 모델 메타데이터를 가져와요. 백만 입력/출력 토큰당 가격, 사용 가능한 캐시 가격, 컨텍스트 한도, 출력 한도, 모달리티를 포함해요. 이게 다른 일급 프로바이더와 같은 방식으로 비용 추적과 모델 피커를 지원해요. models.dev를 쓸 수 없으면 Docker Agent는 내장 카탈로그 스냅샷으로 폴백해요.

동작 방식

OpenRouter는 Docker Agent의 기본 제공 alias로 구현돼 있어요:

예시: 코드 어시스턴트

agents:
  coder:
    model: openrouter/meta-llama/llama-3.3-70b-instruct
    description: Code assistant using OpenRouter
    instruction: |
      You are an expert programmer.
      Write clean, maintainable code.
      Explain trade-offs when helpful.
    toolsets:
      - type: filesystem
      - type: shell
      - type: think

더 알아보기 (Learn more)