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

# Model calls

> Call OpenAI models from a deployed app with no API key, billed per token to your credits.

A deployed app calls OpenAI models through floo with the stock OpenAI SDK. There is no key to create or store: the app proves who it is with a short-lived token for its own identity, and floo bills the tokens to your org's credits.

## Call a model

Every deploy sets `FLOO_AI_BASE_URL`. Fetch an identity token for that URL and pass it as the API key.

```python Python theme={null}
import os
import requests
from openai import OpenAI

base_url = os.environ["FLOO_AI_BASE_URL"]
token = requests.get(
    "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity",
    params={"audience": base_url},
    headers={"Metadata-Flavor": "Google"},
).text

client = OpenAI(base_url=base_url, api_key=token)
response = client.responses.create(model="openai/gpt-6-luna", input="Summarize this ticket: ...")
print(response.output_text)
```

```js Node theme={null}
import OpenAI from "openai";

const baseURL = process.env.FLOO_AI_BASE_URL;
const tokenUrl =
  "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity" +
  `?audience=${encodeURIComponent(baseURL)}`;
const token = await (await fetch(tokenUrl, { headers: { "Metadata-Flavor": "Google" } })).text();

const client = new OpenAI({ baseURL, apiKey: token });
const response = await client.responses.create({ model: "openai/gpt-6-luna", input: "Summarize this ticket: ..." });
console.log(response.output_text);
```

The token lasts one hour. Fetch a new one for each job, or cache it for up to 50 minutes.

The token works only inside a deployed app. Running the app on your laptop is not supported yet.

## Models

| Model | Use it for | Endpoints |
| - | - | - |
| `openai/gpt-6-astra` | The hardest reasoning and coding work | `responses` |
| `openai/gpt-6.1-sol` | Complex work at a fifth of Astra's price | `responses` |
| `openai/gpt-6.1-terra` | Vision and writing | `responses` |
| `openai/gpt-6-luna` | Cheap, high-volume tasks | `responses`, `decisions` |

`GET $FLOO_AI_BASE_URL/models` lists the same ids. Responses report the floo id in `model`.

`decisions` is OpenAI's Decisions API: typed answers (yes/no probability, a choice, or a score) about some input, faster than `responses`. Its output tokens are free.

## Pricing

Tokens bill at OpenAI's list price plus a 10% processing fee, from your credits, as each call returns. Rates per million tokens are on the [pricing page](https://getfloo.com/pricing) under **Models**. A prompt over 272K input tokens bills at the long-context rates.

Calls from your prod environment bill to prod. Calls from dev and preview environments bill to dev.

## What floo does not pass through

One OpenAI account serves every floo app, so nothing a request sends may be stored there. These requests are refused with `400`:

| Request | Do this instead |
| - | - |
| `previous_response_id`, `conversation`, `background`, a stored `prompt` | Send the full input on each request |
| Hosted tools: web search, file search, code interpreter, image generation, computer use, MCP | Use `function` or `custom` tools and run them in your app |
| `file_id` anywhere in the input | Send images and files inline or by URL |
| `stream: true` | Wait for the full response; streaming is not available yet |
| A `service_tier` other than `default` or `auto` | Omit it |
| `store` on `decisions` | Omit it |

floo sets `store: false` on every `responses` call and scopes `safety_identifier` and `prompt_cache_key` to your app.

## Limits

* 600 model calls per minute per org.
* 8 model calls running at once per org.
* A call starts only while your org has credits. A call that starts with credits left is billed in full when it returns.

## Errors

| Status | Code | Meaning |
| - | - | - |
| 401 | `UNAUTHORIZED` | The token is missing, expired, or not for a floo app. Fetch a new one with `FLOO_AI_BASE_URL` as the audience. |
| 402 | `SPEND_AUTHORITY_EXHAUSTED` | Your org is out of credits. |
| 403 | `AI_NOT_ENABLED` | Model calls are not on for your org yet. |
| 429 | `RATE_LIMIT_EXCEEDED`, `AI_ORG_CONCURRENCY_LIMIT`, `AI_ENDPOINT_BUSY` | Too many calls. Retry after `Retry-After` or shortly. |
| 502 | `MODEL_PROVIDER_UNAVAILABLE` | The model provider failed or did not respond. Nothing was billed. |
| 503 | `AI_NOT_CONFIGURED`, `CALLER_IDENTITY_UNAVAILABLE` | floo cannot serve model calls right now. Retry. |

Other errors from the model come back with OpenAI's status and an `error` object, and are not billed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.