DocsGemini 3.1 Flash Lite Preview API usage and code examples

Gemini 3.1 Flash Lite Preview API usage and code examples

Base URL, authentication, endpoints, and code examples for calling Gemini 3.1 Flash Lite Preview (model ID: gemini-3.1-flash-lite-preview) through the API.

Model details

Model IDgemini-3.1-flash-lite-preview
ProviderGoogle
TypeText
StatusAvailable
Context length1,050,000 tokens
Processing regionBeing confirmed
PricingSee the model page

Base URL and authentication

FormatBase URLKey header
OpenAIhttps://token.echohub.io/v1Authorization: Bearer
Anthropichttps://token.echohub.iox-api-key / Authorization: Bearer

Create an API key in the console and put it in the ECHO_API_KEY environment variable.

Endpoints

Method and pathWhat it does
POST /v1/chat/completionsGenerate a chat reply (Chat Completions API)
POST /v1/responsesGenerate a response (Responses API)
POST /v1/messagesGenerate a chat reply (Messages API)

Call examples

The same model ID works with both the OpenAI and Anthropic formats.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://token.echohub.io/v1",
    api_key=os.environ["ECHO_API_KEY"],
)

res = client.chat.completions.create(
    model="gemini-3.1-flash-lite-preview",
    messages=[{"role": "user", "content": "Hello"}],
)
print(res.choices[0].message.content)

Related docs