> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-feature-automate-reference-docs-generation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Openrouter

Openrouter.ai는 많은 LLM을 위한 통합 인터페이스로, OpenAI GPT-4, Anthropic Claude, Google Gemini와 같은 기초 모델뿐만 아니라 LLama-3, Mixtral 및 [many more](https://openrouter.ai/models)와 같은 오픈 소스 모델도 지원하며, 일부 모델은 무료로 제공됩니다.

Open Router는 Rest API와 OpenAI SDK 호환성([docs](https://docs.together.ai/docs/openai-api-compatibility))을 제공하며, Weave는 이를 자동으로 감지하고 통합합니다(자세한 내용은 Open Router [quick start](https://openrouter.ai/docs/quick-start) 참조).

OpenAI SDK 코드를 Open Router로 전환하려면 API 키를 [Open Router API](https://openrouter.ai/docs/api-keys) 키로 변경하고, `base_url`를 `https://openrouter.ai/api/v1`로 변경하고, 모델을 다양한 [chat models](https://openrouter.ai/docs/models) 중 하나로 변경하기만 하면 됩니다.

```python
import os
import openai
import weave

# highlight-next-line
weave.init('together-weave')

system_content = "You are a travel agent. Be descriptive and helpful."
user_content = "Tell me about San Francisco"

# highlight-next-line
client = openai.OpenAI(
# highlight-next-line
    api_key=os.environ.get("OPENROUTER_API_KEY"),
# highlight-next-line
    base_url="https://openrouter.ai/api/v1",
# highlight-next-line
)
chat_completion = client.chat.completions.create(
    extra_headers={
    "HTTP-Referer": $YOUR_SITE_URL, # Optional, for including your app on openrouter.ai rankings.
    "X-Title": $YOUR_APP_NAME, # Optional. Shows in rankings on openrouter.ai.
    },
    model="meta-llama/llama-3.1-8b-instruct:free",
    messages=[
        {"role": "system", "content": system_content},
        {"role": "user", "content": user_content},
    ],
    temperature=0.7,
    max_tokens=1024,
)
response = chat_completion.choices[0].message.content
print("Model response:\n", response)
```

이것은 시작하기 위한 간단한 예시이지만, 더 복잡한 사용 사례에서 Weave를 자체 함수와 통합하는 방법에 대한 자세한 내용은 [OpenAI](/ko/guides/integrations/openai#track-your-own-ops) 가이드를 참조하세요.
