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

# Serverless Inference

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

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

* Inference を使うと、ホスティングプロバイダーへの登録やモデルのセルフホスティングをせずに、AI アプリケーションやエージェントを構築できます。
* Weave を使うと、Serverless Inference を利用したアプリケーションをトレース、評価、監視、改善できます。

<div id="try-out-inference-in-the-ui">
  ## UI で Inference を試す
</div>

[https://wandb.ai/inference](https://wandb.ai/inference) にアクセスして、利用可能なモデルを確認し、Weave Playground で試してみてください。

Web インターフェイスの詳細については、[UI Guide](/ja/inference/ui-guide/) を参照してください。

<div id="use-inference-through-the-api">
  ## API 経由で Inference を使用する
</div>

この Python の例では、Inference を使用して LLM への chat completion リクエストを送信します。

```python lines theme={null}
import openai

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

    # Create an API key at https://wandb.ai/settings
    api_key="<your-api-key>",

    # Optional: Team and project for usage tracking
    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/prerequisites/)に従ってアカウントを設定してください。
2. [利用可能なモデル](/ja/inference/models)と[利用情報と制限](/ja/inference/usage-limits/)を確認してください。
3. [API](/ja/inference/api-reference/)または[UI](/ja/inference/ui-guide/)からサービスを使用してください。
4. [W\&B Weave Playground](/ja/weave/guides/tools/playground)でサポートされるモデルを試してください。
5. [使用例](/ja/inference/examples/)を試してください。

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