Differences between revisions 6 and 7
Revision 6 as of 2025-06-28 01:59:08
Size: 3580
Editor: 정수
Comment:
Revision 7 as of 2025-06-28 02:00:45
Size: 3621
Editor: 정수
Comment:
Deletions are marked like this. Additions are marked like this.
Line 65: Line 65:

이제 aider를 구동할 수 있다.

Claude Code는 다소 비싸다. LLM 모델에서는 output token이 5배 비싸다. Claude Code가 직접 텍스트를 생성하는 대신에, 또 다른 coding agent인 aider가 코드를 작성하는 텍스트 생성 작업을 하게 하고, 그 결과만 input token으로 받는 것이 더 경제적일 수 있다. 실험은 해봐야 함.

aider는 여러 다른 모델들을 사용할 수 있고, 로컬 모델도 사용할 수 있어서 저렴하게 사용할 수 있다.

그러면, Aider를 어떻게 셋팅하느냐.

Aider 셋팅 방법

Aider 설치 자체는 했다고 치고. 설정을 해야 한다.

지금 회사에서는 Azure AI Foundry를 사용하고 있다. 뭐 이제는 Google Vertex AI, AWS Bedrock 가릴건 없게 되긴 했지만. 여튼.

그래서, Azure AI Foundry를 사용해서, 나름 저렴한 DeepSeek V3 모델을 aider에 설정하는 방법을 알아보자.

우선, Azure AI Foundry에서 DeepSeek-R1-0528, DeepSeek-V3-0325 모델에 대한 model deployment를 생성해두자. 이때, 모델 이름을 임의로 정할 수 있다. 그런데 이게 aider를 설정할 때 문제가 된다. aider에 기본으로 내장되어 있는 모델 디렉토리에서는, 이렇게 임의로 지정하는 모델 이름을 미리 알 수가 없다.

aider는 내부에서 LiteLLM을 사용하는데, provider와 모델 이름을 가지고, azure_ai/deepseek-r1처럼 모델을 식별한다. 그러면 그에 상응하는 모델 메타데이터를 가져와서 활용한다. 그런데 우리는 custom model deployment를 만들었기 때문에 그 레코드가 없다.

~/.aider.model.metadata.json 파일을 만든다.

아래와 같은 내용을 적어준다. 이 내용은 https://models.litellm.ai/ 에서 조회할 수 있다. 이때, azure_ai/ 다음에 들어가는 이름은 model deployment에서 사용한 이름과 일치하게 기재한다.

{
  "azure_ai/DeepSeek-R1-0528": {
    "max_tokens": 8192,
    "max_input_tokens": 128000,
    "max_output_tokens": 8192,
    "input_cost_per_token": 0.00000135,
    "output_cost_per_token": 0.0000054,
    "supports_tool_choice": true,
    "supports_reasoning": true,
    "source": "https://techcommunity.microsoft.com/blog/machinelearningblog/deepseek-r1-improved-performance-higher-limits-and-transparent-pricing/4386367"
  },
  "azure_ai/DeepSeek-V3-0324": {
    "max_tokens": 8192,
    "max_input_tokens": 128000,
    "max_output_tokens": 8192,
    "input_cost_per_token": 0.00000114,
    "output_cost_per_token": 0.00000456,
    "supports_function_calling": true,
    "supports_tool_choice": true,
    "source": "https://techcommunity.microsoft.com/blog/machinelearningblog/announcing-deepseek-v3-on-azure-ai-foundry-and-github/4390438"
  }
}

이제 모델에 대한 API_KEY 등을 설정해야 한다. 프로젝트 디렉토리의 .env에 넣을 수도 있지만, 그러면 그 프로젝트에만 적용되니, home directory에 ~/.aider.conf.yml 파일을 만든다.

.env 환경변수에서 지정해주는 내용을 set-env에 넣으면 된다. API_BASE는 Azure AI Foundry의 endpoint를 적으면 되는데, ~/models까지만 적어줘야 한다. AI Foundry의 코드 예제에 그렇게 나와있다.

model: azure_ai/DeepSeek-V3-0324
set-env:
  - AZURE_AI_API_BASE=https://....services.ai.azure.com/models
  - AZURE_AI_API_VERSION=2024-05-01-preview
api-key:
  - azure_ai=...
  - openai=...
architect: false
git: false

이제 aider를 구동할 수 있다.

ClaudeCodeWithAider (last edited 2025-06-28 02:00:45 by 정수)