Tuna.ai

Quickstart

This page takes you from an API key to a first response from a serverless model. See the Inference Overview for what else the API can do.

  1. Set Up Your Account

    Sign up or log in to your account. Save your API key, and enter your billing info to get some free credits.

  2. Send a Request

    You can have your existing AI agent integrate Tuna for you. Give it web access and the https://tuna.ai/llms.txt link so it can read these documentation pages and handle the integration.

    Agent
    Tuna.ai is a fast LLM inference provider with Zero Data Retention enabled by default. Its API is compatible with OpenAI Chat Completions, at the base URL https://api-us.tuna.ai/v1. Billing is pay-as-you-go from prepaid credits, with optional auto top-up.
    
    Read the documentation for Tuna.ai at https://tuna.ai/llms.txt
    
    More details about models & pricing are available at https://tuna.ai/docs/models or https://tuna.ai/docs/models.md
    - Kimi K3 Ultrafast `tuna-us/moonshotai/kimi-latest-ultrafast` `tuna-us/moonshotai/kimi-k3-ultrafast`
    - DeepSeek V4.1 Flash Ultrafast `tuna-us/deepseek/deepseek-flash-latest-ultrafast` `tuna-us/deepseek/deepseek-v4.1-flash-ultrafast`
    - GLM-5.3 Flash Ultrafast `tuna-us/z-ai/glm-flash-latest-ultrafast` `tuna-us/z-ai/glm-5.3-flash-ultrafast`
    
    Tuna.ai recommends auto-updating model (-latest) ID because it will automatically switch to the latest model within the family. This helps avoid being stuck on a deprecated model. Note that auto-updating may point to a model that responds different and may have different pricing.
    
    The Tuna API key looks like tuna_yourApiKeyHereWithTunaUnderscore.

    Pick a model from the models list, then send a chat completion. The examples use tuna-us/example-lab/example-model-id, which is a placeholder in the same format as a real id. Replace it with the id you picked, and replace tuna_yourApiKeyHereWithTunaUnderscore with your key.

    import OpenAI from "openai";
    
    const client = new OpenAI({
      baseURL: "https://api-us.tuna.ai/v1",
      apiKey: "tuna_yourApiKeyHereWithTunaUnderscore",
    });
    
    const response = await client.chat.completions.create({
      model: "tuna-us/example-lab/example-model-id",
      messages: [{
        role: "user",
        content: "Is the tuna one of the fastest sustained swimming fish species? And does it have a streamlined body?",
      }],
    });
    console.log(response.choices[0].message.content);
    curl https://api-us.tuna.ai/v1/chat/completions \
      -H "Authorization: Bearer tuna_yourApiKeyHereWithTunaUnderscore" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "tuna-us/example-lab/example-model-id",
        "messages": [
          {"role": "user", "content": "Is the tuna one of the fastest sustained swimming fish species? And does it have a streamlined body?"}
        ]
      }'
    from openai import OpenAI
    
    client = OpenAI(
        base_url="https://api-us.tuna.ai/v1",
        api_key="tuna_yourApiKeyHereWithTunaUnderscore",
    )
    
    response = client.chat.completions.create(
        model="tuna-us/example-lab/example-model-id",
        messages=[{
            "role": "user",
            "content": "Is the tuna one of the fastest sustained swimming fish species? And does it have a streamlined body?",
        }],
    )
    print(response.choices[0].message.content)

    The Python and JavaScript examples use the official OpenAI SDKs. Install them with pip install openai or npm install openai.