FlexAI Completions API

Legacy text completions

GitHub OpenAPI

Operations 1

POST /v1/completions Create a (legacy) text completion #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/flexai:flexai-completions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

flexai-completions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: FlexAI Inference Completions API
  version: 1.0.0
  description: 'OpenAI-compatible inference API for text, code, reasoning, vision, and

    embedding models hosted by FlexAI. Use any OpenAI SDK by pointing the

    `base_url` at this service.'
  contact:
    name: FlexAI Support
    email: support@flex.ai
    url: https://docs.flex.ai/inference-api/overview
servers:
- url: https://api.flex.ai
  description: Production (US)
- url: https://eu.api.flex.ai
  description: Production (EU)
security:
- bearerAuth: []
tags:
- name: Completions
  description: Legacy text completions.
paths:
  /v1/completions:
    post:
      tags:
      - Completions
      summary: Create a (legacy) text completion
      description: 'Prefer `/v1/chat/completions` for new integrations. `/v1/completions` is

        kept for compatibility with older OpenAI SDK callers.'
      operationId: createCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model
              - prompt
              properties:
                model:
                  type: string
                  example: Meta-Llama-3.1-8B-Instruct-FP8
                prompt:
                  oneOf:
                  - type: string
                  - type: array
                    items:
                      type: string
                max_tokens:
                  type: integer
                temperature:
                  type: number
                stream:
                  type: boolean
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: 'Per-key RPM exceeded. Response includes `Retry-After` and

        `x-ratelimit-*` headers.

        '
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds until the next window.
        x-ratelimit-limit-requests:
          schema:
            type: integer
        x-ratelimit-remaining-requests:
          schema:
            type: integer
        x-ratelimit-reset-requests:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Invalid request — malformed body, unknown model, or schema violation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Upstream or gateway error. Safe to surface `error.message` to users.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: Key budget exhausted — add credit in the dashboard to continue.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - message
          - type
          properties:
            message:
              type: string
            type:
              type: string
              example: invalid_request_error
            code:
              type: string
              description: 'Stable machine-readable code for the failure. Present on

                most error paths; OMITTED on FastAPI default-validation

                bodies. Do not assume always present.

                '
            doc_url:
              type: string
              format: uri
              description: 'FlexAI extension. Link to the relevant dashboard / docs

                page for the failure mode (e.g. invalid key → /dashboard/keys).

                Present on auth and quota errors.

                '
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk-xxxx
      description: 'Virtual API key. Create one from the

        [FlexAI dashboard](https://platform.flex.ai/dashboard/keys). Pass as

        `Authorization: Bearer sk-xxxx`.

        '
x-provenance:
  method: harvested
  publisher: FlexAI
  source: https://docs.flex.ai/inference-api/openapi.yaml
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)