# API

## Arkane Cloud API

Arkane Cloud Platform offers an API for inference. Here are examples of Python, JavaScript SDK and cURL command that makes an API request from your terminal:

```
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://cloud.arkanecloud.com/",
    api_key=os.environ.get("ARKANE_CLOUD_API_KEY"),
)

completion = client.chat.completions.create(
    model="meta-llama/Meta-Llama-3.1-70B-Instruct",
    messages=[
        {
            "role": "user",
            "content": """Hello!"""
        }
    ],
    temperature=0.6
)

print(completion.to_json())
```

<details>

<summary>Response</summary>

```
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat?",
        "role": "assistant"
      }
    }
  ],
  "created": 1717516032,
  "model": "meta-llama/Meta-Llama-3-70B-Instruct-cheap",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 26,
    "prompt_tokens": 13,
    "total_tokens": 39
  }
}
```

</details>

For more examples, see [Examples of using the Arkane Cloud API](https://docs.arkanecloud.com/arkane-cloud/inference/api/examples).

### Code from playground

In the [Arkane Cloud  inference playground](https://cloud.arkanecloud.com/playground), you can view your model setup and chat as code that makes API requests, and use this code in your applications.
