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

# W&B Inference

> W&B Weave と OpenAI 互換 API 経由でオープンソースの基盤モデルにアクセス

W\&B Inference を使うと、W\&B Weave と OpenAI 互換 API 経由で主要なオープンソースの基盤モデルにアクセスできます。次のことができます。

* ホスティングプロバイダーへの登録やモデルのセルフホスティングをせずに、AI アプリケーションやエージェントを構築する
* [サポート対象モデル](/ja/inference/models) を [W\&B Weave Playground](/ja/weave/guides/tools/playground) で試す

Weave を使えば、W\&B Inference を利用したアプリケーションをトレース、評価、監視、改善できます。

<div id="quickstart">
  ## クイックスタート
</div>

以下は、Python を使った簡単な例です。

```python theme={null}
import openai

client = openai.OpenAI(
    # カスタムベースURLはW&B Inferenceを指します
    base_url='https://api.inference.wandb.ai/v1',

    # https://wandb.ai/settings でAPIキーを作成してください
    api_key="<your-api-key>",

    # 省略可能: 使用状況トラッキング用のTeamとプロジェクト
    project="<your-team>/<your-project>",
)

response = client.chat.completions.create(
    model="meta-llama/Llama-3.1-8B-Instruct",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Tell me a joke."}
    ],
)

print(response.choices[0].message.content)
```

<div id="next-steps">
  ## 次のステップ
</div>

1. [利用可能なモデル](/ja/inference/models)と[利用情報と制限](/ja/inference/usage-limits/)を確認します
2. [前提条件](/ja/inference/prerequisites/)を参照してアカウントを設定します
3. [API](/ja/inference/api-reference/)または[UI](/ja/inference/ui-guide/)からサービスを利用します
4. [使用例](/ja/inference/examples/)を試します

<div id="usage-details">
  ## 利用の詳細
</div>

<Info>
  料金、利用制限、クレジットについては、[利用情報と制限](/ja/inference/usage-limits/)を参照してください。
</Info>
