DoublewordDoubleword

Creating an API Key

API keys provide programmatic access to the Doubleword Inference API. You need one to make requests from your code, the DW CLI, or any of the integration packages.

The Doubleword API is fully OpenAI-compatible at https://api.doubleword.ai/v1. Any SDK or tool that supports a custom OpenAI endpoint — including the official OpenAI Python and Node.js libraries — can use your API key to list models, create chat completions, generate embeddings, and submit batches.

How to Create an API Key

  1. Open the API Keys page in the Doubleword Console
  2. Click Create API Key
  3. Give it a name (e.g. "development", "production", "research")
  4. Copy the key immediately — it won't be shown again

You can also create a key directly from a model card:

  1. Select the model you want to use
  2. Click the API button
  3. When the code example loads, select Fill API Key to generate a new key

Using Your API Key

Set it as an environment variable (recommended for production):

export DOUBLEWORD_API_KEY="{{apiKey}}"

Or pass it directly in code:

from autobatcher import BatchOpenAI
import asyncio

client = BatchOpenAI(
    base_url="https://api.doubleword.ai/v1",
    api_key="{{apiKey}}",
)

async def main():
    response = await client.chat.completions.create(
        model="{{selectedModel.id}}",
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(response.choices[0].message.content)
    await client.close()

asyncio.run(main())

Autobatcher is a drop-in AsyncOpenAI replacement that transparently batches requests for up to 90% cost savings. You can also use the standard openai Python or Node.js libraries directly if you prefer real-time responses.

Best Practices

  • Create separate keys for different applications or environments (dev, staging, production) so you can revoke one without affecting others
  • Never commit keys to version control — use environment variables or a secrets manager
  • Rotate keys periodically — delete old keys and create new ones from the console
  • Organization keys — if you're part of an organization, switch to the org context before creating a key so usage is billed to the organization