> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rockapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python の例

> Python で Rock API を呼び出します。

# Python の例

```python theme={null}
from openai import OpenAI

client = OpenAI(api_key="YOUR_ROCK_API_KEY", base_url="https://rockapi.ai/v1")

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)

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

<Card title="API キーを取得" icon="key" href="https://rockapi.ai/keys">
  この例を実行する前に、登録して[API キー](https://rockapi.ai/keys)を作成してください。
</Card>
