> For the complete documentation index, see [llms.txt](https://docs.robincompute.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.robincompute.org/integrations/openai-compatible.md).

# OpenAI-Compatible Usage

Change one line, keep your code. RobinCompute speaks the OpenAI wire protocol (same request bodies in, same response bodies out), so anything written against the OpenAI SDK, in any language, moves over with a new base URL and a new API key. Two config values. Nothing else.

***

## Compatibility matrix

| Feature                                 | Compatible                            |
| --------------------------------------- | ------------------------------------- |
| `POST /v1/chat/completions`             | Yes, streaming included               |
| `GET /v1/models`                        | Yes, plus extra `robincompute` fields |
| Streaming (SSE)                         | Yes                                   |
| `max_tokens`, `temperature`, `top_p`    | Yes                                   |
| `stop` sequences                        | Yes                                   |
| `frequency_penalty`, `presence_penalty` | Yes                                   |
| System and multi-turn messages          | Yes                                   |
| Tool / function calling                 | Planned for Phase 2                   |
| Embeddings (`/v1/embeddings`)           | Planned for Phase 2                   |
| Image inputs (`vision`)                 | Planned for Phase 2                   |
| Assistants API                          | No                                    |
| Fine-tuning API                         | No                                    |

***

## Python (OpenAI SDK)

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.robincompute.org/v1",
    api_key="rcompute_live_your_key_here"
)

# Non-streaming
response = client.chat.completions.create(
    model="qwen3-8b",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "What is llama.cpp?"}
    ]
)
print(response.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="llama-3.3-70b",
    messages=[{"role": "user", "content": "Explain zero-knowledge proofs."}],
    stream=True
)

for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)
```

***

## TypeScript / Node.js (OpenAI SDK)

```typescript
import OpenAI from "openai"

const client = new OpenAI({
    baseURL: "https://api.robincompute.org/v1",
    apiKey: "rcompute_live_your_key_here"
})

// Non-streaming
const response = await client.chat.completions.create({
    model: "qwen3-8b",
    messages: [
        { role: "system", content: "You are a concise assistant." },
        { role: "user", content: "What is llama.cpp?" }
    ]
})
console.log(response.choices[0].message.content)

// Streaming
const stream = await client.chat.completions.create({
    model: "llama-3.3-70b",
    messages: [{ role: "user", content: "Explain zero-knowledge proofs." }],
    stream: true
})

for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content ?? "")
}
```

***

## Keeping the key out of your code

Keys live in environment variables. Source files are for code.

```bash
export ROBINCOMPUTE_API_KEY="rcompute_live_your_key_here"
```

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.robincompute.org/v1",
    api_key=os.environ["ROBINCOMPUTE_API_KEY"]
)
```

```typescript
const client = new OpenAI({
    baseURL: "https://api.robincompute.org/v1",
    apiKey: process.env.ROBINCOMPUTE_API_KEY!
})
```

***

## Getting at the on-chain receipt data

Every response ships with headers pointing at the job's on-chain settlement, your proof that the job ran and settled. The OpenAI SDK drops headers on the floor, so to read the transaction hashes, make the HTTP call yourself and inspect the raw response.

```python
import httpx

response = httpx.post(
    "https://api.robincompute.org/v1/chat/completions",
    headers={"Authorization": f"Bearer {api_key}"},
    json={
        "model": "qwen3-8b",
        "messages": [{"role": "user", "content": "Hello"}]
    }
)

job_id = response.headers.get("x-robincompute-job-id")
settlement_tx = response.headers.get("x-robincompute-settlement-tx")
print(f"Job: {job_id}")
print(f"Settlement tx: https://robinhoodchain.blockscout.com/tx/{settlement_tx}")
```

Want typed receipts, structured streaming, or wallet-native auth? Reach for the \[JavaScript SDK]\(

) or the \[Python usage guide]\().

***

## Picking a model

RobinCompute names its own models; none of OpenAI's IDs carry over. `GET /v1/models` returns the live catalog; that endpoint, not this table, is the source of truth. Rough equivalences:

| OpenAI model    | Comparable RobinCompute model | Notes                                        |
| --------------- | ----------------------------- | -------------------------------------------- |
| `gpt-4o`        | `llama-3.3-70b`               | Solid all-around reasoning                   |
| `gpt-4o-mini`   | `qwen3-8b`                    | Quick, inexpensive, handles most workloads   |
| `gpt-3.5-turbo` | `mistral-7b`                  | Cheapest and fastest option                  |
| none            | `deepseek-r1`                 | Built for extended reasoning, math, and code |

***

## Where behavior diverges from OpenAI

**Prepaid credits, not invoices.** No monthly bill arrives. You load credits up front and calls draw the balance down. Empty balance, no calls. Pricing you can check before you spend, not after.

**Settlement headers on every response.** Every completion comes back stamped with `x-robincompute-job-id` and `x-robincompute-tx-hash`: the job's on-chain settlement, ready to pull up on Blockscout. OpenAI responses carry nothing comparable.

**Capacity pricing instead of rate limits.** No quota tiers, no one deciding how much inference you deserve. When workers for your model run dry, you get a `503` with a `retry_after` value. That is the whole policy: well-behaved clients never see queues or throttling.

**Deprecation by governance.** Model IDs stay stable. Retiring one takes a RobinCompute community vote to drop it from the recommended list, announced ahead of time. The ID keeps working until that vote lands, not until a two-week warning window runs out.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.robincompute.org/integrations/openai-compatible.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
