# 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](/arkane-cloud/inference/api/examples.md).

### 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arkanecloud.com/arkane-cloud/inference/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
